;;
;; cust-c-mode.el
;;

;; Function to insert a system header:
(defun system-include-header (&optional header)
  "Insert an #include for a system header"
  (interactive)
  (while (or (not header) (string= header ""))
    (setq header (read-string "Header name: ")))
  (insert "#include <" (symbol-value 'header) ">\n"))

;; function to insert a local header:
(defun local-include-header (&optional header)
  "insert an #include for a local header file"
  (interactive)
  (while (or (not header) (string= header ""))
    (setq header (read-string "header name (minus the .h): ")))
  (insert  "#ifndef " (upcase header) "_H\n"
	   "#define " (upcase header) "_H\n"
	   "#include \"" (symbol-value 'header) ".h\"\n"
	   "#endif\n"
	   ))

;;
(add-hook 'c-mode-hook
	  (function (lambda ()
		      (require 'easymenu)
		      (easy-menu-define c-menu c-mode-map "C Menu"
			'("Insert"
			  ["Insert System Header" system-include-header t]
			  ["Insert Local Header" local-include-header t]
			  ))
		      ;;
		      (define-key c-mode-map "\C-csh" 'system-include-header)
		      (define-key c-mode-map "\C-clh" 'local-include-header)
;;
;; cust-c-mode.el
;;

;;
;; cust-c-mode.el
;;

;; Function to insert a system header:
(defun system-include-header (&optional header)
  "Insert an #include for a system header"
  (interactive)
  (while (or (not header) (string= header ""))
    (setq header (read-string "Header name: ")))
  (insert "#include <" (symbol-value 'header) ">\n"))

;; function to insert a local header:
(defun local-include-header (&optional header)
  "insert an #include for a local header file"
  (interactive)
  (while (or (not header) (string= header ""))
    (setq header (read-string "header name (minus the .h): ")))
  (insert  "#ifndef " (upcase header) "_H\n"
	   "#define " (upcase header) "_H\n"
	   "#include \"" (symbol-value 'header) ".h\"\n"
	   "#endif\n"
	   ))

;;
(add-hook 'c-mode-hook
	  (function (lambda ()
		      (require 'easymenu)
		      (easy-menu-define c-menu c-mode-map "C Menu"
			'("Insert"
			  ["Insert System Header" system-include-header t]
			  ["Insert Local Header" local-include-header t]
			  ))
		      ;;
		      (define-key c-mode-map "\C-csh" 'system-include-header)
		      (define-key c-mode-map "\C-clh" 'local-include-header)
		      )))
;;
;; cust-c-mode.el
;;

Fix missing brackets in c-mode.

Fix missing brackets in c-mode.


;;; my-python.el --- Python settings & customisations -*- lexical-binding: t -*-

;; Copyright (C) 2016  Sergey Timanin

;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at

;;     http://www.apache.org/licenses/LICENSE-2.0

;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

;;; Commentary:

;;; Code:

(defun my-python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(use-package company-jedi
  :defer t
  :init
  (eval-after-load "company"
    '(add-hook 'python-mode-hook 'my-python-mode-hook)))

(use-package anaconda-mode
  :defer t
  :config
  (add-hook 'python-mode-hook 'anaconda-mode)
  (add-hook 'python-mode-hook 'anaconda-eldoc-mode))

(use-package company-anaconda
  :defer t
  :config
  (eval-after-load "company"
    '(add-to-list 'company-backends 'company-anaconda)))

(provide 'my-python)

;;; my-python.el ends here

;;; my-python.el --- Python settings & customisations -*- lexical-binding: t -*-

;; Copyright (C) 2016  Sergey Timanin

;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at

;;     http://www.apache.org/licenses/LICENSE-2.0

;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

;;; Commentary:

;;; Code:

(defun my-python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(use-package company-jedi
  :defer t
  :init
  (eval-after-load "company"
    '(add-hook 'python-mode-hook 'my-python-mode-hook)))

(use-package anaconda-mode
  :defer t
  :config
  (add-hook 'python-mode-hook 'anaconda-mode)
  (add-hook 'python-mode-hook 'anaconda-eldoc-mode))

(use-package company-anaconda
  :defer t
  :config
  (eval-after-load "company"
    '(add-to-list 'company-backends 'company-anaconda)))

(use-package pyvenv)

(provide 'my-python)

;;; my-python.el ends here

Add support for Python virtual environments


;; Basic clojure support, even in Emacs 23
;; See also init-clojure-cider.el

(require-package 'clojure-mode)
(require-package 'cljsbuild-mode)
(require-package 'elein)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Slime with Clojure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun slime-clojure-repl-setup ()
  "Some REPL setup additional to that in durendal."
  (when (string-equal (slime-lisp-implementation-name) "clojure")
    (when (slime-inferior-process)
      (message "Setting up repl for clojure")
      (slime-redirect-inferior-output))

    (set-syntax-table clojure-mode-syntax-table)
    (setq lisp-indent-function 'clojure-indent-function)
    (let (font-lock-mode)
      (clojure-mode-font-lock-setup))))

(after-load 'slime-repl
  (add-hook 'slime-repl-mode-hook 'slime-clojure-repl-setup))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Misc clojure tweaks
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(after-load 'clojure-mode
  (add-hook 'clojure-mode-hook 'sanityinc/lisp-setup)
  (add-hook 'clojure-mode-hook 'subword-mode))

;; Use clojure-mode for clojurescript, since clojurescript-mode
;; pulls in Slime
(add-auto-mode 'clojure-mode "\\.cljs\\'")

(provide 'init-clojure)

;; Basic clojure support, even in Emacs 23
;; See also init-clojure-cider.el

(require-package 'clojure-mode)
(require-package 'cljsbuild-mode)
(require-package 'elein)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Misc clojure tweaks
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(after-load 'clojure-mode
  (add-hook 'clojure-mode-hook 'sanityinc/lisp-setup)
  (add-hook 'clojure-mode-hook 'subword-mode))

(provide 'init-clojure)

Remove some defunct clojure config

Remove some defunct clojure config


;; edit area full screen
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
;; fringes
(set-fringe-mode nil)  ; default
(setq-default fringe-indicator-alist
              '((truncation . nil) (continuation . nil)))
;; Show column number in mode line
(setq column-number-mode t)
;; line number
(setq linum-format "%4d")
;; highlight current line
(when (display-graphic-p)
  (global-hl-line-mode t)
  (set-face-background 'hl-line "#073642"))
;; no blink
(blink-cursor-mode (- (*) (*) (*)))
;; tool tips in echo area
(tooltip-mode -1)
(setq tooltip-use-echo-area t)
;; When emacs asks for "yes" or "no", let "y" or "n" sufficide
(fset 'yes-or-no-p 'y-or-n-p)
;; font
(set-default-font "DejaVu Sans Mono-10")
;; setup right and left margins
;; (add-hook 'window-configuration-change-hook
;;           (lambda ()
;;             (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 0 0)))

;; edit area full screen
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
;; fringes
(set-fringe-mode nil)  ; default
(setq-default fringe-indicator-alist
              '((truncation . nil) (continuation . nil)))
;; Show column number in mode line
(setq column-number-mode t)
;; line number
(setq linum-format "%4d")
;; highlight current line
(when (display-graphic-p)
  (global-hl-line-mode t)
  (set-face-background 'hl-line "#073642"))
;; no blink
(blink-cursor-mode (- (*) (*) (*)))
;; tool tips in echo area
(tooltip-mode -1)
(setq tooltip-use-echo-area t)
;; When emacs asks for "yes" or "no", let "y" or "n" sufficide
(fset 'yes-or-no-p 'y-or-n-p)
;; font
(set-default-font "DejaVu Sans Mono-10")
;; important for golden-ratio to work properly
(setq window-combination-resize t)
;; setup right and left margins
;; (add-hook 'window-configuration-change-hook
;;           (lambda ()
;;             (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 0 0)))

Add (setq window-combination-resize t) for golden-ratio mode to work properly


(setq-default compilation-scroll-output t)

(require-package 'alert)

;; Customize `alert-default-style' to get messages after compilation

(defun sanityinc/alert-after-compilation-finish (buf result)
  "Use `alert' to report compilation RESULT if BUF is hidden."
  (let ((buf-is-visible nil))
    (walk-windows (lambda (w)
                    (when (eq (window-buffer w) buf)
                      (setq buf-is-visible t))))
    (unless buf-is-visible
      (alert (concat "Compilation " result)
             :buffer buf
             :category 'compilation))))

(after-load 'compile
  (add-hook 'compilation-finish-functions
            'sanityinc/alert-after-compilation-finish))

(provide 'init-compile)

(setq-default compilation-scroll-output t)

(require-package 'alert)

;; Customize `alert-default-style' to get messages after compilation

(defun sanityinc/alert-after-compilation-finish (buf result)
  "Use `alert' to report compilation RESULT if BUF is hidden."
  (unless (catch 'is-visible
            (walk-windows (lambda (w)
                            (when (eq (window-buffer w) buf)
                              (throw 'is-visible t)))))
    (alert (concat "Compilation " result)
           :buffer buf
           :category 'compilation)))

(after-load 'compile
  (add-hook 'compilation-finish-functions
            'sanityinc/alert-after-compilation-finish))

(provide 'init-compile)

Make after-compilation alert function more efficient


;;; packages.el -- Emacs package management
(require 'package)

(defvar pjones:package-archives
  '(("marmalade" . "http://marmalade-repo.org/packages/")
    ("melpa"     . "http://melpa.milkbox.net/packages/")
    ("org"       . "http://orgmode.org/elpa/"))
  "List of package archives to use with Emacs.")

(defvar pjones:packages
  '(magit flymake-ruby ruby-end inf-ruby htmlize yaml-mode
          bm gist haskell-mode ido-select-window switch-window
          markdown-mode skewer-mode org bbdb)
  "A list of packages to ensure are installed at launch.")

(dolist (archive pjones:package-archives)
  (add-to-list 'package-archives archive t))

;; Prepare package management
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))

;; Make sure all the packages are installed
(defun pjones:install-packages ()
  (dolist (p pjones:packages)
    (when (not (package-installed-p p))
      (package-install p))))

;;; packages.el -- Emacs package management
(require 'package)

(defvar pjones:package-archives
  '(("marmalade" . "http://marmalade-repo.org/packages/")
    ("melpa"     . "http://melpa.milkbox.net/packages/")
    ("org"       . "http://orgmode.org/elpa/"))
  "List of package archives to use with Emacs.")

(defvar pjones:packages
  '(magit flymake-ruby ruby-end inf-ruby htmlize yaml-mode
          bm gist haskell-mode ido-select-window switch-window
          markdown-mode skewer-mode org bbdb nix-mode)
  "A list of packages to ensure are installed at launch.")

(dolist (archive pjones:package-archives)
  (add-to-list 'package-archives archive t))

;; Prepare package management
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))

;; Make sure all the packages are installed
(defun pjones:install-packages ()
  (dolist (p pjones:packages)
    (when (not (package-installed-p p))
      (package-install p))))

Add nix-mode to package list

Add nix-mode to package list


;; -*- lexical-binding: t -*-

(defconst my-rust-packages '(lsp-mode
                             rust-mode))

(defun my-rust/post-init-lsp-mode ()
  ;; Save CPU cycles by avoiding compilation after every keypress.
  ;; It does cause the laptop to get hot fast.
  (setq lsp-rust-wait-to-build 1500))

(defun my-rust/post-init-rust-mode ()
  (add-hook 'rust-mode-hook #'my-rust//sync-fill-column-with-rustcmd))

;; -*- lexical-binding: t -*-

(defconst my-rust-packages '(lsp-mode
                             rust-mode
                             rust-rustfmt))

(defun my-rust/post-init-lsp-mode ()
  ;; Save CPU cycles by avoiding compilation after every keypress.
  ;; It does cause the laptop to get hot fast.
  (setq lsp-rust-wait-to-build 1500))

(defun my-rust/post-init-rust-mode ()
  (add-hook 'rust-mode-hook #'my-rust//sync-fill-column-with-rustcmd))

(defun my-rust/post-init-rust-rustfmt ()
  ;; When automatic rustfmt on save is turned on and there are syntax errors in
  ;; the content of the file, rustfmt will open a buffer and move the cursor to
  ;; the issue. This is a very annoying behavior for a chronic saver like me.
  ;; Let's not do that.
  (setq rust-format-show-buffer nil
        rust-format-goto-problem nil))

Work around erratic buffer popups by rustfmt


;;; lang/sml/config.el -*- lexical-binding: t; -*-

(use-package! sml-mode
  :mode "\\.s\\(?:ml\\|ig\\)\\'"
  :config
  (set-repl-handler! 'sml-mode #'run-sml)

  ;; don't auto-close apostrophes (type 'a = foo) and backticks (`Foo)
  (sp-with-modes 'sml-mode
    (sp-local-pair "'" nil :actions nil)
    (sp-local-pair "`" nil :actions nil))

  (map! :map sml-mode-map
        :i "RET"   #'reindent-then-newline-and-indent
        :i "M-SPC" #'sml-electric-space
        :i "|"     #'sml-electric-pipe
        :localleader
        :desc "Run SML" "'" #'run-sml
        :prefix ("e" . "eval")
        :desc "Run buffer"                  "b" #'sml-prog-proc-send-buffer
        :desc "Run the paragraph"           "f" #'sml-send-function
        :desc "Run region"                  "r" #'sml-prog-proc-send-region))

(use-package! company-mlton
  :when (featurep! :completion company)
  :hook (sml-mode . company-mlton-init))

;;; lang/sml/config.el -*- lexical-binding: t; -*-

(use-package! sml-mode
  :mode "\\.s\\(?:ml\\|ig\\)\\'"
  :config
  (set-repl-handler! 'sml-mode #'run-sml)

  ;; don't auto-close apostrophes (type 'a = foo) and backticks (`Foo)
  (sp-with-modes 'sml-mode
    (sp-local-pair "'" nil :actions nil)
    (sp-local-pair "`" nil :actions nil))

  (map! :map sml-mode-map
        :i "RET"   #'reindent-then-newline-and-indent
        :i "S-SPC" #'sml-electric-space
        :i "|"     #'sml-electric-pipe
        :localleader
        :desc "Run SML" "'" #'run-sml
        :prefix ("e" . "eval")
        :desc "Run buffer"                  "b" #'sml-prog-proc-send-buffer
        :desc "Run the paragraph"           "f" #'sml-send-function
        :desc "Run region"                  "r" #'sml-prog-proc-send-region))

(use-package! company-mlton
  :when (featurep! :completion company)
  :hook (sml-mode . company-mlton-init))

Fix 'starts with non-prefix key M-SPC' error

Mentioned in #1947


(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(apropos-sort-by-scores t)
 '(backup-directory-alist `((".*" \, temporary-file-directory)))
 '(fido-mode t)
 '(global-display-line-numbers-mode t)
 '(ido-create-new-buffer 'always)
 '(ido-enable-flex-matching t)
 '(ido-everywhere t)
 '(ido-mode 'both nil (ido))
 '(indent-tabs-mode nil)
 '(org-log-done 'time)
 '(org-log-into-drawer "LOGBOOK")
 '(package-archives
   '(("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))
 '(package-selected-packages
   '(paredit sml-mode ycmd solarized-theme rust-mode rainbow-delimiters markdown-mode magit company cmake-mode))
 '(standard-indent 4)
 '(tab-always-indent 'complete)
 '(tab-width 4))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(apropos-sort-by-scores t)
 '(backup-directory-alist `((".*" \, temporary-file-directory)))
 '(fido-mode t)
 '(global-display-line-numbers-mode t)
 '(ido-create-new-buffer 'always)
 '(ido-enable-flex-matching t)
 '(ido-everywhere t)
 '(ido-mode 'both nil (ido))
 '(indent-tabs-mode nil)
 '(org-log-done 'time)
 '(org-log-into-drawer "LOGBOOK")
 '(package-archives
   '(("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))
 '(package-selected-packages
   '(paredit sml-mode ycmd solarized-theme rust-mode rainbow-delimiters markdown-mode magit company cmake-mode))
 '(standard-indent 4)
 '(tab-always-indent nil)
 '(tab-width 4))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

Indent or insert tab when pressing tab key in Emacs


;;; ui/indent-guides/config.el -*- lexical-binding: t; -*-

(def-package! highlight-indent-guides
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character)
  :config
  (when (daemonp)
    (highlight-indent-guides-auto-set-faces))

  ;; Don't display first level of indentation
  (defun +indent-guides-for-all-but-first-column (level responsive display)
    (unless (< level 1)
      (highlight-indent-guides--highlighter-default level responsive display)))
  (setq highlight-indent-guides-highlighter-function #'+indent-guides-for-all-but-first-column)

  (defun +indent-guides|disable-maybe ()
    (when highlight-indent-guides-mode
      (highlight-indent-guides-mode -1)))
  ;; `highlight-indent-guides' breaks in these modes
  (add-hook 'visual-line-mode-hook #'+indent-guides|disable-maybe)
  (add-hook 'org-indent-mode-hook #'+indent-guides|disable-maybe))

;;; ui/indent-guides/config.el -*- lexical-binding: t; -*-

(def-package! highlight-indent-guides
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character)
  :config
  (add-hook 'focus-in-hook #'highlight-indent-guides-auto-set-faces)

  ;; Don't display first level of indentation
  (defun +indent-guides-for-all-but-first-column (level responsive display)
    (unless (< level 1)
      (highlight-indent-guides--highlighter-default level responsive display)))
  (setq highlight-indent-guides-highlighter-function #'+indent-guides-for-all-but-first-column)

  (defun +indent-guides|disable-maybe ()
    (when highlight-indent-guides-mode
      (highlight-indent-guides-mode -1)))
  ;; `highlight-indent-guides' breaks in these modes
  (add-hook 'visual-line-mode-hook #'+indent-guides|disable-maybe)
  (add-hook 'org-indent-mode-hook #'+indent-guides|disable-maybe))

Update highlight-indent-guides faces on focus-in

The faces may go out of sync if you spawn a tty frame via the server.
Updating it when you switch frames is a workaround for this.


(use-package rcirc
  :config
  (setq rcirc-default-nick "wilfredh")
  (setq rcirc-server-alist
        '(("irc.freenode.net" :channels ("#emacs" "#guile"))
          ("irc.mozilla.org" :channels ("#rust"))))
  ;; Keep history.
  (setq rcirc-log-flag t)
  (setq rcirc-log-directory "~/irc_logs")
  ;; Ignore away/join/part messages from lurkers.
  (setq rcirc-omit-responses '("JOIN" "PART" "QUIT" "NICK" "AWAY"))
  (add-hook 'rcirc-mode-hook #'rcirc-omit-mode))

(provide 'irc-customisations)

(use-package rcirc
  :config
  (setq rcirc-default-nick "wilfredh")
  (setq rcirc-server-alist
        '(("irc.freenode.net" :channels ("#emacs" "#guile"))
          ("irc.mozilla.org" :channels ("#rust"))))
  ;; Keep history.
  (setq rcirc-log-flag t)
  (setq rcirc-log-directory "~/irc_logs")
  ;; Ignore away/join/part messages from lurkers.
  (setq rcirc-omit-responses '("JOIN" "PART" "QUIT" "NICK" "AWAY"))
  (add-hook 'rcirc-mode-hook #'rcirc-omit-mode)
  (require 'rcirc-color))

(provide 'irc-customisations)

Add coloured nicks in IRC

Add coloured nicks in IRC


(when (eval-when-compile (>= emacs-major-version 24))
  (require-package 'flycheck)
  (add-hook 'after-init-hook 'global-flycheck-mode))

;; Override default flycheck triggers
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)
      flycheck-idle-change-delay 0.8)

(defun sanityinc/flycheck-errors-visible-p ()
  "Returns t if a window in the current frame is displaying \"*Flycheck errors*\"."
  (let (found-flycheck-errors-buf)
    (walk-window-tree (lambda (w)
                        (when (string-equal "*Flycheck errors*"
                          (buffer-name (window-buffer w)))
        (setq found-flycheck-errors-buf t))))
    (selected-frame)
    found-flycheck-errors-buf))

(defun sanityinc/flycheck-maybe-display-errors (errors)
  (unless (sanityinc/flycheck-errors-visible-p)
    (flycheck-display-error-messages errors)))

(setq flycheck-display-errors-function 'sanityinc/flycheck-maybe-display-errors)

(provide 'init-flycheck)

(when (eval-when-compile (>= emacs-major-version 24))
  (require-package 'flycheck)
  (add-hook 'after-init-hook 'global-flycheck-mode))

;; Override default flycheck triggers
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)
      flycheck-idle-change-delay 0.8)

(setq flycheck-display-errors-function #'flycheck-display-error-messages-unless-error-list)

(provide 'init-flycheck)

Replace home-baked version of flycheck-display-error-messages-unless-error-list

Thanks @lunaryorn!


(req-package dired+
  :config
  (setq 'diredp-hide-details-initially-flag t)
  (diredp-toggle-find-file-reuse-dir))

(req-package dired+
  :init
  (diredp-toggle-find-file-reuse-dir 1)
  :config
  (setq 'diredp-hide-details-initially-flag t))

Set dired+ to reuse buffer

Set dired+ to reuse buffer


;;; packages.el -- Emacs package management
(require 'package)

(defvar pjones:package-archives
  '(("marmalade" . "http://marmalade-repo.org/packages/")
    ("melpa" . "http://melpa.milkbox.net/packages/"))
  "List of package archives to use with Emacs.")

(defvar pjones:packages
  '(magit flymake-ruby ruby-end inf-ruby htmlize yaml-mode bm gist)
  "A list of packages to ensure are installed at launch.")

(dolist (archive pjones:package-archives)
  (add-to-list 'package-archives archive t))

;; Prepare package management
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))

;; Make sure all the packages are installed
(defun pjones:install-packages ()
  (dolist (p pjones:packages)
    (when (not (package-installed-p p))
      (package-install p))))

;;; packages.el -- Emacs package management
(require 'package)

(defvar pjones:package-archives
  '(("marmalade" . "http://marmalade-repo.org/packages/")
    ("melpa" . "http://melpa.milkbox.net/packages/"))
  "List of package archives to use with Emacs.")

(defvar pjones:packages
  '(magit flymake-ruby ruby-end inf-ruby htmlize yaml-mode bm gist haskell-mode)
  "A list of packages to ensure are installed at launch.")

(dolist (archive pjones:package-archives)
  (add-to-list 'package-archives archive t))

;; Prepare package management
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))

;; Make sure all the packages are installed
(defun pjones:install-packages ()
  (dolist (p pjones:packages)
    (when (not (package-installed-p p))
      (package-install p))))

Install Haskell mode and update xmonad key bindings and mouse warping


;;; package --- Summary

;;; Commentary:

;;; Code:

(add-to-list 'load-path (expand-file-name "site-lisp" user-emacs-directory))

(require-package 'slime)
(setq slime-lisp-implementations
      '((ccl ("/usr/local/bin/ccl64"))
        (cmucl ("/usr/local/Cellar/cmucl/20e/bin/lisp"))))
(after-load 'slime
  (slime-setup '(slime-repl slime-fancy)))

(require-package 'exec-path-from-shell)
(after-load 'exec-path-from-shell
  (dolist (var '("JAVA_HOME"))
    (add-to-list 'exec-path-from-shell-variables var)))

(require-package 'pretty-lambdada)
(pretty-lambda-for-modes)

(require 'cltl2)

(provide 'init-local)
;;; init-local.el ends here

;;; package --- Summary

;;; Commentary:

;;; Code:

(add-to-list 'load-path (expand-file-name "site-lisp" user-emacs-directory))

(require-package 'slime)
(setq slime-lisp-implementations
      '((ccl ("/usr/local/bin/ccl64"))
        (cmucl ("/usr/local/Cellar/cmucl/20e/bin/lisp"))))
(after-load 'slime
  (slime-setup '(slime-repl slime-fancy)))

(require-package 'exec-path-from-shell)
(after-load 'exec-path-from-shell
  (dolist (var '("JAVA_HOME"))
    (add-to-list 'exec-path-from-shell-variables var)))

(require-package 'pretty-lambdada)
(pretty-lambda-for-modes)

(require 'cltl2)

;;; maxima
(add-to-list 'load-path "/usr/local/Cellar/maxima/5.33.0/share/maxima/5.33.0/emacs/")
(autoload 'maxima-mode "maxima" "Maxima mode" t)
(autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima" "Maxima interaction" t)
(autoload 'imath-mode "imath" "Imath mode for math formula input" t)
(setq imaxima-use-maxima-mode-flag t)
(add-to-list 'auto-mode-alist '("\\.ma[cx]" . maxima-mode))

;;; shortcut
(global-set-key (kbd "<f5>") 'ibuffer)

(provide 'init-local)
;;; init-local.el ends here

Add maxima mode and ibuffer shortcut

Add maxima mode and ibuffer shortcut


(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

;; from http://stackoverflow.com/questions/10092322/how-to-automatically-install-emacs-packages-by-specifying-a-list-of-package-name (Nicolas Dudebout)
;; {{{
(setq package-list '(ace-jump-mode
                     browse-kill-ring
                     auto-complete
                     lua-mode
                     glsl-mode
                     undo-tree
                     cmake-mode
                     haskell-mode
                     htmlize
                     muse
                     fic-mode
                     web-mode
                     php-mode
                     auto-highlight-symbol
                     org
                     isearch-symbol-at-point
                     ido-ubiquitous
                     ido-vertical-mode
                     smex
                     window-number
                     fuzzy
                     goto-last-change
                     markdown-mode
                     flycheck))

(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))
;; }}}

(byte-recompile-directory "~/.emacs.d")

(add-hook 'after-init-hook (lambda () (load "~/.emacs.d/init")))

;; auto puts
(put 'set-goal-column 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

;; from http://stackoverflow.com/questions/10092322/how-to-automatically-install-emacs-packages-by-specifying-a-list-of-package-name (Nicolas Dudebout)
;; {{{
(setq package-list '(ace-jump-mode
                     browse-kill-ring
                     auto-complete
                     yasnippet
                     lua-mode
                     glsl-mode
                     undo-tree
                     cmake-mode
                     haskell-mode
                     htmlize
                     muse
                     fic-mode
                     web-mode
                     php-mode
                     auto-highlight-symbol
                     org
                     isearch-symbol-at-point
                     ido-ubiquitous
                     ido-vertical-mode
                     smex
                     window-number
                     fuzzy
                     goto-last-change
                     markdown-mode
                     flycheck))

(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))
;; }}}

(byte-recompile-directory "~/.emacs.d")

;; Off suspend
(global-set-key (kbd "C-x C-z") nil)
(global-set-key (kbd "C-z") nil)

(add-hook 'after-init-hook (lambda () (load "~/.emacs.d/init")))

;; auto puts
(put 'set-goal-column 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)

Install yasnippet by default package

Install yasnippet by default package

Off suspend key.
C-x C-z
and
C-z


;;; config.el --- gtags configuration File
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(defvar gtags-enable-by-default t
  "Whether or not to enable ggtags-mode.")

(spacemacs|define-jump-handlers 'tcl-mode)
(spacemacs|define-jump-handlers 'vhdl-mode)
(spacemacs|define-jump-handlers 'awk-mode)
(spacemacs|define-jump-handlers 'dired-mode)
(spacemacs|define-jump-handlers 'compilation-mode)
(spacemacs|define-jump-handlers 'shell-mode)

;;; config.el --- gtags configuration File
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(defvar gtags-enable-by-default t
  "Whether or not to enable ggtags-mode.")

(spacemacs|define-jump-handlers tcl-mode)
(spacemacs|define-jump-handlers vhdl-mode)
(spacemacs|define-jump-handlers awk-mode)
(spacemacs|define-jump-handlers dired-mode)
(spacemacs|define-jump-handlers compilation-mode)
(spacemacs|define-jump-handlers shell-mode)

Fix jump handler macro invocation

Fix jump handler macro invocation


;;; lang/scala/config.el -*- lexical-binding: t; -*-

(def-package! scala-mode
  :mode "\\.s\\(cala\\|bt\\)$"
  :config
  (setq scala-indent:align-parameters t))

(def-package! sbt-mode :after scala-mode)

(def-package! ensime
  :after scala-mode
  :commands (ensime ensime-mode ensime-scala-mode-hook)
  :config
  (set! :company-backend 'scala-mode '(ensime-company company-yasnippet))

  (setq ensime-startup-snapshot-notification nil
        ensime-startup-notification nil
        ensime-eldoc-hints t
        ;; let DOOM handle company setup
        ensime-completion-style nil)

  (add-hook 'scala-mode-hook #'ensime-mode)
  (add-hook 'ensime-mode-hook #'eldoc-mode)

  ;; Fix void-variable imenu-auto-rescan error caused by `ensime--setup-imenu'
  ;; trying to make imenu variables buffer local before imenu is loaded.
  (require 'imenu))

;;; lang/scala/config.el -*- lexical-binding: t; -*-

(def-package! scala-mode
  :mode "\\.s\\(cala\\|bt\\)$"
  :config
  (setq scala-indent:align-parameters t))

(def-package! sbt-mode :after scala-mode)

(def-package! ensime
  :after scala-mode
  :commands (ensime ensime-mode ensime-scala-mode-hook)
  :config
  (set! :company-backend 'scala-mode '(ensime-company company-yasnippet))

  (setq ensime-startup-snapshot-notification nil
        ensime-startup-notification nil
        ensime-eldoc-hints 'all
        ;; let DOOM handle company setup
        ensime-completion-style nil)

  (add-hook 'scala-mode-hook #'ensime-mode)
  (add-hook 'ensime-mode-hook #'eldoc-mode)

  ;; Fix void-variable imenu-auto-rescan error caused by `ensime--setup-imenu'
  ;; trying to make imenu variables buffer local before imenu is loaded.
  (require 'imenu))

Fix invalid default for ensime-eldoc-hints (now set to 'all)

See valid values at https://github.com/ensime/ensime-emacs/blob/f1ca2bd6de9b4e7eabe198ada75196183a1862c0/ensime-vars.el#L51
Alternatively, could be set to nil (to avoid slowdown for complex project by default).


;;; init.el -*- lexical-binding: t; -*-

(doom!
    :completion
    (ivy +icons +fuzzy)
    (company +childframe)

    :ui
    doom
    doom-dashboard
    (modeline +light)
    ophints
    hl-todo
    nav-flash
    (popup +all +defaults)
    vc-gutter
    vi-tilde-fringe
    window-select
    hydra
    zen

    :editor
    (evil +everywhere +commands)
    multiple-cursors
    fold
    format

    :emacs
    (dired +icons)
    vc
    undo

    :tools
    eval
    make
    (magit +forge)
    lsp
    editorconfig
    pdf
    direnv

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export
        +roam2
        +gnuplot)
    (cc +lsp)
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp +pyright)
    (javascript +lsp)
    rest
    data ;; csv + XML
    (rust +lsp)
    coq
    (go +lsp)
    nix
    yaml

    :checkers
    grammar
    spell

    :term
    vterm
    eshell
    )

;;; init.el -*- lexical-binding: t; -*-

(doom!
    :completion
    (ivy +icons +fuzzy)
    (company +childframe)

    :ui
    doom
    doom-dashboard
    (modeline +light)
    ophints
    hl-todo
    nav-flash
    (popup +all +defaults)
    vc-gutter
    vi-tilde-fringe
    window-select
    hydra
    zen

    :editor
    (evil +everywhere +commands)
    multiple-cursors
    fold
    format

    :emacs
    (dired +icons)
    vc
    undo

    :tools
    eval
    make
    (magit +forge)
    lsp
    editorconfig
    pdf
    direnv
    lookup

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export
        +roam2
        +gnuplot)
    (cc +lsp)
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp +pyright)
    (javascript +lsp)
    rest
    data ;; csv + XML
    (rust +lsp)
    coq
    (go +lsp)
    nix
    yaml

    :checkers
    grammar
    spell

    :term
    vterm
    eshell
    )

Add lookup module back in

[emacs] Add lookup module back in


;;; init-projectile.el --- Use Projectile for navigation within projects -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(when (maybe-require-package 'projectile)
  (add-hook 'after-init-hook 'projectile-mode)

  ;; Shorter modeline
  (setq-default projectile-mode-line-prefix " Proj")

  (with-eval-after-load 'projectile
    (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))

  (maybe-require-package 'ibuffer-projectile))

(provide 'init-projectile)
;;; init-projectile.el ends here

;;; init-projectile.el --- Use Projectile for navigation within projects -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(when (maybe-require-package 'projectile)
  (add-hook 'after-init-hook 'projectile-mode)

  ;; Shorter modeline
  (setq-default projectile-mode-line-prefix " Proj")

  (when (executable-find "rg")
    (setq-default projectile-generic-command "rg --files --hidden"))

  (with-eval-after-load 'projectile
    (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))

  (maybe-require-package 'ibuffer-projectile))

(provide 'init-projectile)
;;; init-projectile.el ends here

Use rg (if available) to list files in generic projectile roots


(defun ruby-eval-buffer () (interactive)
   "Evaluate the buffer with ruby."
   (shell-command-on-region (point-min) (point-max) "ruby -w "))

(defun my-ruby-mode-hook ()
  (require 'rinari)
  (setq rinari-tags-file-name "TAGS")
  (eval-after-load 'company-mode '(add-to-list 'company-backends 'company-robe))
  (global-rinari-mode t))

(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)
(add-hook 'ruby-mode-hook 'superword-mode)
(add-hook 'ruby-mode-hook 'projectile-rails-on)

;; inf-ruby
(add-hook 'after-init-hook 'inf-ruby-switch-setup)

;; Robe
(add-hook 'ruby-mode-hook 'robe-mode)

(eval-after-load 'company
  '(add-to-list 'company-backends 'company-robe))

(defadvice inf-ruby-console-auto (before activate-rvm-for-robe activate)
  (rvm-activate-corresponding-ruby))

;; RVM
(add-hook 'after-init-hook 'rvm-use-default)

(eval-after-load 'rspec-mode
  '(rspec-install-snippets))

(defun rinari-rake-migrate-up ()
  (interactive)
  (rinari-rake "db:migrate"))

(provide 'clgc-ruby)

(defun ruby-eval-buffer () (interactive)
   "Evaluate the buffer with ruby."
   (shell-command-on-region (point-min) (point-max) "ruby -w "))

(defun my-ruby-mode-hook ()
  (require 'rinari)
  (setq rinari-tags-file-name "TAGS")
  (eval-after-load 'company-mode '(add-to-list 'company-backends 'company-robe))
  (global-rinari-mode t))

(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)
(add-hook 'ruby-mode-hook 'superword-mode)
(add-hook 'ruby-mode-hook 'projectile-rails-on)

;; inf-ruby
(add-hook 'after-init-hook 'inf-ruby-switch-setup)

;; Robe
(add-hook 'ruby-mode-hook 'robe-mode)

;; (eval-after-load 'company
;;   '(add-to-list 'company-backends 'company-robe))

(defadvice inf-ruby-console-auto (before activate-rvm-for-robe activate)
  (rvm-activate-corresponding-ruby))

;; RVM
(add-hook 'after-init-hook 'rvm-use-default)

(eval-after-load 'rspec-mode
  '(rspec-install-snippets))

(defun rinari-rake-migrate-up ()
  (interactive)
  (rinari-rake "db:migrate"))

(provide 'clgc-ruby)

Disable company-robe, it's too slow

Disable company-robe, it's too slow


;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((go-mode
  . ((go-test-args . "-tags libsqlite3 -timeout 90s")
     (eval
      . (set
	 (make-local-variable 'flycheck-go-build-tags)
	 '("libsqlite3"))))))

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((go-mode
  . ((go-test-args . "-tags libsqlite3 -timeout 120s")
     (eval
      . (set
	 (make-local-variable 'flycheck-go-build-tags)
	 '("libsqlite3"))))))

lxd: Increase timeout of go unit tests when ran from Emacs

Signed-off-by: Free Ekanayaka <04111f73b2d444cf053b50d877d79556bf34f55a@canonical.com>


;;;; IDO mode for everything (files and buffers)
;;;
;;; -------------- -------------------------------------------------------
;;; Key            Definition
;;; -------------- -------------------------------------------------------
;;; C-c C-r        Open recent file with IDO

(require 'ido)
(ido-mode 'both)

;; Ignored files and buffers

(setq ido-ignore-files '("\\`#"
                         "\\`.#"
                         "\\`\\.\\./"
                         "\\`\\./"
                         "\\`00"
                         "\\`.*\\.tsk"
                         "\\`ported\\..*"))

(setq ido-ignore-buffers '("\\` "
                           "\\*Buffer List\\*"
                           "\\*Help\\*"
                           "\\*Messages\\*"
                           "\\*Completions\\*"))

(setq ido-enable-flex-matching t)

;; Open recent files with IDO.
;; `abbreviate-file-name' abbreviates home dir to ~/ in the file list
;; Custom abbreviations can be added to `directory-abbrev-alist'.
(require 'recentf)

(recentf-mode 1)
(setq recentf-max-menu-items 25)

(defun ido-find-recentf ()
  "Use ido to select a recently opened file from the `recentf-list'"
  (interactive)
  (find-file
   (ido-completing-read "Recentf open: "
                        (mapcar 'abbreviate-file-name recentf-list)
                        nil t)))
(define-key global-map [(control x)(control r)] 'ido-find-recentf)

(provide 'init-ido)

;;;; IDO mode for everything (files and buffers)
;;;
;;; -------------- -------------------------------------------------------
;;; Key            Definition
;;; -------------- -------------------------------------------------------
;;; C-c C-r        Open recent file with IDO

(require 'ido)
(ido-mode 'both)

;; Ignored files and buffers

(setq ido-ignore-files '("\\`#"
                         "\\`.#"
                         "\\`\\.\\./"
                         "\\`\\./"
                         "\\`00"
                         "\\`.*\\.tsk"
                         "\\`ported\\..*"))

(setq ido-ignore-buffers '("\\` "
                           "\\*Buffer List\\*"
                           "\\*Help\\*"
                           "\\*Messages\\*"
                           "\\*Completions\\*"))

(setq ido-enable-flex-matching t)
(setq ido-use-filename-at-point 'guess)

;; Open recent files with IDO.
;; `abbreviate-file-name' abbreviates home dir to ~/ in the file list
;; Custom abbreviations can be added to `directory-abbrev-alist'.
(require 'recentf)

(recentf-mode 1)
(setq recentf-max-menu-items 25)

(defun ido-find-recentf ()
  "Use ido to select a recently opened file from the `recentf-list'"
  (interactive)
  (find-file
   (ido-completing-read "Recentf open: "
                        (mapcar 'abbreviate-file-name recentf-list)
                        nil t)))
(define-key global-map [(control x)(control r)] 'ido-find-recentf)

(provide 'init-ido)

Add ido guesss for find file at point

Add ido guesss for find file at point

C-x C-f will guess a file to open based on the text at point.


;;; ~/.doom.d/config.el -*- lexical-binding: t; -*-

(setq doom-font (font-spec :family "Source Code Pro" :size 20)
      doom-big-font (font-spec :family "Source Code Pro" :size 26)
      display-line-numbers-type nil
      org-log-done 'time
      evil-escape-excluded-states '(normal multiedit emacs motion)
      )

;;
;; Key bindings
(map! :leader
      (:prefix "c"
        :desc "Sort lines alphabetically" :v "s" #'sort-lines)
      (:prefix "w"
        "F" #'make-frame))

(after! projectile
   (projectile-register-project-type
      'bazel '("WORKSPACE")
      :compile "bazel build //..."
      :test "bazel test //..."))

(after! org
  (load "~/Sync/org/orgmode.el"))

(direnv-mode)

;;; ~/.doom.d/config.el -*- lexical-binding: t; -*-

(setq doom-font (font-spec :family "Source Code Pro" :size 20)
      doom-big-font (font-spec :family "Source Code Pro" :size 26)
      display-line-numbers-type nil
      org-log-done 'time
      evil-escape-excluded-states '(normal multiedit emacs motion)
      )

;;
;; Key bindings
(map! :leader
      (:prefix "c"
        :desc "Sort lines alphabetically" :v "s" #'sort-lines)
      (:prefix "w"
        "F" #'make-frame)
      (:prefix "/"
        ; Universal argument doesn't seem to work with the function wrapper
        :desc "Search project" "p" #'counsel-rg))

(after! projectile
   (projectile-register-project-type
      'bazel '("WORKSPACE")
      :compile "bazel build //..."
      :test "bazel test //..."))

(after! org
  (load "~/Sync/org/orgmode.el"))

(direnv-mode)

Support universal argument when searching project


;;; editor/lispy/config.el -*- lexical-binding: t; -*-

(use-package! lispy
  :hook ((common-lisp-mode . lispy-mode)
         (emacs-lisp-mode . lispy-mode)
         (scheme-mode . lispy-mode)
         (racket-mode . lispy-mode)
         (hy-mode . lispy-mode)
         (lfe-mode . lispy-mode)
         (clojure-mode . lispy-mode))
  :config
  (setq lispy-close-quotes-at-end-p t)
  (add-hook 'lispy-mode-hook #'turn-off-smartparens-mode))

(use-package! lispyville
  :when (featurep! :editor evil)
  :hook (lispy-mode . lispyville-mode)
  :config
  (lispyville-set-key-theme
   '((operators normal)
     c-w
     (prettify insert)
     (atom-movement normal visual)
     slurp/barf-lispy
     (wrap normal insert)
     additional
     additional-insert
     (additional-wrap normal insert)
     (escape insert))))

;;; editor/lispy/config.el -*- lexical-binding: t; -*-

(use-package! lispy
  :hook ((common-lisp-mode . lispy-mode)
         (emacs-lisp-mode . lispy-mode)
         (scheme-mode . lispy-mode)
         (racket-mode . lispy-mode)
         (hy-mode . lispy-mode)
         (lfe-mode . lispy-mode)
         (dune-mode . lispy-mode)
         (clojure-mode . lispy-mode))
  :config
  (setq lispy-close-quotes-at-end-p t)
  (add-hook 'lispy-mode-hook #'turn-off-smartparens-mode))

(use-package! lispyville
  :when (featurep! :editor evil)
  :hook (lispy-mode . lispyville-mode)
  :config
  (lispyville-set-key-theme
   '((operators normal)
     c-w
     (prettify insert)
     (atom-movement normal visual)
     slurp/barf-lispy
     (wrap normal insert)
     additional
     additional-insert
     (additional-wrap normal insert)
     (escape insert))))

Add dune-mode to lispy modes

Add dune-mode to lispy modes

Dune uses an sexpression based syntax as well

Signed-off-by: Rudi Grinberg <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@rgrinberg.com>


(let ((theme (car '(
                    solarized-dark
                    spacemacs-dark
                    leuven
                    solarized-light
                    ))))
  (when theme
    (load-theme theme t)
    (custom-theme-set-faces
     theme
     '(dired-header ((t (:foreground "#268bd2"
                                     :underline t
                                     :background nil)))))))

(add-hook 'focus-out-hook
          (lambda ()
            (when (and buffer-file-name (buffer-modified-p))
              (save-buffer))))

(let ((shell-path (shell-command-to-string "$SHELL -c 'echo -n $PATH'")))
  (setenv "PATH" shell-path)
  (setq exec-path (split-string shell-path path-separator)))

;; Center Emacs's position on screen
(let* ((height 40)
       (width 82)
       (top 0)
       (left (/ (- (display-pixel-width)
                   (frame-pixel-width))
                2)))
  (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
  (add-to-list 'default-frame-alist '(ns-appearance . dark))
  (add-to-list 'default-frame-alist (cons 'height height))
  (add-to-list 'default-frame-alist (cons 'width width))
  (add-to-list 'default-frame-alist (cons 'top top))
  (add-to-list 'default-frame-alist (cons 'left left)))

(set-frame-parameter nil 'alpha '(100 100))

(setq frame-title-format nil)

(let ((theme (car '(
                    solarized-dark
                    spacemacs-dark
                    leuven
                    solarized-light
                    ))))
  (when theme
    (load-theme theme t)
    (custom-theme-set-faces
     theme
     '(dired-header ((t (:foreground "#268bd2"
                                     :underline t
                                     :background nil)))))))

(add-hook 'focus-out-hook
          (lambda ()
            (when (and buffer-file-name (buffer-modified-p))
              (save-buffer))))

(let ((shell-path (shell-command-to-string "$SHELL -l -c 'echo -n $PATH'")))
  (setenv "PATH" shell-path)
  (setq exec-path (split-string shell-path path-separator)))

;; Center Emacs's position on screen
(let* ((height 40)
       (width 82)
       (top 0)
       (left (/ (- (display-pixel-width)
                   (frame-pixel-width))
                2)))
  (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
  (add-to-list 'default-frame-alist '(ns-appearance . dark))
  (add-to-list 'default-frame-alist (cons 'height height))
  (add-to-list 'default-frame-alist (cons 'width width))
  (add-to-list 'default-frame-alist (cons 'top top))
  (add-to-list 'default-frame-alist (cons 'left left)))

(set-frame-parameter nil 'alpha '(100 100))

(setq frame-title-format nil)

Use login shell to get the path

Use login shell to get the path

The `-l' option will probably only work with Bash but that should be
fine as most places have standardized on it.


(require 'use-package)
(require 'sql)

(use-package sqlup-mode
  :ensure t
  :diminish sqlup-mode
  :config
  (add-to-list 'sqlup-blacklist "user")
  (add-to-list 'sqlup-blacklist "name")
  (add-to-list 'sqlup-blacklist "group")
  (add-to-list 'sqlup-blacklist "data")
  (add-to-list 'sqlup-blacklist "version")
  (add-to-list 'sqlup-blacklist "type")
  (add-hook 'sql-mode-hook #'sqlup-mode t))

(add-hook 'sql-mode-hook #'flycheck-mode)

(defun ds/set-product-postgres ()
  (sql-set-product "postgres"))
(add-hook 'sql-mode-hook #'ds/set-product-postgres)

(use-package sql-indent
  :ensure t
  :config
  (add-hook 'sql-mode-hook #'sql-indent-minor-mode)
  (setq-default sqlind-indentation-offsets-alist
                `((select-clause +)
                  (insert-clause +)
                  (delete-clause +)
                  (update-clause +)
                  (statement-continuation +)
                  ,@sqlind-default-indentation-offsets-alist))
  (setq-default sqlind-basic-offset 4)
  )

(require 'use-package)
(require 'sql)

(use-package sqlup-mode
  :ensure t
  :diminish sqlup-mode
  :config
  (add-to-list 'sqlup-blacklist "user")
  (add-to-list 'sqlup-blacklist "name")
  (add-to-list 'sqlup-blacklist "group")
  (add-to-list 'sqlup-blacklist "data")
  (add-to-list 'sqlup-blacklist "version")
  (add-to-list 'sqlup-blacklist "type")
  (add-hook 'sql-mode-hook #'sqlup-mode t))

(add-hook 'sql-mode-hook #'flycheck-mode)

(defun ds/set-product-postgres ()
  (sql-set-product "postgres"))
(add-hook 'sql-mode-hook #'ds/set-product-postgres)

(use-package sql-indent
  :ensure t
  :config
  (add-hook 'sql-mode-hook #'sqlind-minor-mode)
  (setq-default sqlind-indentation-offsets-alist
                `((select-clause +)
                  (insert-clause +)
                  (delete-clause +)
                  (update-clause +)
                  (statement-continuation +)
                  ,@sqlind-default-indentation-offsets-alist))
  (setq-default sqlind-basic-offset 4)
  )

Use the better emacs sql indentation mode


;; Time-stamp: <2015-06-24 08:58:33 kmodi>

;; server setup

;; Start emacs server
;; Now all new opened files will open in the same emacs instance if
;; opened using `emacsclient FILENAME&`

;; create the server directory if it doesn't exist
(use-package server
  :init
  (progn
    (setq server-auth-dir (concat user-emacs-directory "server_"
                                  emacs-version-short "/"))

    (unless (file-exists-p server-auth-dir)
      (make-directory server-auth-dir)))
  :config
  (progn
    ;; Suppress error "directory  ~/.emacs.d/server is unsafe" when
    ;; running on cygwin
    (>=e "23.0"
        (when (equal window-system 'x)
          (setq server-use-tcp t)
          (defun server-ensure-safe-dir (dir) "Noop" t)))

    ;; start a server only if one is not already running
    ;; `server-running-p' returns "t" if a server is already running
    (defvar modi/server-temp nil
      "If t, start a “temp” server if a server is already running;
otherwise do nothing.")

    (if (not (server-running-p))
        (progn
          (server-start))
      (progn
        (when modi/server-temp
          (setq server-name "temp")
          (server-start))))))

(provide 'setup-server)

;; Time-stamp: <2015-11-05 12:12:04 kmodi>

;; server/daemon setup

(use-package server
  :init
  (progn
    (setq server-auth-dir (let ((dir (concat user-emacs-directory
                                             "server_" emacs-version-short
                                             "/"))) ; must end with /
                            (make-directory dir :parents)
                            dir)))
  :config
  (progn
    ;; (setq server-use-tcp t)
    (when (equal window-system 'w32)
      ;; Suppress error "directory  ~/.emacs.d/server is unsafe". It is needed
      ;; needed for the server to start on Windows.
      ;;   On Windows, also set the EMACS_SERVER_FILE environment variable to
      ;; point to the `server' file. For example, for emacs 25.0, that location
      ;; would be "PATH\TO\.emacs.d\server_25_0\server".
      (defun server-ensure-safe-dir (dir) "Noop" t))

    ;; Start a server only if one is not already running
    ;; `server-running-p' returns "t" if a server is already running
    (defvar modi/server-temp nil
      "If t, start a “temp” server if a server is already running;
otherwise do nothing.")

    (if (not (server-running-p))
        (progn
          (server-start))
      (progn
        (when modi/server-temp
          (setq server-name "temp")
          (server-start))))))

  (provide 'setup-server)

Update server setup; code cleanup

Update server setup; code cleanup


;;; init-projectile.el --- Use Projectile for navigation within projects -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(when (maybe-require-package 'projectile)
  (add-hook 'after-init-hook 'projectile-mode)

  ;; Shorter modeline
  (setq-default projectile-mode-line-prefix " Proj")

  (after-load 'projectile
    (define-key projectile-mode-map (kbd "C-c C-p") 'projectile-command-map))

  (maybe-require-package 'ibuffer-projectile))

(provide 'init-projectile)
;;; init-projectile.el ends here

;;; init-projectile.el --- Use Projectile for navigation within projects -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(when (maybe-require-package 'projectile)
  (add-hook 'after-init-hook 'projectile-mode)

  ;; Shorter modeline
  (setq-default projectile-mode-line-prefix " Proj")

  (after-load 'projectile
    (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))

  (maybe-require-package 'ibuffer-projectile))

(provide 'init-projectile)
;;; init-projectile.el ends here

Use recommended C-c p for projectile rather than C-c C-p

Fixes #684


(require-package 'popwin)

(require 'popwin)
(popwin-mode 1)

(setq popwin:popup-window-height 40)

(push '("^\*helm.+\*$" :regexp t) popwin:special-display-config)

;; disable popwin-mode in an active Helm session It should be disabled
;; otherwise it will conflict with other window opened by Helm persistent
;; action, such as *Help* window.
(add-hook 'helm-after-initialize-hook (lambda ()
                                          (popwin:display-buffer helm-buffer t)
                                          (popwin-mode -1)))

 ;;  Restore popwin-mode after a Helm session finishes.
 (add-hook 'helm-cleanup-hook (lambda () (popwin-mode 1)))

(provide 'init-popwin)

(require-package 'popwin)

(require 'popwin)
(popwin-mode 1)

(setq popwin:popup-window-height 0.4)

(push '("^\*helm.+\*$" :regexp t) popwin:special-display-config)

;; disable popwin-mode in an active Helm session It should be disabled
;; otherwise it will conflict with other window opened by Helm persistent
;; action, such as *Help* window.
(add-hook 'helm-after-initialize-hook (lambda ()
                                          (popwin:display-buffer helm-buffer t)
                                          (popwin-mode -1)))

 ;;  Restore popwin-mode after a Helm session finishes.
 (add-hook 'helm-cleanup-hook (lambda () (popwin-mode 1)))

(provide 'init-popwin)

Make popwin high relative, not absolute

Make popwin high relative, not absolute


;; Interactively Do Things

(require 'ido)
(ido-mode t)
(setq ido-enable-prefix nil
      ido-enable-flex-matching t
      ido-create-new-buffer 'always
      ido-use-filename-at-point nil
      ido-max-prospects 10)

;; Use C-w to go back up a dir to better match normal usage of C-w
;; - insert current file name with C-x C-w instead.
(define-key ido-file-completion-map (kbd "C-w") 'ido-delete-backward-updir)
(define-key ido-file-completion-map (kbd "C-x C-w") 'ido-copy-current-file-name)

;; Always rescan buffer for imenu
(set-default 'imenu-auto-rescan t)

(add-to-list 'ido-ignore-directories "target")
(add-to-list 'ido-ignore-directories "node_modules")

;; Use ido everywhere
(require 'ido-ubiquitous)
(ido-ubiquitous-mode 1)

(provide 'setup-ido)

;; Interactively Do Things

(require 'ido)
(ido-mode t)
(setq ido-enable-prefix nil
      ido-enable-flex-matching t
      ido-create-new-buffer 'always
      ido-use-filename-at-point nil
      ido-max-prospects 10)

(add-hook
 'ido-setup-hook
 #'(lambda ()

     ;; Use C-w to go back up a dir to better match normal usage of C-w
     ;; - insert current file name with C-x C-w instead.
     (define-key ido-file-completion-map (kbd "C-w") 'ido-delete-backward-updir)
     (define-key ido-file-completion-map (kbd "C-x C-w") 'ido-copy-current-file-name)))

;; Always rescan buffer for imenu
(set-default 'imenu-auto-rescan t)

(add-to-list 'ido-ignore-directories "target")
(add-to-list 'ido-ignore-directories "node_modules")

;; Use ido everywhere
(require 'ido-ubiquitous)
(ido-ubiquitous-mode 1)

(provide 'setup-ido)


(require 'js)

(defun ds/disable-electric-semicolon ()
  (interactive)
  (add-to-list 'electric-layout-rules (cons ?\; nil)))
(add-hook 'js-mode-hook #'ds/disable-electric-semicolon)

(add-hook 'js-mode-hook #'electric-operator-mode)

(require 'grep)
(add-to-list 'grep-find-ignored-files "*.min.js")
(add-to-list 'grep-find-ignored-files "*.min.js.map")

;; Don't really know what these are but they show up in the biosite repo
(add-to-list 'grep-find-ignored-files "*.bmml")

(add-hook 'js-mode-hook #'aggressive-indent-mode)

;; Show function as lambda. Append prettify-symbols-mode so that symbol for
;; function is added before the mode is enabled.
(defun ds/pretty-function ()
  (add-to-list 'prettify-symbols-alist '("function" . 955)))
(add-hook 'js-mode-hook #'ds/pretty-function)
(add-hook 'js-mode-hook #'prettify-symbols-mode t)

(font-lock-add-keywords
 'js-mode '(("\\<\\(expect\\)\\>" . font-lock-keyword-face)))

(font-lock-add-keywords
 'js-mode '(("\\<\\(then\\)\\>" . font-lock-keyword-face)))

Make `then` a js keyword

Make `then` a js keyword


;; rails reloaded plugin
(push "~/.emacs.d/site-lisp/rails-reloaded" load-path)
;; (require 'rails-autoload)

(require-package 'sml-mode)
(require 'sml-mode)

;;; http://www.emacswiki.org/emacs/ruby-debug
(require 'ruby-debug)
(provide 'init-ruby-debug)

(provide 'init-local)

;; rails reloaded plugin
(push "~/.emacs.d/site-lisp/rails-reloaded" load-path)
;; (require 'rails-autoload)

(require-package 'sml-mode)
(require 'sml-mode)

;;; http://www.emacswiki.org/emacs/ruby-debug
;; (require 'ruby-debug)
;; (provide 'init-ruby-debug)

(provide 'init-local)

Disable ruby-debug as not ready yet

Disable ruby-debug as not ready yet


(add-auto-mode 'haml-mode "\.haml$")
(add-auto-mode 'sass-mode "\.sass$")
(autoload 'haml-mode "haml-mode" "Mode for editing haml files" t)
(autoload 'sass-mode "sass-mode" "Mode for editing sass files" t)

(require 'flymake-haml)
(add-hook 'haml-mode-hook 'flymake-haml-load)
(add-hook 'sass-mode-hook 'flymake-sass-load)

(add-hook 'sass-mode-hook 'ac-css-keywords-setup)

(provide 'init-haml)

(add-auto-mode 'haml-mode "\.haml$")
(add-auto-mode 'sass-mode "\.sass$")
(autoload 'haml-mode "haml-mode" "Mode for editing haml files" t)
(autoload 'sass-mode "sass-mode" "Mode for editing sass files" t)

(require 'flymake-haml)
(add-hook 'haml-mode-hook 'flymake-haml-load)
(add-hook 'sass-mode-hook 'flymake-sass-load)

(provide 'init-haml)

Remove obsolete ac hook for css keywords


(require-package 'js3-mode)
(require-package 'tern)
(require-package 'company-tern)
(require-package 'web-beautify)

(add-to-list 'auto-mode-alist '("\\.js$" . js3-mode))
(add-hook 'js3-mode-hook (lambda ()
                           (tern-mode t)
                           (add-hook 'before-save-hook (lambda ()
                                                         (when (string-equal major-mode "js3-mode"))
                                                           (web-beautify-js)))
                           (add-to-list 'company-backends 'company-tern)

                           (setq-default js3-global-externs
                                         '("module" "require" "__dirname" "process" "console" "define"
                                           "JSON" "$" "_" "Backbone" "buster" "sinon" "moment" "_gaq"
                                           "Zenbox" "Mousetrap" "Comoyo"))
                           (setq-default js3-indent-tabs-mode t)
                           (setq-default js3-indent-level 4)
                           (setq-default js3-auto-indent-p t)         ; it's nice for commas to right themselves.
                           (setq-default js3-enter-indents-newline t) ; don't need to push tab before typing
                           (setq-default js3-indent-on-enter-key t)))

(provide 'init-javascript-mode)

(require-package 'js3-mode)
(require-package 'tern)
(require-package 'company-tern)
(require-package 'web-beautify)

(add-to-list 'auto-mode-alist '("\\.js$" . js3-mode))
(add-hook 'js3-mode-hook (lambda ()
                           (tern-mode t)
                           (add-hook 'before-save-hook 'web-beautify-js-buffer t t)
                           (add-to-list 'company-backends 'company-tern)

                           (setq-default js3-global-externs
                                         '("module" "require" "__dirname" "process" "console" "define"
                                           "JSON" "$" "_" "Backbone" "buster" "sinon" "moment" "_gaq"
                                           "Zenbox" "Mousetrap" "Comoyo"))
                           (setq-default js3-indent-tabs-mode t)
                           (setq-default js3-indent-level 4)
                           (setq-default js3-auto-indent-p t)         ; it's nice for commas to right themselves.
                           (setq-default js3-enter-indents-newline t) ; don't need to push tab before typing
                           (setq-default js3-indent-on-enter-key t)))

(provide 'init-javascript-mode)

Emacs: Fix running js-beautify only in current JS buffer.


;; Time-stamp: <2014-01-20 13:35:50 kmodi>

;; iy-go-to-char
;; https://github.com/doitian/iy-go-to-char
(require 'iy-go-to-char)

(setq setup-navigation-loaded t)
(provide 'setup-navigation)

;; Time-stamp: <2014-03-13 00:00:27 kmodi>

;; iy-go-to-char
;; https://github.com/doitian/iy-go-to-char
(require 'iy-go-to-char)

;; Make C-a toggle between beginning of line and indentation
;; https://github.com/lunaryorn/stante-pede/blob/master/init.el
(defun back-to-indentation-or-beginning-of-line (arg)
  "Move point back to indentation of beginning of line.
Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.
If ARG is not nil or 1, move forward ARG - 1 lines first.  If
point reaches the beginning or end of the buffer, stop there."
  (interactive "^p")
  (setq arg (or arg 1))

  ;; Move lines first
  (when (/= arg 1)
    (let ((line-move-visual nil))
      (forward-line (1- arg))))

  (let ((orig-point (point)))
    (back-to-indentation)
    (when (= orig-point (point))
      (move-beginning-of-line 1))))

(setq setup-navigation-loaded t)
(provide 'setup-navigation)


(defconst mfa-neotree-packages '(neotree))

(defun mfa-neotree/post-init-neotree ()
  ;; Bind neotree-find to a key.
  (spacemacs/set-leader-keys "fd" #'neotree-find)

  (with-eval-after-load 'neotree
    ;; Enlarge the NeoTree window.
    (setq neo-window-width 40)

    ;; Make neotree-projectile select the current file when opened.
    (defun neotree-find-project-root-descend-advice (orig-fun &rest args)
      (let ((cur-file (buffer-file-name)))
        (prog1
            (apply orig-fun args)
          (when (and (neo-global--window-exists-p) cur-file)
            (neotree-find cur-file)))))
    (advice-add 'neotree-find-project-root :around #'neotree-find-project-root-descend-advice)))

Remove neotree hook to select current file

Spacemacs does take care of this.


(when (maybe-require-package 'diff-hl)
  (add-hook 'prog-mode-hook 'diff-hl-mode)
  (add-hook 'vc-dir-mode-hook 'diff-hl-mode)
  (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)

  (after-load 'diff-hl
    (define-key diff-hl-mode-map
      (kbd "<left-fringe> <mouse-1>")
      'diff-hl-diff-goto-hunk)))

(maybe-require-package 'browse-at-remote)

(provide 'init-vc)

(when (maybe-require-package 'diff-hl)
  (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
  (add-hook 'after-init-hook 'global-diff-hl-mode)

  (after-load 'diff-hl
    (define-key diff-hl-mode-map
      (kbd "<left-fringe> <mouse-1>")
      'diff-hl-diff-goto-hunk)))

(maybe-require-package 'browse-at-remote)

(provide 'init-vc)

Enable diff-hl globally, not just in prog-mode


;;; completion.el -- Configuration for completion, abbreviations, and shortcuts.

;; I don't want to type "yes".
(defalias 'yes-or-no-p 'y-or-n-p)

;; ido mode for mini-buffer completion (see also modes/ido-conf.el)
(require 'ido)
(ido-mode t)

;; Hippie expand
(setq hippie-expand-try-functions-list
      '(try-expand-dabbrev
        try-expand-dabbrev-all-buffers
        try-expand-dabbrev-from-kill
        try-complete-lisp-symbol-partially
        try-complete-lisp-symbol
        try-complete-file-name-partially
        try-complete-file-name
        try-expand-whole-kill
        try-expand-line))

;;; completion.el -- Configuration for completion, abbreviations, and shortcuts.

;; I don't want to type "yes".
(defalias 'yes-or-no-p 'y-or-n-p)

;; ido mode for mini-buffer completion (see also modes/ido-conf.el)
(require 'ido)
(ido-mode t)

;; If the current line is already indented, have the tab key try to
;; auto-complete the word at point.
(setq tab-always-indent 'complete)

;; Replace completion-at-point with hippie expand
(defun pjones:hippie-expand () (hippie-expand nil))
(defalias 'completion-at-point 'pjones:hippie-expand)

;; Hippie expand functions
(setq hippie-expand-try-functions-list
      '(try-expand-dabbrev
        try-expand-dabbrev-all-buffers
        try-expand-dabbrev-from-kill
        try-complete-lisp-symbol-partially
        try-complete-lisp-symbol
        try-complete-file-name-partially
        try-complete-file-name
        try-expand-whole-kill
        try-expand-line))

Update the tab key to run hippie-expand

Update the tab key to run hippie-expand


(use-package ivy
  :ensure t
  :diminish ivy-mode
  :config
  (ivy-mode 1)
  (bind-key "C-c C-r" 'ivy-resume))

(use-package projectile
  :ensure t
  :config
  (projectile-mode +1)
  (setq projectile-remember-window-configs t)
  (setq projectile-git-command "git ls-files -z -c --recurse-submodules")
  (setq projectile-completion-system 'ivy)
  (projectile-mode +1)
  :bind
  ("C-c n p" . projectile-find-file))

(use-package counsel
  :ensure t
  :bind
  ("M-x" . counsel-M-x)
  ("C-c n i" . counsel-imenu)
  ("C-c n b" . counsel-ibuffer)
  ("C-c n g" . counsel-git-grep))

(provide 'lk/ivy)

(use-package ivy
  :ensure t
  :diminish ivy-mode
  :config
  (ivy-mode 1)
  (bind-key "C-c C-r" 'ivy-resume))

(use-package counsel
  :ensure t
  :bind
  ("M-x" . counsel-M-x)
  ("C-c n i" . counsel-imenu)
  ("C-c n b" . counsel-ibuffer)
  ("C-c n g" . counsel-git-grep))

(use-package projectile
  :after ivy
  :ensure t
  :init
  (setq projectile-completion-system 'ivy)
  :config
  (setq projectile-remember-window-configs t)
  (setq projectile-git-command "git ls-files -z -c --recurse-submodules")
  (projectile-mode +1))

(provide 'lk/ivy)

Fix projectile mode map and remove obsolete keyboard shortcut


(add-hook 'prog-mode-hook
  (function (lambda()
              (hs-minor-mode)
              (fic-mode 1))))

(add-hook 'python-mode-hook
  (function (lambda ()
          (setq evil-shift-width python-indent))))

(add-hook 'js-mode-hook
  (function (lambda ()
          (flycheck-select-checker 'javascript-standard)
          (setq js-indent-level 2)
          (setq evil-shift-width 2))))

(add-hook 'prog-mode-hook
  (function (lambda()
              (hs-minor-mode)
              (fic-mode 1))))

(add-hook 'python-mode-hook
  (function (lambda ()
              (setq evil-shift-width python-indent)
              (modify-syntax-entry ?_ "w"))))

(add-hook 'js-mode-hook
  (function (lambda ()
          (flycheck-select-checker 'javascript-standard)
          (setq js-indent-level 2)
          (setq evil-shift-width 2))))

Add "_" to a word in python modes

Add "_" to a word in python modes


;;; ui/treemacs/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defun +treemacs/toggle ()
  "Initialize or toggle treemacs.
* If the treemacs window is visible hide it.
* If a treemacs buffer exists, but is not visible show it.
* If no treemacs buffer exists for the current frame create and show it.
* If the workspace is empty additionally ask for the root path of the first
  project to add."
  (interactive)
  (require 'treemacs)
  (-pcase (treemacs--current-visibility)
    ['visible (delete-window (treemacs--is-visible?))]
    ['exists  (treemacs-select-window)]
    ['none
     (let ((project-root (doom-project-root 'nocache)))
       (when project-root
         (unless (treemacs--find-project-for-path project-root)
           (treemacs-add-project-at (treemacs--canonical-path project-root)
                                    (doom-project-name 'nocache))))
       (treemacs--init project-root))]))

;;; ui/treemacs/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defun +treemacs/toggle ()
  "Initialize or toggle treemacs.
* If the treemacs window is visible hide it.
* If a treemacs buffer exists, but is not visible show it.
* If no treemacs buffer exists for the current frame create and show it.
* If the workspace is empty additionally ask for the root path of the first
  project to add."
  (interactive)
  (require 'treemacs)
  (pcase (treemacs--current-visibility)
    (`visible (delete-window (treemacs--is-visible?)))
    (`exists  (treemacs-select-window))
    (`none
     (let ((project-root (doom-project-root 'nocache)))
       (when project-root
         (unless (treemacs--find-project-for-path project-root)
           (treemacs-add-project-at (treemacs--canonical-path project-root)
                                    (doom-project-name 'nocache))))
       (treemacs--init project-root)))))

Refactor out -pcase in +treemacs/toggle

Refactor out -pcase in +treemacs/toggle


;;; init-shell.el -- Setup shell inside Emacs

;;; Commentary:
;;; Eshell and term setup

;;; Code:
(require 'use-package)

(use-package eshell
  :config
  (add-hook 'eshell-mode-hook (lambda () (company-mode -1)))
  (add-hook 'eshell-mode-hook
            (lambda ()
              (substitute-key-definition
               'eshell-list-history 'helm-eshell-history eshell-mode-map)))
  (add-hook 'eshell-mode-hook
            (lambda ()
              (substitute-key-definition
               'eshell-pcomplete 'helm-esh-pcomplete eshell-mode-map)))
  :ensure nil)

(use-package shell
  :config
  (bind-keys :map shell-mode-map ("C-C C-l" . helm-comint-input-ring))
  :ensure nil)

(provide 'init-shell)
;;; init-shell.el ends here

;;; init-shell.el -- Setup shell inside Emacs

;;; Commentary:
;;; Eshell and term setup

;;; Code:
(require 'use-package)

(use-package eshell
  :config
  (add-hook 'eshell-mode-hook (lambda () (company-mode -1)))
  (add-hook 'eshell-mode-hook
            (lambda ()
              (substitute-key-definition
               'eshell-list-history 'helm-eshell-history eshell-mode-map)))
  (add-hook 'eshell-mode-hook
            (lambda ()
              (substitute-key-definition
               'eshell-pcomplete 'helm-esh-pcomplete eshell-mode-map)))
  :ensure nil)

(use-package shell
  :config
  (bind-keys :map shell-mode-map ("C-C C-l" . helm-comint-input-ring))
  :ensure nil)

(use-package eshell-fringe-status
  :commands (eshell-fringe-status-mode)
  :init
  (add-hook 'eshell-mode-hook 'eshell-fringe-status-mode))

(use-package eshell-did-you-mean
  :commands (eshell-did-you-mean-setup)
  :init
  (add-hook 'eshell-mode-hook 'eshell-did-you-mean-setup))

(use-package eshell-prompt-extras
  :init
  (with-eval-after-load "esh-opt"
    (autoload 'epe-theme-lambda "eshell-prompt-extras")
    (setq eshell-highlight-prompt nil
          eshell-prompt-function 'epe-theme-lambda)))

(provide 'init-shell)
;;; init-shell.el ends here

Add some tweaks to eshell

Add some tweaks to eshell


;;; bob.el --- Bob exercise (exercism)

;;; Commentary:

;;; Code:
(require 'subr-x)

(defun response-for (phrase)
  "Provides Bob's response to PHRASE."
  (let ((stripped-phrase (string-trim phrase)))
    (cond ((string-empty-p stripped-phrase) "Fine. Be that way!")
          ((shout-questionp stripped-phrase) "Calm down, I know what I'm doing!")
          ((shoutp stripped-phrase) "Whoa, chill out!")
          ((questionp stripped-phrase) "Sure.")
          (t "Whatever."))))

(defun shoutp (phrase)
  "Determines if PHRASE is shouted."
  (and (string-match "[A-Z]" phrase)
       (string= (upcase phrase) phrase)))

(defun questionp (phrase)
  "Determines if PHRASE is a question."
  (string-suffix-p "?" phrase))

(defun shout-questionp (phrase)
  "Determines if PHRASE is a shouted question."
  (and (shoutp phrase) (questionp phrase)))

(provide 'bob)
;;; bob.el ends here

Introduce some whitespace for readability


;; Time-stamp: <2015-01-30 08:47:09 kmodi>

;; Shell Script Mode

(use-package shell-script-mode
  :mode (("\\.alias\\'"   . shell-script-mode)
         ("\\.setup.*\\'" . shell-script-mode)
         ("\\.gpms\\'"    . shell-script-mode)
         ("\\.cfg\\'"     . shell-script-mode)
         ("\\.*csh.*\\'"  . shell-script-mode)
         ("crontab.*\\'"  . shell-script-mode)))

(defun my/tcsh-set-indent-functions ()
  (when (buffer-file-name) ; do this only if the buffer is a file
    (when (string-match ".*csh" (format "%s" sh-shell))
      (require 'csh-mode) ; https://github.com/Tux/tcsh/blob/master/csh-mode.el
      (setq-local indent-line-function   'csh-indent-line)
      (setq-local indent-region-function 'csh-indent-region))))
(add-hook 'sh-set-shell-hook #'my/tcsh-set-indent-functions)

(provide 'setup-shell)

;; Time-stamp: <2015-02-06 10:48:29 kmodi>

;; Shell Script Mode

(use-package shell-script-mode
  :mode (("\\.alias\\'"   . shell-script-mode)
         ("\\.setup.*\\'" . shell-script-mode)
         ("\\.gpms\\'"    . shell-script-mode)
         ("\\.cfg\\'"     . shell-script-mode)
         ("\\.*csh.*\\'"  . shell-script-mode)
         ("crontab.*\\'"  . shell-script-mode)))

(defun my/tcsh-set-indent-functions ()
  (when (buffer-file-name) ; do this only if the buffer is a file
    (when (string-match ".*csh" (format "%s" sh-shell))
      (require 'csh-mode) ; https://github.com/Tux/tcsh/blob/master/csh-mode.el
      (setq-local indent-line-function   'csh-indent-line)
      (setq-local indent-region-function 'csh-indent-region))))
(add-hook 'sh-set-shell-hook #'my/tcsh-set-indent-functions)

;; Also set the csh indent functions in conf mode (for files like .tmux.conf )
(add-hook 'conf-space-mode-hook #'my/tcsh-set-indent-functions)

(provide 'setup-shell)

Use the csh-mode indentation functions for conf-space-mode too


(defvar dependency-list
      '(linum-off ;; turn linum off in certain modes
        ido-vertical-mode ;; use vertical menus for ido
        ido-grid-mode ;; use a grid selection menu for ido
        smex ;; ido-enabled M-x
        anzu ;; nicer search environment
        volatile-highlights ;; highlight changed areas

        ;; THEMES
        solarized-theme
        )
      "A list of all packages required for operation.")

(provide 'dependencies)

(defvar dependency-list
      '(linum-off ;; turn linum off in certain modes
        ido-vertical-mode ;; use vertical menus for ido
        ido-grid-mode ;; use a grid selection menu for ido
        smex ;; ido-enabled M-x
        anzu ;; nicer search environment
        volatile-highlights ;; highlight changed areas

        ;; THEMES
        solarized-theme

        magit ;; make Git and Emacs both way cooler
        )
      "A list of all packages required for operation.")

(provide 'dependencies)

Add magit as a dependency

Add magit as a dependency


;; -*- no-byte-compile: t; -*-
;;; core/packages.el

;; core-os.el
(package! exec-path-from-shell :ignore (not IS-MAC))
(package! osx-clipboard        :ignore (not IS-MAC))

;; core-ui.el
(package! all-the-icons)
(package! hide-mode-line)
(package! highlight-indentation)
(package! highlight-numbers)
(unless (boundp 'display-line-numbers)
  (package! nlinum)
  (package! nlinum-hl)
  (package! nlinum-relative))
(package! rainbow-delimiters)
(package! visual-fill-column)

;; core-popups.el
(package! shackle)

;; core-editor.el
(package! ace-link)
(package! ace-window)
(package! avy)
(package! command-log-mode)
(package! expand-region)
(package! helpful)
(package! pcre2el)
(package! smartparens)
(package! undo-tree)

;; core-projects.el
(package! projectile)

;; core-keybinds.el
(package! which-key)
(package! hydra)

;; -*- no-byte-compile: t; -*-
;;; core/packages.el

;; core-os.el
(package! exec-path-from-shell :ignore (not IS-MAC))
(package! osx-clipboard        :ignore (not IS-MAC))

;; core-ui.el
(package! all-the-icons)
(package! hide-mode-line)
(package! highlight-indentation)
(package! highlight-numbers)
(unless (boundp 'display-line-numbers)
  (package! nlinum)
  (package! nlinum-hl)
  (package! nlinum-relative))
(package! rainbow-delimiters)
(package! visual-fill-column)

;; core-editor.el
(package! ace-link)
(package! ace-window)
(package! avy)
(package! command-log-mode)
(package! expand-region)
(package! helpful)
(package! pcre2el)
(package! smartparens)
(package! undo-tree)

;; core-projects.el
(package! projectile)

;; core-keybinds.el
(package! which-key)
(package! hydra)

Remove shackle (why is this still here?!)


(require 'magit)

(setq magit-save-repository-buffers 'dontask)
(setq magit-diff-refine-hunk nil)

(set-face-attribute 'magit-diff-added-highlight nil :foreground "#22aa22")

(add-hook 'magit-log-edit-mode-hook 'turn-on-auto-fill)

(add-hook 'magit-mode-hook
          (lambda ()
            (define-key magit-mode-map (kbd "1") 'magit-section-show-level-1-all)
            (define-key magit-mode-map (kbd "2") 'magit-section-show-level-2-all)
            (define-key magit-mode-map (kbd "3") 'magit-section-show-level-3-all)
            (define-key magit-mode-map (kbd "4") 'magit-section-show-level-4-all)))

Use digits to invoke the -all functions.


(setq package-selected-packages
      '(ace-jump-mode
        auto-complete
        auto-indent-mode
        cider
        coffee-mode
        diminish
        dired-details
        dropdown-list
        edit-server
        edit-server-htmlize
        edts
        emmet-mode
        erlang
        exec-path-from-shell
        fill-column-indicator
        flx-ido
        flymake
        flymake-haskell-multi
        flymake-hlint
        gitconfig-mode
        gitignore-mode
        god-mode
        haml-mode
        haskell-mode
        httpcode
        ido-vertical-mode
        jedi
        js2-mode
        js2-refactor
        json-mode
        ledger-mode
        less-css-mode
        lorem-ipsum
        magit
        markdown-mode
        marmalade
        org-present
        paredit
        projectile
        rainbow-delimiters
        rainbow-mode
        restclient
        smex
        solarized-theme
        undo-tree
        web-beautify
        web-mode
        yaml-mode
        yasnippet))

(setq package-selected-packages
      '(ace-jump-mode
        auto-complete
        auto-indent-mode
        cider
        coffee-mode
        diminish
        dired-details
        dropdown-list
        edit-server
        edit-server-htmlize
        edts
        emmet-mode
        erlang
        exec-path-from-shell
        fill-column-indicator
        flx-ido
        gitconfig-mode
        gitignore-mode
        god-mode
        haml-mode
        haskell-mode
        httpcode
        ido-vertical-mode
        jedi
        js2-mode
        js2-refactor
        json-mode
        ledger-mode
        less-css-mode
        lorem-ipsum
        magit
        markdown-mode
        marmalade
        org-present
        paredit
        projectile
        rainbow-delimiters
        rainbow-mode
        restclient
        smex
        solarized-theme
        undo-tree
        web-beautify
        web-mode
        yaml-mode
        yasnippet))

Remove flymake, long live flycheck

Remove flymake, long live flycheck


(require 'dired+)
(setq dired-recursive-deletes 'top)
(define-key dired-mode-map [mouse-2] 'dired-find-file)

(provide 'init-dired)

(eval-after-load 'dired
  '(progn
     (require 'dired+)
     (setq dired-recursive-deletes 'top)
     (define-key dired-mode-map [mouse-2] 'dired-find-file)))

(provide 'init-dired)

Load dired+ only after dired is loaded

Load dired+ only after dired is loaded


(use-package pyenv-mode
  :init
  :ensure t
  :config (pyenv-mode)

  (setenv "WORKON_HOME" "~/.pyenv/versions/")
  (add-to-list 'exec-path "~/.pyenv/shims")
  (add-hook 'projectile-switch-project-hook 'projectile-pyenv-mode-set)
  (add-hook 'python-mode-hook 'pyenv-mode))

(use-package pyenv-mode-auto
  :ensure t)

(use-package elpy
  :ensure t
  :defer t
  :config
  (setq elpy-modules (delete 'elpy-module-highlight-indentation elpy-modules))
  :init
  (advice-add 'python-mode :before 'elpy-enable)
  (add-hook 'python-mode-hook
    (lambda ()
      (add-hook 'before-save-hook 'elpy-black-fix-code))))

(use-package pyenv-mode
  :init
  :ensure t
  :config (pyenv-mode)

  (setenv "WORKON_HOME" "~/.pyenv/versions/")
  (add-to-list 'exec-path "~/.pyenv/shims")
  (add-hook 'projectile-switch-project-hook 'projectile-pyenv-mode-set)
  (add-hook 'python-mode-hook 'pyenv-mode))

(use-package pyenv-mode-auto
  :ensure t)

(use-package elpy
  :ensure t
  :defer t
  :config
  (setq elpy-modules (delete 'elpy-module-highlight-indentation elpy-modules))
  :init
  (advice-add 'python-mode :before 'elpy-enable)
  (add-hook 'elpy-mode-hook
    (lambda ()
      (add-hook 'before-save-hook 'elpy-black-fix-code nil 'local)))) ;

Emacs: Add before-save-hook when on Python-mode


(require 'package)

;; add-to-list add to list's front unless by t

;; reset
;;(setq package-archives nil)

;; default GNU ELPA
;; (add-to-list 'package-archives
;; 	     '("gnu" . "http://elpa.gnu.org/packages/"))

(add-to-list 'package-archives
			 '("org" . "http://orgmode.org/elpa/"))

;; Milkypostman's Emacs Lisp Pakcage Archive (MELPA)
(add-to-list 'package-archives
			 '("melpa" . "http://melpa.milkbox.net/packages/"))

(add-to-list 'package-archives
			 '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t)

;; (add-to-list 'package-archives
;;              '("marmalade" . "https://marmalade-repo.org/packages/"))

(when (boundp 'package-pinned-packages)
  (setq package-pinned-packages
		'((cider . "melpa-stable"))))

(package-initialize)

(require 'package)

;; add-to-list add to list's front unless by t

;; reset
;;(setq package-archives nil)

;; default GNU ELPA
;; (add-to-list 'package-archives
;; 	     '("gnu" . "http://elpa.gnu.org/packages/"))

(add-to-list 'package-archives
			 '("org" . "http://orgmode.org/elpa/"))

;; Milkypostman's Emacs Lisp Pakcage Archive (MELPA)
(add-to-list 'package-archives
			 '("melpa" . "http://melpa.milkbox.net/packages/"))

(add-to-list 'package-archives
			 '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t)

;; (add-to-list 'package-archives
;;              '("marmalade" . "https://marmalade-repo.org/packages/"))

;; (when (boundp 'package-pinned-packages)
;;   (setq package-pinned-packages
;; 		'((cider . "melpa-stable"))))

(package-initialize)

Undo pinning cider to melpa-stable.

Undo pinning cider to melpa-stable.


;; Gosin's Emacs Configuration 2021/01/09
;; add ELPA and MELPA package repos
(setq package-archives
      '(("gnu" . "http://elpa.gnu.org/packages/")
	("melpa" . "http://melpa.org/packages/")))

;; user solarized dark color theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/solarized_theme")
(set-terminal-parameter nil 'background-mode 'dark)
(set-frame-parameter nil 'background-mode 'dark)
(load-theme 'solarized t)

;; define three useful commands(from org guide)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)

(custom-set-variables
 ;; score apropos results by relavance.
 '(apropos-sort-by-scores t)
 ;; show line numbers
 '(global-display-line-numbers-mode t))

;; store backup and autosave files to temporary directories
(setq backup-director-alist
      '((".*" . ,temporary-file-directory)))

;; Gosin's Emacs Configuration 2021/01/09
;; add ELPA and MELPA package repos
(setq package-archives
      '(("gnu" . "http://elpa.gnu.org/packages/")
	("melpa" . "http://melpa.org/packages/")))

;; user solarized dark color theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/solarized_theme")
(set-terminal-parameter nil 'background-mode 'dark)
(set-frame-parameter nil 'background-mode 'dark)
(load-theme 'solarized t)

;; define three useful commands(from org guide)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)

(custom-set-variables
 ;; score apropos results by relavance.
 '(apropos-sort-by-scores t)
 ;; show line numbers
 '(global-display-line-numbers-mode t))

;; store backup and autosave files to temporary directories
(setq backup-directory-alist
      '((".*" . ,temporary-file-directory)))

Fix typo when setting backup directories


(setq extra-langs-packages
  '(
    arduino-mode
    julia-mode
    matlab-mode
    qml-mode
    scad-mode
    stan-mode
    thrift
    wolfram-mode
    ))

(defun extra-langs/init-arduino-mode ()
  (use-package arduino-mode :defer t))

(defun extra-langs/init-scad-mode ()
  (use-package scad-mode :defer t))

(defun extra-langs/init-qml-mode ()
  (use-package qml-mode :defer t :mode "\\.qml\\'"))

(defun extra-langs/init-julia-mode ()
  (use-package julia-mode :defer t))

(defun extra-langs/init-matlab-mode ()
  (use-package matlab-mode
    :defer t
    :init
    ;; Explicitly run prog-mode hooks since matlab-mode does not derive from
    ;; prog-mode major-mode
    (add-hook 'matlab-mode-hook 'spacemacs/run-prog-mode-hooks)))

(defun extra-langs/init-stan-mode ()
  (use-package stan-mode :defer t))

(defun extra-langs/init-thrift ()
  (use-package thrift :defer t))

;; no associated extension because conflicts with more common Objective-C, manually invoke for .m files.
(defun extra-langs/init-wolfram-mode ()
  (use-package wolfram-mode
    :defer t
    :interpreter "\\(Wolfram\\|Mathematica\\)Script\\( -script\\)?"))

(setq extra-langs-packages
  '(
    arduino-mode
    julia-mode
    matlab-mode
    qml-mode
    scad-mode
    stan-mode
    thrift
    wolfram-mode
    ))

(defun extra-langs/init-arduino-mode ()
  (use-package arduino-mode :defer t))

(defun extra-langs/init-scad-mode ()
  (use-package scad-mode :defer t))

(defun extra-langs/init-qml-mode ()
  (use-package qml-mode :defer t :mode "\\.qml\\'"))

(defun extra-langs/init-julia-mode ()
  (use-package julia-mode :defer t))

(defun extra-langs/init-matlab-mode ()
  (use-package matlab-mode
    :defer t
    :init
    ;; Explicitly run prog-mode hooks since matlab-mode does not derive from
    ;; prog-mode major-mode
    (add-hook 'matlab-mode-hook 'spacemacs/run-prog-mode-hooks)))

(defun extra-langs/init-stan-mode ()
  (use-package stan-mode :defer t))

(defun extra-langs/init-thrift ()
  (use-package thrift :defer t))

;; .m files are not associated because conflict with more common Objective-C and MATLAB/Octave, manually invoke for .m files.
(defun extra-langs/init-wolfram-mode ()
  (use-package wolfram-mode
    :defer t
    :interpreter "\\(Wolfram\\|Mathematica\\)Script\\( -script\\)?"
    :mode "\\.wl\\'"))

Add extension ".wl" for wolfram-mode

Add extension ".wl" for wolfram-mode


(when (maybe-require-package 'elm-mode)
  (setq-default elm-format-on-save t)
  (after-load 'elm-mode
    (diminish 'elm-indent-mode)
    (add-hook 'elm-mode-hook
              (lambda () (sanityinc/local-push-company-backend 'company-elm)))
    (when (executable-find "elm-format")
      (setq-default elm-format-on-save t)))
  (maybe-require-package 'elm-test)
  (when (maybe-require-package 'flycheck-elm)
    (after-load 'elm-mode
      (flycheck-elm-setup))))

(provide 'init-elm)

(when (maybe-require-package 'elm-mode)
  (setq-default elm-format-on-save t)
  (after-load 'elm-mode
    (diminish 'elm-indent-mode)
    (add-hook 'elm-mode-hook
              (lambda () (sanityinc/local-push-company-backend 'company-elm)))
    (when (executable-find "elm-format")
      (setq-default elm-format-on-save t)))
  (maybe-require-package 'elm-test-runner)
  (when (maybe-require-package 'flycheck-elm)
    (after-load 'elm-mode
      (flycheck-elm-setup))))

(provide 'init-elm)

Use elm-test-runner instead of elm-test

Use elm-test-runner instead of elm-test


;;; lang/lean/config.el -*- lexical-binding: t; -*-

(after! lean-mode
  (set-lookup-handlers! 'lean-mode
    :definition #'lean-find-definition)
  (sp-with-modes 'lean-mode
    (sp-local-pair "/-" "-/")
    (sp-local-pair "`" "`")
    (sp-local-pair "{" "}")
    (sp-local-pair "«" "»")
    (sp-local-pair "⟨" "⟩")
    (sp-local-pair "⟪" "⟫"))
  (map! :map lean-mode-map
        :localleader
        "g" #'lean-toggle-show-goal
        "n" #'lean-toggle-next-error
        (:prefix ("s" . "server")
          "r" #'lean-server-restart
          "s" #'lean-server-stop
          "v" #'lean-server-switch-version)
        (:prefix ("p" . "leanpkg")
          "t" #'lean-leanpkg-test
          "b" #'lean-leanpkg-build
          "c" #'lean-leanpkg-configure)
        "f" #'lean-fill-placeholder
        "h" #'lean-hole
        "m" #'lean-message-boxes-toggle
        "e" #'lean-execute))

(use-package! company-lean
  :when (featurep! :completion company)
  :after lean-mode
  :config (set-company-backend! 'lean-mode 'company-lean))

;;; lang/lean/config.el -*- lexical-binding: t; -*-

(after! lean-mode
  (set-lookup-handlers! 'lean-mode
    :definition #'lean-find-definition)
  (sp-with-modes 'lean-mode
    (sp-local-pair "/-" "-/")
    (sp-local-pair "`" "`")
    (sp-local-pair "{" "}")
    (sp-local-pair "«" "»")
    (sp-local-pair "⟨" "⟩")
    (sp-local-pair "⟪" "⟫"))
  (map! :map lean-mode-map
        :localleader
        "g" #'lean-toggle-show-goal
        "n" #'lean-toggle-next-error
        (:prefix ("s" . "server")
          "r" #'lean-server-restart
          "s" #'lean-server-stop
          "v" #'lean-server-switch-version)
        (:prefix ("p" . "leanpkg")
          "t" #'lean-leanpkg-test
          "b" #'lean-leanpkg-build
          "c" #'lean-leanpkg-configure)
        "f" #'lean-fill-placeholder
        "h" #'lean-hole
        "m" #'lean-message-boxes-toggle
        "e" #'lean-execute))

(use-package! company-lean
  :init
  (advice-add #'company-lean-hook :override #'ignore)
  (set-company-backend! 'lean-mode 'company-lean)
  :when (featurep! :completion company)
  :after lean-mode)

Disable auto initializatinon of company in lean mode

Signed-off-by: Rudi Grinberg <4c46c202a3b8207ad5740134b125aae40c6c67a8@gmail.com>


;; -*- no-byte-compile: t; -*-
;;; tools/vterm/packages.el

(package! vterm :recipe (:fetcher github :repo "akermu/emacs-libvterm"))

;; -*- no-byte-compile: t; -*-
;;; tools/vterm/packages.el

(package! vterm :recipe
  (:fetcher github
   :repo "akermu/emacs-libvterm"
   :files ("*")))

Include all files with vterm package

Include all files with vterm package

They are needed to compile vterm-module.so


(autoload 'gtags-mode "gtags" "" t)

(defun gtags-create-or-update ()
  "Create or update the gnu global tag file."
  (interactive)
  (if (not (= 0 (call-process "global" nil nil nil " -p")))
      (let ((olddir default-directory)
            (topdir (read-directory-name
                     "gtags: top of source tree:" default-directory)))
        (cd topdir)
        (shell-command "GTAGSLABEL=rtags gtags && echo 'Created tagfile'")
        (cd olddir))
    (shell-command "GTAGSLABEL=rtags global -u && echo 'Updated tagfile'")))

(add-hook 'gtags-mode-hook
          (lambda()
            (local-set-key (kbd "M-.") 'gtags-find-tag)
            (local-set-key (kbd "M-,") 'gtags-find-with-grep)
            (local-set-key (kbd "M-:") 'gtags-find-symbol)
            (local-set-key (kbd "M-_") 'gtags-find-rtag)))

(provide 'gtags-tweaks)

(autoload 'gtags-mode "gtags" "" t)

(defun gtags-create-or-update ()
  "Create or update the gnu global tag file."
  (interactive)
  (if (not (= 0 (call-process "global" nil nil nil " -p")))
      (let ((olddir default-directory)
            (topdir (read-directory-name
                     "gtags: top of source tree:" default-directory)))
        (cd topdir)
        (shell-command "env PATH=/home/christian/.rvm/gems/ree-1.8.7-2010.02/bin:$PATH GTAGSLABEL=rtags gtags && echo 'Created tagfile'")
        (cd olddir))
    (shell-command "env PATH=/home/christian/.rvm/gems/ree-1.8.7-2010.02/bin:$PATH GTAGSLABEL=rtags global -u && echo 'Updated tagfile'")))

(add-hook 'gtags-mode-hook
          (lambda()
            (local-set-key (kbd "M-.") 'gtags-find-tag)
            (local-set-key (kbd "M-,") 'gtags-find-with-grep)
            (local-set-key (kbd "M-:") 'gtags-find-symbol)
            (local-set-key (kbd "M-_") 'gtags-find-rtag)))

(provide 'gtags-tweaks)

Use specific Ruby (not very portable, needs fix)


(eval-after-load 'rinari
  `(let ((rinari-lib-dir (directory-of-library "rinari")))
     (unless (require 'jump nil t)
       (error "jump.el not found; please run 'git submodule update --init' in %s"
              rinari-lib-dir))

     ;; Prevent rinari from shadowing ruby-mode and inf-ruby with its bundled copies
     (setq load-path
           (remove (file-name-as-directory (expand-file-name "util/inf-ruby" rinari-lib-dir))
                   (remove (file-name-as-directory (expand-file-name "util" rinari-lib-dir))
                           load-path)))))

(dolist (hook '(nxml-mode-hook haml-mode-hook sass-mode-hook magit-mode-hook yaml-mode-hook))
  (add-hook hook 'rinari-launch))

(defun update-rails-ctags ()
  (interactive)
  (let ((default-directory (or (rinari-root) default-directory)))
    (shell-command (concat "ctags -a -e -f " rinari-tags-file-name " --tag-relative -R app lib vendor test"))))

(provide 'init-rails)

(global-rinari-mode)

(defun update-rails-ctags ()
  (interactive)
  (let ((default-directory (or (rinari-root) default-directory)))
    (shell-command (concat "ctags -a -e -f " rinari-tags-file-name " --tag-relative -R app lib vendor test"))))

(provide 'init-rails)

Use new global-rinari-mode in place of old hooks + rinari-launch scheme


;;; -*- lexical-binding: t -*-
;;; syntax-check.el --- Syntax checking settings.

;; Copyright (C) 2016  Sergey Timanin

;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at

;;     http://www.apache.org/licenses/LICENSE-2.0

;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

;;; Commentary:

;;; Code:

(use-package flycheck
  :init (global-flycheck-mode))

(provide 'syntax-check)

;;; syntax-check.el ends here

;;; -*- lexical-binding: t -*-
;;; syntax-check.el --- Syntax checking settings.

;; Copyright (C) 2016  Sergey Timanin

;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at

;;     http://www.apache.org/licenses/LICENSE-2.0

;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

;;; Commentary:

;;; Code:

(use-package flycheck
  :init (global-flycheck-mode))

;; Bind M-n and M-p to navigate to the next/previous errors.
(global-set-key (kbd "M-n") 'next-error)
(global-set-key (kbd "M-p") 'previous-error)

(provide 'syntax-check)

;;; syntax-check.el ends here

Add key bindingings for flycheck.

Add key bindingings for flycheck.


(defconst mfa-string-inflection-packages '(string-inflection))

(defun mfa-string-inflection/init-string-inflection ()
  (use-package string-inflection
    :defer t
    :init
    (progn
      (spacemacs/declare-prefix "xi" "string-inflection")
      (spacemacs/set-leader-keys "xic" #'string-inflection-camelcase)
      (spacemacs/set-leader-keys "xie" #'string-inflection-lisp)
      (spacemacs/set-leader-keys "xii" #'string-inflection-all-cycle)
      (spacemacs/set-leader-keys "xij" #'string-inflection-java-style-cycle)
      (spacemacs/set-leader-keys "xil" #'string-inflection-lower-camelcase)
      (spacemacs/set-leader-keys "xir" #'string-inflection-ruby-style-cycle)
      (spacemacs/set-leader-keys "xis" #'string-inflection-underscore)
      (spacemacs/set-leader-keys "xit" #'string-inflection-toggle)
      (spacemacs/set-leader-keys "xiu" #'string-inflection-upcase))))

(defconst mfa-string-inflection-packages '(string-inflection))

(defun mfa-string-inflection/init-string-inflection ()
  (use-package string-inflection
    :defer t
    :init
    (progn
      (spacemacs/declare-prefix "xi" "string-inflection")
      (spacemacs/set-leader-keys "xic" #'string-inflection-camelcase)
      (spacemacs/set-leader-keys "xie" #'string-inflection-lisp)
      (spacemacs/set-leader-keys "xii" #'string-inflection-all-cycle)
      (spacemacs/set-leader-keys "xij" #'string-inflection-java-style-cycle)
      (spacemacs/set-leader-keys "xik" #'string-inflection-kebab-case)
      (spacemacs/set-leader-keys "xil" #'string-inflection-lower-camelcase)
      (spacemacs/set-leader-keys "xir" #'string-inflection-ruby-style-cycle)
      (spacemacs/set-leader-keys "xis" #'string-inflection-underscore)
      (spacemacs/set-leader-keys "xit" #'string-inflection-toggle)
      (spacemacs/set-leader-keys "xiu" #'string-inflection-upcase))))

Add binding for new string-inflection method


(require-package 'csv-mode)
(require-package 'csv-nav)

(add-auto-mode 'csv-mode "\\.[Cc][Ss][Vv]\\'")
(autoload 'csv-nav-mode "csv-nav" "Major mode for navigating comma-separated value files." t)

(setq csv-separators '("," ";" "|" " "))

(provide 'init-csv)

(require-package 'csv-mode)
(require-package 'csv-nav)

(add-auto-mode 'csv-mode "\\.[Cc][Ss][Vv]\\'")

(setq csv-separators '("," ";" "|" " "))

(provide 'init-csv)

Remove redundant autoload for csv-nav-mode (fixed upstream)