;;; tools/pdf/config.el -*- lexical-binding: t; -*-

(def-package! pdf-tools
  :mode ("\\.pdf\\'" . pdf-view-mode)
  :config
  (unless noninteractive
    (pdf-tools-install))

  (map! :map pdf-view-mode-map
        "q" #'kill-this-buffer
        doom-leader-key nil)

  (setq-default pdf-view-display-size 'fit-page)
  ;; Turn off cua so copy works
  (add-hook! 'pdf-view-mode-hook (cua-mode 0))
  ;; Custom modeline that removes useless info and adds page numbers
  (when (featurep! :ui doom-modeline)
    (load! +modeline)
    (add-hook! pdf-tools-enabled (doom-set-modeline 'pdf-tools-modeline)))
  ;; Handle PDF-tools related popups better
  (set! :popup "^\\*Outline*" '((side . right) (size . 40)) '((select)))
  ;; TODO: Add additional important windows that should be handled differently
  ;; TODO: These two next rules don't work (they should), investigate
  ;; (set! :popup "\\*Contents\\*" '((side . right) (size . 40)) nil)
  ;; (set! :popup "* annots\\*$" '((side . left) (size . 40)) '((select)))
  )

;;; tools/pdf/config.el -*- lexical-binding: t; -*-

(def-package! pdf-tools
  :mode ("\\.pdf\\'" . pdf-view-mode)
  :config
  (unless noninteractive
    (pdf-tools-install))

  (map! :map pdf-view-mode-map
        "q" #'kill-this-buffer
        doom-leader-key nil)

  (setq-default pdf-view-display-size 'fit-page)
  ;; Turn off cua so copy works
  (add-hook! 'pdf-view-mode-hook (cua-mode 0))
  ;; Custom modeline that removes useless info and adds page numbers
  (when (featurep! :ui doom-modeline)
    (load! "+modeline")
    (add-hook! pdf-tools-enabled (doom-set-modeline 'pdf-tools-modeline)))
  ;; Handle PDF-tools related popups better
  (set! :popup "^\\*Outline*" '((side . right) (size . 40)) '((select)))
  ;; TODO: Add additional important windows that should be handled differently
  ;; TODO: These two next rules don't work (they should), investigate
  ;; (set! :popup "\\*Contents\\*" '((side . right) (size . 40)) nil)
  ;; (set! :popup "* annots\\*$" '((side . left) (size . 40)) '((select)))
  )

Fix void-variable +modeline error from outdated load! call


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

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

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

    :editor
    (evil +everywhere +commands)
    snippets
    file-templates
    multiple-cursors
    rotate-text
    fold
    format

    :emacs
    (dired +icons)
    vc

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

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export)
    (cc +lsp)
    ocaml
    idris
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp)
    (fsharp +lsp)
    (javascript +lsp)
    rest
    data
    (rust +lsp)

    :checkers
    grammar
    spell
    (syntax +childframe)

    :term
    vterm
    eshell

    :app
    ;;(email +gmail)    ; emacs as an email client
    ;;(rss +org)        ; emacs as an RSS reader
    )

;; Needs to be set early so it can't go into config
(setq evil-respect-visual-line-mode t)

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

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

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

    :editor
    (evil +everywhere +commands)
    snippets
    file-templates
    multiple-cursors
    rotate-text
    fold
    format

    :emacs
    (dired +icons)
    vc

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

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +ghcide)
    (org
        +attach
        +babel
        +export)
    (cc +lsp)
    ocaml
    idris
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp)
    (fsharp +lsp)
    (javascript +lsp)
    rest
    data
    (rust +lsp)

    :checkers
    grammar
    spell
    (syntax +childframe)

    :term
    vterm
    eshell

    :app
    ;;(email +gmail)    ; emacs as an email client
    ;;(rss +org)        ; emacs as an RSS reader
    )

;; Needs to be set early so it can't go into config
(setq evil-respect-visual-line-mode t)

Switch to ghcide for haskell

[emacs] Switch to ghcide for haskell


(require 'init-frame-hooks)

(defun fix-up-xterm-control-arrows ()
  (let ((map (if (boundp 'input-decode-map)
                 input-decode-map
               function-key-map)))
    (define-key map "\e[1;5A" [C-up])
    (define-key map "\e[1;5B" [C-down])
    (define-key map "\e[1;5C" [C-right])
    (define-key map "\e[1;5D" [C-left])
    (define-key map "\e[5A"   [C-up])
    (define-key map "\e[5B"   [C-down])
    (define-key map "\e[5C"   [C-right])
    (define-key map "\e[5D"   [C-left])))

(add-hook 'after-make-console-frame-hooks
          (lambda ()
            (when (< emacs-major-version 23)
              (fix-up-xterm-control-arrows))
            (xterm-mouse-mode 1) ; Mouse in a terminal (Use shift to paste with middle button)
            (when (fboundp 'mwheel-install)
              (mwheel-install))))

(provide 'init-xterm)

(require 'init-frame-hooks)

(defun fix-up-xterm-control-arrows ()
  (let ((map (if (boundp 'input-decode-map)
                 input-decode-map
               function-key-map)))
    (define-key map "\e[1;5A" [C-up])
    (define-key map "\e[1;5B" [C-down])
    (define-key map "\e[1;5C" [C-right])
    (define-key map "\e[1;5D" [C-left])
    (define-key map "\e[5A"   [C-up])
    (define-key map "\e[5B"   [C-down])
    (define-key map "\e[5C"   [C-right])
    (define-key map "\e[5D"   [C-left])))

(global-set-key [mouse-4] (lambda () (interactive) (scroll-down 1)))
(global-set-key [mouse-5] (lambda () (interactive) (scroll-up 1)))

(add-hook 'after-make-console-frame-hooks
          (lambda ()
            (when (< emacs-major-version 23)
              (fix-up-xterm-control-arrows))
            (xterm-mouse-mode 1) ; Mouse in a terminal (Use shift to paste with middle button)
            (when (fboundp 'mwheel-install)
              (mwheel-install))))

(provide 'init-xterm)

Enable mouse scrolling in iTerm

Enable mouse scrolling in iTerm


;;; themes.el -- Theme configuration.
;;
;;; Commentary:
;;
;;    Code to activate my preferred themes.
;;
;;; Code:

;; Load default theme and update settings:
;; https://github.com/alezost/alect-themes
(require 'alect-themes)

(custom-set-variables
 '(alect-overriding-faces
   (quote ((mode-line ((t :foreground fg+1
                          :background bg-1
                          :box (:line-width 2 :color fg+1 :style nil))))
           (font-lock-string-face ((t :foreground yellow+2)))
           (font-lock-comment-face ((t :foreground "#9396c4")))
           (font-lock-comment-delimiter-face ((t :foreground bg
                                                 :weight bold)))))))

(alect-set-color 'dark 'bg-1 "#333333")
(load-theme 'alect-dark t)

;; Stolen from: https://github.com/alezost/emacs-config
(defun pjones:load-theme (theme)
  "Load THEME after unloading all other themes first."
  (interactive (list (intern (completing-read
                              "Load custom theme: "
                              (mapcar #'symbol-name (custom-available-themes))))))
  (mapc #'disable-theme custom-enabled-themes)
  (load-theme theme t))

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

;;; themes.el -- Theme configuration.
;;
;;; Commentary:
;;
;;    Code to activate my preferred themes.
;;
;;; Code:

;; Load default theme and update settings:
;; https://github.com/alezost/alect-themes
(require 'alect-themes)

(custom-set-variables
 '(alect-overriding-faces
   (quote ((mode-line ((t :foreground fg+1
                          :background bg-1
                          :box (:line-width 2 :color fg+1 :style nil))))
           (font-lock-string-face ((t :foreground yellow+2)))
           (font-lock-comment-face ((t :foreground "#9396c4")))
           (font-lock-comment-delimiter-face ((t :foreground bg
                                                 :weight bold)))))))

(alect-set-color 'dark  'bg-1     "#333333")
(alect-set-color 'light 'bg-1     "#ffffff")
(alect-set-color 'light 'yellow-1 "#b58900")
(load-theme 'alect-dark t)

;; Stolen from: https://github.com/alezost/emacs-config
(defun pjones:load-theme (theme)
  "Load THEME after unloading all other themes first."
  (interactive (list (intern (completing-read
                              "Load custom theme: "
                              (mapcar #'symbol-name (custom-available-themes))))))
  (mapc #'disable-theme custom-enabled-themes)
  (load-theme theme t))

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

Improve theme colors when using a light-colored theme


(use-package company-c-headers
  :config
  (add-to-list 'company-backends 'company-c-headers))

(add-hook 'c-mode-common-hook 'hs-minor-mode)

(defun c-kr-style ()
  "C mode"
  (interactive)
  (c-set-style "K&R")
  (setq-default indent-tabs-mode t)
  (setq c-syntactic-indentation nil)
  (setq tab-width 4)
  (setq c-basic-offset 4))

(defun c-kernel-style ()
  "C kernel mode"
  (interactive)
  (c-set-style "linux")
  (setq-default indent-tabs-mode t)
  (setq c-syntactic-indentation nil)
  (setq tab-width 8)
  (setq c-basic-offset 8))

(defun cpp-style ()
  "Cpp mode"
  (interactive)
  (c-set-style "stroustrup")
  (setq-default indent-tabs-mode nil)
  (setq c-syntactic-indentation nil)
  (setq tab-width 4)
  (setq c-basic-offset 4))

(add-hook 'c++-mode-hook 'cpp-style)
(add-hook 'c-mode-hook 'c-kernel-style)

(provide 'c-settings)

(use-package company-c-headers
  :config
  (add-to-list 'company-backends 'company-c-headers))

(add-hook 'c-mode-common-hook 'hs-minor-mode)

(defun c-kr-style ()
  "C mode"
  (interactive)
  (c-set-style "K&R")
  (setq-local indent-tabs-mode t)
  (setq c-syntactic-indentation nil)
  (setq tab-width 4)
  (setq c-basic-offset 4))

(defun c-kernel-style ()
  "C kernel mode"
  (interactive)
  (c-set-style "linux")
  (setq-local indent-tabs-mode t)
  (setq c-syntactic-indentation nil)
  (setq tab-width 8)
  (setq c-basic-offset 8))

(defun cpp-style ()
  "Cpp mode"
  (interactive)
  (c-set-style "stroustrup")
  (setq-local indent-tabs-mode nil)
  (setq c-syntactic-indentation nil)
  (setq tab-width 4)
  (setq c-basic-offset 4))

(add-hook 'c++-mode-hook 'cpp-style)
(add-hook 'c-mode-hook 'c-kernel-style)

(provide 'c-settings)

Stop fucking other modes indentation

Stop fucking other modes indentation


;; Default font size in GUIs is 9pt
(lexical-let ((rmg:font-height 90)
      (rmg:maximize-host-regexps '("reaper2.*"
                                  "niub30")))

  ;; Font size on reaper2 should be 11pt (higher density screen)
  (when (string-match "reaper2.*" (system-name))
    (setq rmg:font-height 110))

  ;; Add window setup hook for face size
  (add-hook 'window-setup-hook
            (lambda ()
              (when (display-graphic-p)
                (set-face-attribute 'default nil :height rmg:font-height)))
            t)

  ;; Maximize automatically for specific hosts
  (dolist (name-regex rmg:maximize-host-regexps)
    (when (string-match name-regex (system-name))
      (add-hook 'window-setup-hook
                #'rmg-maximize-frame
                t)))
  )

(provide 'rmg-host-specific)

;; Default font size in GUIs is 9pt
(lexical-let ((rmg:font-height 90)
      (rmg:maximize-host-regexps '("reaper2.*"
                                   "niub30"
                                   "wlvaio")))

  ;; Font size on reaper2 should be 11pt (higher density screen)
  (when (string-match "reaper2.*" (system-name))
    (setq rmg:font-height 110))

  ;; Add window setup hook for face size
  (add-hook 'window-setup-hook
            (lambda ()
              (when (display-graphic-p)
                (set-face-attribute 'default nil :height rmg:font-height)))
            t)

  ;; Maximize automatically for specific hosts
  (dolist (name-regex rmg:maximize-host-regexps)
    (when (string-match name-regex (system-name))
      (add-hook 'window-setup-hook
                #'rmg-maximize-frame
                t)))
  )

(provide 'rmg-host-specific)

Add wlvaio to auto-maximize hosts list

Add wlvaio to auto-maximize hosts list


; stylesheets
(autoload 'css-mode "css-mode")
(setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist))

(setq scss-compile-at-save nil)
(setq css-indent-offset 2)

Set css to 2 spaces

Set css to 2 spaces


(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
                     muse
                     htmlize
                     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
                     lua-mode
                     glsl-mode
                     undo-tree
                     cmake-mode
                     muse
                     htmlize
                     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)

Add 'cmake-mode' to default install package


;; -*- no-byte-compile: t; -*-
;;; feature/version-control/packages.el

;;; config.el
;; n/a

;;; +git
(when (featurep! +git)
  (package! git-gutter-fringe)
  (package! git-link)
  (package! git-timemachine)
  (package! gitconfig-mode)
  (package! gitignore-mode)
  (package! magit))

;;; TODO +hg

;; -*- no-byte-compile: t; -*-
;;; feature/version-control/packages.el

;;; config.el
;; n/a

;;; +git
(unless (featurep! -git)
  (package! git-gutter-fringe)
  (package! git-link)
  (package! git-timemachine)
  (package! gitconfig-mode)
  (package! gitignore-mode)
  (package! magit))

;;; TODO +hg

Add module flag support to :feature version-control


;;; js-conf.el -- Configuration options for js-mode (JavaScript).
(eval-when-compile (require 'js))
(setq js-indent-level 2 js-flat-functions t)

;;; js-conf.el -- Configuration options for js-mode (JavaScript).
(eval-when-compile (require 'js))

;; JavaScript mode settings
(setq js-indent-level 2
      js-flat-functions t)

(defvar pjones:js-keywords
  '(("\\(function *\\)("
     (0 (progn (compose-region (match-beginning 1)
                               (match-end 1) "\u0192") nil))))
  "Extra keywords to add to JavaScript buffers.
The Unicode anonymous function code was stolen from
https://github.com/technomancy/emacs-starter-kit")

(defun pjones:js-add-extra-keywords ()
  "Add some extra keywords to JavaScript buffers."
  (interactive)
  (font-lock-add-keywords 'js-mode pjones:js-keywords)
  (font-lock-fontify-buffer))

(defun pjones:js-rm-extra-keywords ()
  "Remove some extra keywords from JavaScript buffers."
  (interactive)
  (let ((modified (buffer-modified-p)))
    (font-lock-remove-keywords 'js-mode pjones:js-keywords)
    (remove-text-properties (point-min) (point-max) '(composition nil))
    (set-buffer-modified-p modified)))

(defun pjones:js-mode-hook ()
  "Configure JS mode and key bindings."
  (local-set-key (kbd "C-c C-k")   'pjones:js-rm-extra-keywords)
  (local-set-key (kbd "C-c C-S-k") 'pjones:js-add-extra-keywords))
(add-hook 'js-mode-hook 'pjones:js-mode-hook)

;; Set up the cool extra keywords right away!
(pjones:js-add-extra-keywords)

Add some extra keywords to JavaScript buffers with functions to toggle them


(defun locale-is-utf8-p ()
  "Return t iff the \"locale\" command or environment variables prefer UTF-8."
  (flet ((is-utf8 (v) (and v (string-match "UTF-8" v))))
    (or (is-utf8 (and (executable-find "locale") (shell-command-to-string "locale")))
        (is-utf8 (getenv "LC_ALL"))
        (is-utf8 (getenv "LC_CTYPE"))
        (is-utf8 (getenv "LANG")))))

(when (or window-system (locale-is-utf8-p))
  (setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
  (set-language-environment 'utf-8)
  (when *is-carbon-emacs*
    (set-keyboard-coding-system 'utf-8-mac))
  (setq locale-coding-system 'utf-8)
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (unless (eq system-type 'windows-nt)
   (set-selection-coding-system 'utf-8))
  (prefer-coding-system 'utf-8))

(provide 'init-locales)

(require 'cl-lib)

(defun locale-is-utf8-p ()
  "Return t iff the \"locale\" command or environment variables prefer UTF-8."
  (cl-flet ((is-utf8 (v) (and v (string-match "UTF-8" v))))
    (or (is-utf8 (and (executable-find "locale") (shell-command-to-string "locale")))
        (is-utf8 (getenv "LC_ALL"))
        (is-utf8 (getenv "LC_CTYPE"))
        (is-utf8 (getenv "LANG")))))

(when (or window-system (locale-is-utf8-p))
  (setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
  (set-language-environment 'utf-8)
  (when *is-carbon-emacs*
    (set-keyboard-coding-system 'utf-8-mac))
  (setq locale-coding-system 'utf-8)
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (unless (eq system-type 'windows-nt)
   (set-selection-coding-system 'utf-8))
  (prefer-coding-system 'utf-8))

(provide 'init-locales)

Replace an flet with cl-flet

Replace an flet with cl-flet


;; Emacs configuration

;; Parameters for Ivy autocompletion and related tools.

(use-package counsel
  :ensure t
  :config
  (setq-default enable-recursive-minibuffers t)
  :bind
  (("C-s" . counsel-grep-or-swiper)
   ("C-r" . counsel-grep-or-swiper)))

;; Facilitated access to SSH hosts listed in `~/.ssh/config'.
(use-package counsel-tramp
  :ensure t
  :config
  (setq-default tramp-default-method "ssh")
  :bind
  (("C-c s" . counsel-tramp)
   ("C-c q" . counsel-tramp-quit)))

(use-package swiper
  :ensure t
  :bind
  (("C-M-s" . swiper-all)))

(use-package ivy
  :ensure t
  :diminish ivy-mode
  :config
  (setq-default ivy-wrap t
                ivy-use-virtual-buffers t
                ivy-count-format "(%d/%d) ")
  :bind
  (("C-c C-r" . ivy-resume)))

(use-package hydra
  :ensure t)

(use-package ivy-hydra
  :ensure t
  :requires (ivy hydra)
  :after (ivy hydra))

;; Emacs configuration

;; Parameters for Ivy autocompletion and related tools.

(use-package counsel
  :ensure t
  :config
  (setq-default enable-recursive-minibuffers t)
  :bind
  (("C-s" . counsel-grep-or-swiper)
   ("C-r" . counsel-grep-or-swiper)))

;; Facilitated access to SSH hosts listed in `~/.ssh/config'.
(use-package counsel-tramp
  :ensure t
  :config
  (setq-default tramp-default-method "ssh")
  :bind
  (("C-c s" . counsel-tramp)
   ("C-c q" . counsel-tramp-quit)))

(use-package swiper
  :ensure t
  :bind
  (("C-M-s" . swiper-all)))

(use-package ivy
  :ensure t
  :diminish ivy-mode
  :config
  (setq-default ivy-wrap t
                ivy-use-virtual-buffers t
                ivy-count-format "(%d/%d) ")
  :bind
  (("C-c C-r" . ivy-resume)))

;; Nicer display for `ivy-switch-buffer'.
(use-package ivy-rich
  :ensure t
  :config
  (ivy-set-display-transformer 'ivy-switch-buffer
                               'ivy-rich-switch-buffer-transformer)
  (setq-default ivy-rich-path-style 'abbrev
                ivy-virtual-abbreviate 'full
                ivy-rich-switch-buffer-align-virtual-buffer t))

(use-package hydra
  :ensure t)

(use-package ivy-hydra
  :ensure t
  :requires (ivy hydra)
  :after (ivy hydra))

Use ivy-rich for a nicer display of ivy-switch-buffer


(add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.spec?$" . erlang-mode))
(setq erlang-root-dir "/usr/local/lib/erlang/erts-5.9.2")
(add-to-list 'exec-path "/usr/local/lib/erlang/erts-5.9.2/bin")
(setq erlang-man-root-dir "/usr/local/lib/erlang/erts-5.9.2/man")
(setq erlang-compile-extra-opts '(debug_info))
(require 'erlang-start)

(add-hook 'erlang-mode-hook
      (lambda ()
        ;; when starting an Erlang shell in Emacs, with a custom node name
        (setq inferior-erlang-machine-options '("-sname" "syl20bnr"))
        ))

(require 'erlang-flymake)
(erlang-flymake-only-on-save)

(add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.spec?$" . erlang-mode))
(setq erlang-root-dir "/usr/local/lib/erlang/erts-5.9.2")
(add-to-list 'exec-path "/usr/local/lib/erlang/erts-5.9.2/bin")
(setq erlang-man-root-dir "/usr/local/lib/erlang/erts-5.9.2/man")
(setq erlang-compile-extra-opts '(debug_info))
(require 'erlang-start)

(add-hook 'erlang-mode-hook
      (lambda ()
        ;; when starting an Erlang shell in Emacs, with a custom node name
        (setq inferior-erlang-machine-options '("-sname" "syl20bnr"))
        ))

;; not needed using EDTS
;; (require 'erlang-flymake)
;; (erlang-flymake-only-on-save)

Disable flymake for erlang, it is not needed with EDTS


;; different method used than the documented one in order to speed up the
;; loading of emacs
(use-package solarized
  :init
  (progn
    (deftheme solarized-light "The light variant of the Solarized colour theme")
    (create-solarized-theme 'light 'solarized-light)
    (deftheme solarized-dark "The dark variant of the Solarized colour theme")
    (create-solarized-theme 'dark 'solarized-dark)
    (set-flycheck-custom-face)
))

;; different method used than the documented one in order to speed up the
;; loading of emacs
(use-package solarized
  :init
  (progn
    (deftheme solarized-light "The light variant of the Solarized colour theme")
    (create-solarized-theme 'light 'solarized-light)
    (deftheme solarized-dark "The dark variant of the Solarized colour theme")
    (create-solarized-theme 'dark 'solarized-dark)
    (spacemacs/set-flycheck-custom-face)
))

Fix init of Solarized theme

Fix init of Solarized theme


;;; Local settings based on host name

(defun pmade-local-settings ()
  (cond
   ((string= "skinny.local" system-name) (pmade-local:skinny))
   ((string= "beefy.local"  system-name) (pmade-local:beefy))))

(defun pmade-local:skinny ()
  "Settings for my MacBook Pro"
  (set-frame-position (selected-frame) 674 22)
  (set-frame-size (selected-frame) 106 56))

(defun pmade-local:beefy ()
  "Settings for my Mac Pro")

;; These settings only take affect if we're running the GUI.
(if window-system
    (add-hook 'window-setup-hook 'pmade-local-settings t))

;;; Local settings based on host name
;;
;; Some helpful functions:
;;
;;   (frame-parameter (selected-frame) 'top)
;;   (frame-parameter (selected-frame) 'left)

(defun pmade-local-settings ()
  (cond
   ((string= "skinny.local" system-name) (pmade-local:skinny))
   ((string= "beefy.local"  system-name) (pmade-local:beefy))))

(defun pmade-local:skinny ()
  "Settings for my MacBook Pro"
  (set-frame-position (selected-frame) 674 22)
  (set-frame-size (selected-frame) 106 56))

(defun pmade-local:beefy ()
  "Settings for my Mac Pro"
  (set-frame-position (selected-frame) 874 38)
  (set-frame-size (selected-frame) 126 75))

;; These settings only take affect if we're running the GUI.
(if window-system
    (add-hook 'window-setup-hook 'pmade-local-settings t))

Configure Emacs windows for my desktop computer


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

(setq ranger-packages
      '(
        (dired :location built-in)
        ranger
        ))

(defun ranger//set-leader-keys ()
  (spacemacs/set-leader-keys
    "ar" 'ranger
    "ad" 'deer))

(defun ranger/init-ranger ()
  (use-package ranger
    :defer t
    :init
    (progn
      (ranger//set-leader-keys)
      ;; set up image-dired to allow picture resize
      (setq image-dired-dir (concat spacemacs-cache-directory "image-dir"))
      (unless (file-directory-p image-dired-dir)
        (make-directory image-dired-dir)))
    :config
    (define-key ranger-mode-map (kbd "-") 'ranger-up-directory)))

(defun ranger/post-init-dired ()
  ;; Be sure to override dired bindings
  (ranger//set-leader-keys))

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

(setq ranger-packages
      '(
        (dired :location built-in)
        ranger
        ))

(defun ranger//set-leader-keys ()
  (spacemacs/set-leader-keys
    "ar" 'ranger
    "ad" 'deer))

(defun ranger/init-ranger ()
  (use-package ranger
    :defer t
    :commands (ranger deer ranger-override-dired-fn)
    :init
    (progn
      (ranger//set-leader-keys)
      ;; set up image-dired to allow picture resize
      (setq image-dired-dir (concat spacemacs-cache-directory "image-dir"))
      (unless (file-directory-p image-dired-dir)
        (make-directory image-dired-dir)))
    :config
    (define-key ranger-mode-map (kbd "-") 'ranger-up-directory)))

(defun ranger/post-init-dired ()
  ;; Be sure to override dired bindings
  (ranger//set-leader-keys)
  ;; need to apply this to compensate for defer
  (when ranger-override-dired
    (add-hook 'dired-mode-hook #'ranger-override-dired-fn)))

Add commands for ranger to make accessible when defered.

syl20bnr: move the code to dired post-init


(require 'go-mode)

(setq gofmt-command "goimports")
(add-hook 'before-save-hook 'gofmt-before-save)

;; running tests
(defun go-test ()
  "Runs tests for package in current buffer"
  (interactive)
  (compile (concat "ginkgo " (file-name-directory (buffer-file-name)))))

;; test toggling
(eval-after-load 'find-file
  '(progn
     (add-to-list 'cc-other-file-alist '(".go" ("_test.go")))
     (add-to-list 'cc-other-file-alist '("_test.go" (".go")))
     ))

(define-key tj-map (kbd "r t") 'go-test)
(global-set-key (kbd "M-T") 'ff-find-other-file)

(provide 'tj-go)

(require 'go-mode)

(setq gofmt-command "goimports")
(add-hook 'before-save-hook 'gofmt-before-save)

;; running tests
(defun go-test ()
  "Runs tests for package in current buffer"
  (interactive)
  (compile (concat "ginkgo " (file-name-directory (buffer-file-name)))))

(defun go-unfocus ()
  "Unfocuses tests for the current file"
  (interactive)
  (compile (concat "ginkgo unfocus " (file-name-directory (buffer-file-name))))
  (update-buffers))

;; test toggling
(eval-after-load 'find-file
  '(progn
     (add-to-list 'cc-other-file-alist '(".go" ("_test.go")))
     (add-to-list 'cc-other-file-alist '("_test.go" (".go")))
     ))

(define-key tj-map (kbd "r t") 'go-test)
(define-key tj-map (kbd "u f") 'go-unfocus)
(global-set-key (kbd "M-T") 'ff-find-other-file)

(provide 'tj-go)

Add 'ginkgo unfocus' keybinding for emacs


(require 'dash)

(defun my-load-all ()
  (interactive)
  (let ((default-directory "~/my/dotfiles/emacs/emacs.d")
        (my-files
         (list "my-fns"
               "my-env"
               "my-keys"
               "my-view"
               "my-sublime"
               "my-shell"
               "my-occur"
               "my-isearch"
               "my-help"
               "my-dired"
               "my-org-activity-log"
               "my-update-dot-emacs"
               ))
        (my-non-packages
         ;; Files that aren't on MELPA or any other
         ;; package archive.
         (directory-files "~/.emacs.d/third-party" 'full "\\.el$" t))
        (my-private "~/.emacs.private.el"))

    (my-load (if window-system "my-gui" "my-terminal"))

    (mapc 'my-load my-non-packages)
    ;; Load all my files: main reason to load this
    ;; before package customizations: they might
    ;; depend on functions in my-fns.el (and other
    ;; dependencies like that).
    (mapc 'my-load my-files)

    (dolist (package my-packages)
      (my-load (format "my-%s.el" package) 'ignore-if-missing))
    (my-load my-private 'ignore-if-missing)))

(my-load-all)
(recentf-open-files)

(require 'dash)

(defun my-load-all ()
  (interactive)
  (let ((default-directory "~/my/dotfiles/emacs/emacs.d")
        (my-files
         (list "my-fns"
               "my-env"
               "my-keys"
               "my-view"
               "my-sublime"
               "my-shell"
               "my-occur"
               "my-isearch"
               "my-help"
               "my-dired"
               "my-org-activity-log"
               "my-update-dot-emacs"
               ))
        (my-non-packages
         ;; Files that aren't on MELPA or any other
         ;; package archive.
         (directory-files "~/.emacs.d/third-party" 'full "\\.el$" t))
        (my-private "~/.emacs.private.el"))

    (my-load (if window-system "my-gui" "my-terminal"))

    (mapc 'my-load my-non-packages)
    ;; Load all my files: main reason to load this
    ;; before package customizations: they might
    ;; depend on functions in my-fns.el (and other
    ;; dependencies like that).
    (mapc 'my-load my-files)

    (dolist (package my-packages)
      (my-load (format "my-%s.el" package) 'ignore-if-missing))
    (my-load my-private 'ignore-if-missing)))

(my-load-all)

(unless window-system
  (recentf-open-files))

Disable recentf menu for window system

Disable recentf menu for window system


; always use spaces and not tabs to indent code
(setq-default indent-tabs-mode nil)

; don't show menu bar
(menu-bar-mode -1)

; be more interactive ;)
(ido-mode 1)

; show line number
(global-linum-mode 1)
(setq linum-format "%4d ")

; display column number in status bar
(setq column-number-mode t)

; show matching pairs of parentheses
(show-paren-mode 1)
(setq show-paren-delay 0)

; when splitting screen try to put new window on bottom
(setq split-height-threshold 0)
(setq split-width-threshold 0)

(when (eq system-type 'darwin)
  (when (file-exists-p "/opt/local/bin/gls")
    (setq insert-directory-program "/opt/local/bin/gls")
    (setq dired-listing-switches "-aBhl --group-directories-first")))

Use ls from coreutils when available on os x


;;;; Config all the keybindings!

(require 'evil)
(require 'key-chord)

;;; Misc
(evil-set-toggle-key "C-M-z") ; because f clobbering my C-z...

;;; Leader maps
(evil-leader/set-leader "<SPC>")
(key-chord-define evil-insert-state-map  "jk" 'evil-normal-state) ; inoremap jk <ESC>
(evil-leader/set-key "hl" 'evil-search-highlight-persist-remove-all)

(evil-leader/set-key
  "bk" 'kill-buffer
  "<SPC>" 'switch-last-buffer)

(evil-leader/set-key
  "hf" 'describe-function
  "hk" 'describe-key
  "hm" 'describe-mode
  "hv" 'describe-variable)

(evil-leader/set-key
  "j" 'ace-jump-char-mode)

(provide 'key-config)

;;;; Config all the keybindings!

(require 'evil)
(require 'key-chord)

;;; Misc
(evil-set-toggle-key "C-M-z") ; because f clobbering my C-z...

;;; Leader maps
(evil-leader/set-leader "<SPC>")
(key-chord-define evil-insert-state-map  "jk" 'evil-normal-state) ; inoremap jk <ESC>
(evil-leader/set-key "hl" 'evil-search-highlight-persist-remove-all)

(evil-leader/set-key
  "bk" 'kill-buffer
  "<SPC>" 'switch-last-buffer)

(evil-leader/set-key
  "hf" 'describe-function
  "hk" 'describe-key
  "hm" 'describe-mode
  "hv" 'describe-variable)

; Slightly cargo-culted; should probably find out what interactive does, ha
(evil-leader/set-key
  "a=" (lambda (begin end)
         (interactive "r")
         (align-regexp begin end "\\(\\s-*\\)=>" 1 1)))
(evil-leader/set-key
  "a-" (lambda (begin end)
         (interactive "r")
         (align-regexp begin end "\\(\\s-*\\)->" 1 1)))
(evil-leader/set-key
  "aa" 'align-regexp)

(evil-leader/set-key
  "j" 'ace-jump-char-mode)

(provide 'key-config)

Add leader maps for aligning text

Add leader maps for aligning text


;; Time-stamp: <2014-07-01 14:16:19 kmodi>

;; Shell Script Mode

(defun my-sh-mode-customizations()
  (when (boundp 'setup-linum-loaded)
    (nlinum-mode 1))
  )
(add-hook 'sh-mode-hook 'my-sh-mode-customizations)

(provide 'setup-shell)

;; Time-stamp: <2015-01-14 10:57:34 kmodi>

;; Shell Script Mode

(defun my/tcsh-set-indent-functions ()
  (when (or (string-match ".*\\.alias" (buffer-file-name))
            (string-match ".*\\.setup.*" (buffer-file-name))
            (string-match ".*\\.cfg" (buffer-file-name))
            (string-match ".*csh$" (file-name-extension (buffer-file-name))))
    (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)

Fix indentation in buffers with tcsh scripts


(setq x-alt-keysym 'meta)

(when (fboundp 'tool-bar-mode)
   (tool-bar-mode -1)
 )

(when (fboundp 'scroll-bar-mode)
   (scroll-bar-mode -1)
 )

(setq
      inhibit-splash-screen t
      line-number-mode t
      column-number-mode t
 )

(WhenOSX
   (set-face-attribute 'default nil
             :family "Inconsolata" :height 140 :weight 'normal)
   (my/resize-frame-tall)
   (my/resize-frame-wide)
 )

(when (display-graphic-p)
  (add-hook 'after-make-frame-functions
    (lambda (frame)
      (let ((mode 'dark))
        (set-frame-parameter frame 'background-mode mode)
        (enable-theme 'solarized)
 )
 )
   )
  (load-theme 'solarized t)
 )

(setq x-alt-keysym 'meta)

(when (fboundp 'tool-bar-mode)
   (tool-bar-mode -1)
 )

(when (fboundp 'scroll-bar-mode)
   (scroll-bar-mode -1)
 )

(setq
      inhibit-splash-screen t
      line-number-mode t
      column-number-mode t
 )

(WhenOSX
   (set-face-attribute 'default nil
             :family "Inconsolata" :height 140 :weight 'normal)
   (my/resize-frame-tall)
   (my/resize-frame-wide)
 )

(load-theme 'solarized-dark t)

Use the updated theme name

Use the updated theme name


(autoload 'markdown-mode "markdown-mode" "Mode for editing Markdown documents" t)
(setq auto-mode-alist
      (cons '("\\.\\(md\\|markdown\\)\\'" . markdown-mode) auto-mode-alist))

(provide 'init-markdown)

Remove redundant autoload for markdown-mode


;;----------------------------------------------------------------------------
;; Misc config - yet to be placed in separate files
;;----------------------------------------------------------------------------
(add-auto-mode 'tcl-mode "Portfile\\'")
(fset 'yes-or-no-p 'y-or-n-p)

(dolist (hook (if (fboundp 'prog-mode)
                  '(prog-mode-hook ruby-mode-hook)
                '(find-file-hooks)))
  (add-hook hook 'goto-address-prog-mode))
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
(setq goto-address-mail-face 'link)

(setq-default regex-tool-backend 'perl)

(add-auto-mode 'conf-mode "Procfile")

(provide 'init-misc)

;;----------------------------------------------------------------------------
;; Misc config - yet to be placed in separate files
;;----------------------------------------------------------------------------
(add-auto-mode 'tcl-mode "Portfile\\'")
(fset 'yes-or-no-p 'y-or-n-p)

(when (fboundp 'prog-mode)
  (add-hook 'prog-mode-hook 'goto-address-prog-mode))
(setq goto-address-mail-face 'link)

(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)

(setq-default regex-tool-backend 'perl)

(add-auto-mode 'conf-mode "Procfile")

(provide 'init-misc)

Drop outdated assumption that ruby-mode might not be a prog-mode


(set-face-attribute 'default nil
                    :family "Inconsolata" :height 145 :weight 'normal)

;; Fallbacks for missing unicode glyphs
(set-fontset-font "fontset-default"
                  (cons (decode-char 'ucs #x21a2)
                        (decode-char 'ucs #x21a3))
                  '("Menlo" . "iso10646-1")
                  )
(set-fontset-font "fontset-default"
                  (cons (decode-char 'ucs #x21dd)
                        (decode-char 'ucs #x2218))
                  '("Menlo" . "iso10646-1")
                  )

(set-face-attribute 'default nil
                    :family "Inconsolata" :height 145 :weight 'normal)

(when (functionp 'set-fontset-font)
  ;; Fallbacks for missing unicode glyphs
  (set-fontset-font "fontset-default"
                    (cons (decode-char 'ucs #x21a2)
                          (decode-char 'ucs #x21a3))
                    '("Menlo" . "iso10646-1")
                    )
  (set-fontset-font "fontset-default"
                    (cons (decode-char 'ucs #x21dd)
                          (decode-char 'ucs #x2218))
                    '("Menlo" . "iso10646-1")
                    )
  )

Fix fontset issue when run in terminal

Fix fontset issue when run in terminal


;; Init file to use with the orgmode plugin.

;; Load org-mode
;; Requires org-mode v8.x

;; Uncomment these lines and change the path to your org source to
;; add use it.
;; (let* ((org-lisp-dir "~/.emacs.d/src/org/lisp"))
;;   (when (file-directory-p org-lisp-dir)
;;       (add-to-list 'load-path org-lisp-dir)
;;       (require 'org)))

(require 'ox-html)

;; Custom configuration for the export.
;;; Add any custom configuration that you would like.
(setq
 org-export-with-toc nil
 org-export-with-section-numbers nil)

;; Export function used by Nikola.
(defun nikola-html-export (infile outfile)
  "Export the body only of the input file and write it to
specified location."

  (with-current-buffer (find-file infile)
    (org-html-export-as-html nil nil t t)
    (write-file outfile nil)))

;; Init file to use with the orgmode plugin.

;; Load org-mode
;; Requires org-mode v8.x

;; Uncomment these lines and change the path to your org source to
;; add use it.
;; (let* ((org-lisp-dir "~/.emacs.d/src/org/lisp"))
;;   (when (file-directory-p org-lisp-dir)
;;       (add-to-list 'load-path org-lisp-dir)
;;       (require 'org)))

(require 'ox-html)

;; Custom configuration for the export.
;;; Add any custom configuration that you would like.
(setq
 org-export-with-toc nil
 org-export-with-section-numbers nil
 org-startup-folded 'showeverything)

;; Export function used by Nikola.
(defun nikola-html-export (infile outfile)
  "Export the body only of the input file and write it to
specified location."

  (with-current-buffer (find-file infile)
    (org-html-export-as-html nil nil t t)
    (write-file outfile nil)))

Fix the output with the latest version of org-mode.

Org-mode had a bug fix, which changed the default mode of opening a
buffer and caused issues when exporting it.  See [1] for details.
Thanks to 邓栓 for reporting it.

[1] http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=44acd000


;;; emacs.el --- General custom settings for Emacs

;;; Code:

; Turn off the startup screen
(setq inhibit-startup-screen t)

;;; emacs.el --- General custom settings for Emacs

;;; Code:

; Always indent with spaces, not tabs.
(setq-default indent-tabs-mode nil)

; Turn off the startup screen
(setq inhibit-startup-screen t)

Make indentation always with spaces

Make indentation always with spaces


((erlang-mode
  (flycheck-erlang-include-path . ("../include"
                                   "../../../_build/test/lib"))
  (flycheck-erlang-library-path . ("../../../_build/default/lib/lager/ebin"
                                   "../../../_build/test/lib"))))

((erlang-mode
  (flycheck-erlang-include-path . ("../include"
                                   "../../../_build/test/lib"))
  (flycheck-erlang-library-path . ("../../../_build/default/lib/lager/ebin"
                                   "../../../_build/test/lib/proper/ebin"
                                   "../../../_build/test/lib"))))

Fix flycheck warning re: unknown parse transform


((c++-mode . (;; Make includes work properly
              (eval . (set (make-local-variable 'flycheck-gcc-include-path)
                           (set (make-local-variable 'flycheck-clang-include-path)
                                (let ((dir-locals-dir
                                       (let ((d (directory-file-name (file-name-directory buffer-file-name))))
                                         (while (not (file-exists-p
                                                      (format "%s/%s" d ".dir-locals.el")))
                                           (setq d (directory-file-name (file-name-directory d))))
                                         d)))
                                  (list (format "%s/%s" dir-locals-dir "src")
                                        (format "%s/%s" dir-locals-dir "catch-raw")
                                        (format "%s/%s" dir-locals-dir "plugins"))))))
              (eval . (set (make-local-variable 'flycheck-gcc-warnings)
                           (set (make-local-variable 'flycheck-clang-warnings)
                                (list "everything"
                                      "no-c++98-compat"
                                      "no-exit-time-destructors"
                                      "no-global-constructors"
                                      "no-documentation-unknown-command"
                                      "no-shadow"
                                      "no-padded"))))))
 ;; apply to all source directories (including plugins)
 (subdirs . t))

((c++-mode . ( ;; Make includes work properly
              (eval .
                    (set (make-local-variable
                          'flycheck-gcc-include-path)
                         (set (make-local-variable
                               'flycheck-clang-include-path)
                              (let ((dir-locals-dir
                                     (let ((d (directory-file-name
                                               (file-name-directory
                                                buffer-file-name))))
                                       (while (not (file-exists-p
                                                    (format "%s/%s" d
                                                            ".dir-locals.el")))
                                         (setq d (directory-file-name
                                                  (file-name-directory
                                                   d))))
                                       d)))
                                (list (format "%s/%s" dir-locals-dir
                                              "src")
                                      (format "%s/%s" dir-locals-dir
                                              "catch-raw")
                                      (format "%s/%s" dir-locals-dir
                                              "plugins"))))))
              (eval .
                    (set (make-local-variable 'flycheck-gcc-warnings)
                         (set (make-local-variable
                               'flycheck-clang-warnings)
                              (list "everything" "no-c++98-compat"
                                    "no-c++98-compat-pedantic"
                                    "no-exit-time-destructors"
                                    "no-global-constructors"
                                    "no-documentation-unknown-command"
                                    "no-shadow" "no-padded"
                                    "no-weak-vtables"))))))
 ;; apply to all source directories (including plugins)
 (subdirs . t))

Remove other warnings that vick-build ignores


(defun yas-with-comment (str)
  (format "%s%s%s" comment-start str comment-end))

(defun yas-with-comment (str)
  (format "%s %s%s" comment-start str comment-end))

Set a whitespace between comment-start and comment


(message "Loading my custom init.el")

;; Disable that pesky startup screen
(custom-set-variables
 '(inhibit-startup-screen t))

;; Default C/C++ style
(setq c-default-style "bsd")
(setq-default indent-tabs-mode nil)
(setq-default tab-width 3)
(setq-default c-basic-offset 3)

;; Python indenting
(add-hook 'python-mode-hook
          (lambda ()
            (setq electric-indent-chars (delq ?: electric-indent-chars))))

;; If color-theme is installed apply our favorite colors
(when (require 'color-theme nil 'noerror)
  (when (display-graphic-p)
    (color-theme-initialize)
    (color-theme-deep-blue)))

;; Set major modes for additional extensions
(add-to-list 'auto-mode-alist '("\\.cl\\'" . c-mode))

;; custom key mappings for common spell checking operations
(global-set-key (kbd "<f6>") 'flyspell-mode)
(global-set-key (kbd "<f7>") 'flyspell-buffer)
(global-set-key (kbd "<f8>") 'ispell-word)

;; no verbose checking status (speeds things up)
(setq flyspell-issue-message-flag nil)

(message "Finished loading init.el")

(message "Loading my custom init.el")

;; Disable that pesky startup screen
(custom-set-variables
 '(inhibit-startup-screen t))

;; Default C/C++ style
(setq c-default-style "bsd")
(setq-default indent-tabs-mode nil)
(setq-default tab-width 3)
(setq-default c-basic-offset 3)

;; Python indenting
(add-hook 'python-mode-hook
          (lambda ()
            (setq electric-indent-chars (delq ?: electric-indent-chars))))

;; If color-theme is installed apply our favorite colors
(when (require 'color-theme nil 'noerror)
  (when (display-graphic-p)
    (color-theme-initialize)
    (color-theme-deep-blue)))

;; Set major modes for additional extensions
(add-to-list 'auto-mode-alist '("\\.cl\\'" . c-mode)) ;; OpenCL kernels
(add-to-list 'auto-mode-alist '("\\.proto\\'" . c++-mode)) ;; Protobuf

;; custom key mappings for common spell checking operations
(global-set-key (kbd "<f6>") 'flyspell-mode)
(global-set-key (kbd "<f7>") 'flyspell-buffer)
(global-set-key (kbd "<f8>") 'ispell-word)

;; no verbose checking status (speeds things up)
(setq flyspell-issue-message-flag nil)

(message "Finished loading init.el")

Enable c++-mode for protobuf source.

Enable c++-mode for protobuf source.


;;; exwm-conf.el -- Setting for EXWM.
;;
;; https://github.com/ch11ng/exwm
(eval-when-compile
  (require 'exwm))

(defun pjones:exwm-update-class-hook ()
  "Update shit after a class name changes."
  (exwm-workspace-rename-buffer exwm-class-name))

(custom-set-variables
  '(exwm-workspace-number 9)

  ;; Simulated key presses to X Windows.
  '(exwm-input-simulation-keys
    '(([?\C-b] . [left])
      ([?\C-f] . [right])
      ([?\C-p] . [up])
      ([?\C-n] . [down])
      ([?\C-a] . [home])
      ([?\C-e] . [end])
      ([?\M-v] . [prior])
      ([?\C-v] . [next])
      ([?\C-d] . [delete])
      ([?\C-k] . [S-end delete]))))

(exwm-input-set-key (kbd "s-r")   #'exwm-reset)
(exwm-input-set-key (kbd "s-w")   #'exwm-workspace-switch)
(add-hook 'exwm-update-class-hook #'pjones:exwm-update-class-hook)

;;; exwm-conf.el -- Setting for EXWM.
;;
;; https://github.com/ch11ng/exwm
(eval-when-compile
  (require 'exwm))

;; Load optional EXWM features:
(require 'exwm-randr)
(require 'exwm-systemtray)

(defun pjones:exwm-update-class-hook ()
  "Update shit after a class name changes."
  (exwm-workspace-rename-buffer exwm-class-name))

(custom-set-variables
   ;; Move minibuffer to the top of the screen and auto hide:
   '(exwm-workspace-minibuffer-position 'top)

   ;; Number of workspaces:
  '(exwm-workspace-number 9)

  ;; RandR settings:
  '(exwm-randr-workspace-output-plist '(0 "eDP1"))

  ;; Simulated key presses to X Windows:
  '(exwm-input-simulation-keys
    '(([?\C-b] . [left])
      ([?\C-f] . [right])
      ([?\C-p] . [up])
      ([?\C-n] . [down])
      ([?\C-a] . [home])
      ([?\C-e] . [end])
      ([?\M-v] . [prior])
      ([?\C-v] . [next])
      ([?\C-d] . [delete])
      ([?\C-k] . [S-end delete]))))

(exwm-input-set-key (kbd "s-r") #'exwm-reset)
(exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch)

;; Activate optional features:
(exwm-randr-enable)
(exwm-systemtray-enable)

;; Insert some hooks:
(add-hook 'exwm-update-class-hook #'pjones:exwm-update-class-hook)

Add some EXWM settings that require a restart


;;; setup-ui.el --- UI related configuration.
;;; Commentary:
;;; Code:

;; get rid of everything other than the title at the top.
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

;; get rid of the annoying GNU Emacs buffer
(setq inhibit-startup-screen t)

;; load the latest theme.
(load-theme 'avk-darkblue-white t)
(set-face-attribute 'default nil :height 105)

(use-package spaceline
  :ensure t
  :demand
  :config
  (require 'spaceline-config)
  (spaceline-spacemacs-theme)
  (setq spaceline-minor-modes-separator " "))

;; Frame commands
(global-set-key (kbd "C-c F") 'make-frame)
(global-set-key (kbd "C-c K") 'delete-frame)

;; no DING!
(setq visible-bell 1)

;; This has been driving me crazy. So new key binding.
(global-set-key (kbd "<f9>") 'split-window-right)

(provide 'setup-ui)
;;; setup-ui.el ends here

;;; setup-ui.el --- UI related configuration.
;;; Commentary:
;;; Code:

;; get rid of everything other than the title at the top.
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

;; get rid of the annoying GNU Emacs buffer
(setq inhibit-startup-screen t)

;; load the latest theme.
(load-theme 'avk-darkblue-white t)
(set-face-attribute 'default nil :height 105)

(use-package spaceline
  :ensure t
  :demand
  :config
  (require 'spaceline-config)
  (spaceline-spacemacs-theme)
  (setq spaceline-minor-modes-separator " "))

;; Frame commands
(global-set-key (kbd "C-c F") 'make-frame)
(global-set-key (kbd "C-c K") 'delete-frame)

;; no DING!
(setq visible-bell 1)

;; This has been driving me crazy. So new key binding.
(global-set-key (kbd "<f9>") 'split-window-right)

;; enlarge/shrink current window
(global-set-key (kbd "s-f") 'enlarge-window-horizontally)
(global-set-key (kbd "s-b") 'shrink-window-horizontally)

(provide 'setup-ui)
;;; setup-ui.el ends here

Add enlarge/shrink horizontally shortcuts for windows


;; Time-stamp: <2014-08-18 13:25:47 kmodi>

;; magit
;; Source: https://github.com/magit/magit

(req-package magit
  :commands (magit-status)
  :requires (key-chord)
  :init
  (progn
    (bind-keys
     :map modi-mode-map
     ("<f11>"   . magit-status)
     ("<S-f11>" . magit-push)
     ("<M-f11>" . magit-pull))
    (key-chord-define-global "-[" 'magit-status)) ;; alternative for F11
  :config
  (progn
    (setq magit-completing-read-function 'magit-ido-completing-read
          magit-auto-revert-mode nil
          magit-repo-dirs '( "~/.emacs.d"))
    (magit-auto-revert-mode -1))) ;; Disable magit auto revert

(provide 'setup-magit)

;; Time-stamp: <2014-10-15 09:31:43 kmodi>

;; magit
;; Source: https://github.com/magit/magit

(req-package magit
  :commands (magit-status)
  :requires (key-chord)
  :init
  (progn
    (bind-keys
     :map modi-mode-map
     ("<f11>"   . magit-status)
     ("<S-f11>" . magit-push)
     ("<M-f11>" . magit-pull))
    (key-chord-define-global "-[" 'magit-status)) ;; alternative for F11
  :config
  (progn
    (setq magit-completing-read-function 'magit-ido-completing-read)
    (setq magit-auto-revert-mode nil)
    (setq magit-repo-dirs '( "~/.emacs.d"))
    (setq magit-diff-options '("--ignore-space-change"))
    (magit-auto-revert-mode -1) ;; Disable magit auto revert
    ;; While in "*magit..*" buffer on doing Commit (`c c'), the
    ;; ".. COMMIT_EDITMSG" buffer opens and reuses the "*magit .." window.
    ;; This is not useful when you'd want to add details about what you are
    ;; committing while reviewing the diff in "*magit .." window. So ensure
    ;; that the ".. COMMIT_EDITMSG" buffer always pops up in a new window.
    ;; `display-buffer-alist' = '(CONDITION . (FUNCTION . ALIST))
    (add-to-list 'display-buffer-alist
                 '(".*COMMIT_EDITMSG". ((display-buffer-pop-up-window) .
                                        ((inhibit-same-window . t)))))))

(provide 'setup-magit)

Make the COMMIT_EDITMSG buffer open in a new window and not reuse the *magit:..* window


;;; package --- Summary

;;; Commentary:

;;; Code:

;; (set-face-foreground 'mode-line "black")
;; (set-face-background 'mode-line "purple")
;; (set-face-background 'mode-line-inactive "blue")
;; (set-face-background 'modeline-inactive "red")

;; (setq custom-enabled-themes "hipster")
;; (setq custom-safe-themes "hipster")
;; (custom-safe-themes 'hipster-theme)

;; We use a high contrast theme in the summer and a low contrast theme in the winter

;; (setq sunny-month-list    '(Apr May June July Aug Sept Oct))
;; (setq high-contrast-theme 'badger)
;; (setq low-contrast-theme  'zenburn)

(load-theme 'badger)

;; (set-color-theme-by-current-month(sunny-month-list high-contrast-theme low-contrast-theme)

;; (custom-set-faces
 ;; '(neo-dir-link-face ((t (:foreground "yellow"))))
 ;; '(neo-dir-link-face ((t (:foreground "color-64"))))
 ;; '(neo-file-link-face ((t (:foreground "color-244")))))

;;; package --- Summary

;;; Commentary:

;;; Code:

;; (set-face-foreground 'mode-line "black")
;; (set-face-background 'mode-line "purple")
;; (set-face-background 'mode-line-inactive "blue")
;; (set-face-background 'modeline-inactive "red")

;; (setq custom-enabled-themes "hipster")
;; (setq custom-safe-themes "hipster")
;; (custom-safe-themes 'hipster-theme)

;; We use a high contrast theme in the summer and a low contrast theme in the winter

;; (setq sunny-month-list    '(Apr May June July Aug Sept Oct))
;; (setq high-contrast-theme 'badger)
;; (setq low-contrast-theme  'zenburn)

(add-hook 'after-init-hook (lambda () (load-theme 'badger)))
;; (load-theme 'badger)

;; (set-color-theme-by-current-month(sunny-month-list high-contrast-theme low-contrast-theme)

;; (custom-set-faces
 ;; '(neo-dir-link-face ((t (:foreground "yellow"))))
 ;; '(neo-dir-link-face ((t (:foreground "color-64"))))
 ;; '(neo-file-link-face ((t (:foreground "color-244")))))

Fix question about loading theme on every Emacs startup


;; Define function to shutdown emacs server instance
;; Can be called from shell with: emacsclient -e '(server-shutdown)'
(defun server-shutdown ()
  "Save buffers, Quit, and Shutdown (kill) server"
  (interactive)
  (save-some-buffers)
  (kill-emacs)
  )

(server-start)

;; Define function to shutdown emacs server instance
;; Can be called from shell with: emacsclient -e '(server-shutdown)'
(defun server-shutdown ()
  "Save buffers, Quit, and Shutdown (kill) server"
  (interactive)
  (save-some-buffers)
  (kill-emacs)
  )

;; To start the emacs server, call:
;; (server-start)

Disable starting the server automatically


;; custom.el
(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.
 '(tramp-default-method "ssh"))
(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.el
(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.
 '(org-hide-emphasis-markers t)
 '(tramp-default-method "ssh"))
(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.
 )

Hide org markup markers in org files.

Hide org markup markers in org files.


;;; init-isearch.el -- isearch setup

;;; Commentary:
;;; use anzu instead of isearch

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

(use-package anzu
             :bind (("C-M-%" . anzu-query-replace-regexp)
                    ("M-%" . anzu-query-replace)
                    ("C-s" . isearch-forward-regexp)
                    ("C-r" . isearch-backward-regexp))
             :defer t
             :diminish anzu-mode
             :init
             (global-anzu-mode 1))

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

;;; init-isearch.el -- isearch setup

;;; Commentary:
;;; use anzu instead of isearch

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

(use-package anzu
  :bind (("C-M-%" . anzu-query-replace-regexp)
         ("M-%" . anzu-query-replace)
         ("C-s" . isearch-forward-regexp)
         ("C-r" . isearch-backward-regexp))
  :defer t
  :diminish anzu-mode
  :init
  (global-anzu-mode 1))

(use-package flx-isearch
  :bind (("C-s" . my/isearch-forward)
         ("C-r " . my/isearch-backward))
  :config
  (defun my/isearch-forward (&optional regexp-p no-recursive-edit)
    (interactive "P\np")
    (cond ((equal current-prefix-arg nil) (flx-isearch-forward))
          ((equal current-prefix-arg '(4)) (isearch-forward-regexp))
          (t (isearch-forward))))
  (defun my/isearch-backward (&optional regexp-p no-recursive-edit)
    (interactive "P\np")
    (cond ((equal current-prefix-arg nil) (flx-isearch-backward))
          ((equal current-prefix-arg '(4)) (isearch-backward-regexp))
          (t (isearch-backward)))))

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

Use flx-isearch in place of isearch by default


;;; web-programming.el --- Web programming configuration.
;;; Commentary:
;;; Code:

(use-package web-mode
  :ensure t
  :commands (web-mode)
  :mode
  (("\\.phtml\\'" . web-mode)
   ("\\.tpl\\.php\\'" . web-mode)
   ("\\.[agj]sp\\'" . web-mode)
   ("\\.as[cp]x\\'" . web-mode)
   ("\\.erb\\'" . web-mode)
   ("\\.mustache\\'" . web-mode)
   ("\\.djhtml\\'" . web-mode)
   ("\\.html?\\'" . web-mode))
  :config
  (progn
    (setq web-mode-css-indent-offset 2)
    (setq web-mode-code-indent-offset 4)
    (setq web-mode-comment-style 2)
    (setq web-mode-script-padding 0)
    (setq web-mode-enable-current-element-highlight t)
    (setq web-mode-engines-alist
          '(("django"    . "\\.html\\'"))
          )))

(use-package emmet-mode
  :ensure t
  :config
  (progn
    (add-hook 'web-mode-hook 'emmet-mode)))

(provide 'web-programming)
;;; web-programming.el ends here

;;; web-programming.el --- Web programming configuration.
;;; Commentary:
;;; Code:

(use-package web-mode
  :ensure t
  :commands (web-mode)
  :mode
  (("\\.phtml\\'" . web-mode)
   ("\\.tpl\\.php\\'" . web-mode)
   ("\\.[agj]sp\\'" . web-mode)
   ("\\.as[cp]x\\'" . web-mode)
   ("\\.erb\\'" . web-mode)
   ("\\.mustache\\'" . web-mode)
   ("\\.djhtml\\'" . web-mode)
   ("\\.html?\\'" . web-mode))
  :config
  (progn
    (setq web-mode-css-indent-offset 2)
    (setq web-mode-code-indent-offset 4)
    (setq web-mode-comment-style 2)
    (setq web-mode-script-padding 0)
    (setq web-mode-enable-current-element-highlight t)
    (setq web-mode-engines-alist
          '(("django"    . "\\.html\\'"))
          )))

;; electric pair and web mode have conflicts.
;; so, at least for now disable "{}" matching for electric pair
(setq electric-pair-inhibit-predicate
      (lambda (chr)
        (and (equal (format "%s" major-mode) "web-mode")
             (char-equal chr ?\{))))

;; Emmet!!!
(use-package emmet-mode
  :ensure t
  :config
  (progn
    (add-hook 'web-mode-hook 'emmet-mode)))

(provide 'web-programming)
;;; web-programming.el ends here

Remove `{' electric pair from web mode. This is a temporary change. Will try a way to fix it.


;;; config/default/autoload/deferred.el -*- lexical-binding: t; -*-

;; TODO generalize this
;;;###autoload
(defun +default/lsp-command-map ()
  "Lazily invoke `lsp-command-map'."
  (interactive)
  (require 'lsp-mode)
  (map! :leader "c l" lsp-command-map)
  (dolist (leader-key (list doom-leader-key doom-leader-alt-key))
    (let ((lsp-keymap-prefix (concat leader-key " c l")))
      (lsp-enable-which-key-integration)))
  (setq prefix-arg current-prefix-arg
        unread-command-events
        (mapcar (lambda (e) (cons t e))
                (vconcat (when evil-this-operator
                           (where-is-internal evil-this-operator
                                              evil-normal-state-map
                                              t))
                         (this-command-keys)))))

;;; config/default/autoload/deferred.el -*- lexical-binding: t; -*-

;; TODO generalize this
;;;###autoload
(defun +default/lsp-command-map ()
  "Lazily invoke `lsp-command-map'."
  (interactive)
  (require 'lsp-mode)
  (map! :leader "c l" lsp-command-map)
  (dolist (leader-key (list doom-leader-key doom-leader-alt-key))
    (let ((lsp-keymap-prefix (concat leader-key " c l")))
      (lsp-enable-which-key-integration)))
  (setq prefix-arg current-prefix-arg
        unread-command-events
        (mapcar (lambda (e) (cons t e))
                (vconcat (when (and (fboundp 'evil-this-operator)
                                    evil-this-operator)
                           (where-is-internal evil-this-operator
                                              evil-normal-state-map
                                              t))
                         (this-command-keys)))))

Fix non evil environment (void variable evil this operator)


;;; markdown-conf.el -- Settings for markdown-mode.
(eval-when-compile (require 'markdown-mode))

(setq markdown-command "pandoc -f markdown -t html"
      markdown-follow-wiki-link-on-enter nil)

(defun pjones:markdown-mode-hook ()
  "Set up key bindings and other crap for markdown-mode."
  (local-set-key (kbd "C-c C-o") 'markdown-follow-link-at-point)

  ;; Files in /tmp that are *.txt are from my browser and most
  ;; websites don't like it when text you submit has newlines.
  (when (string-match "^/tmp/.*\\.txt$" (buffer-file-name))
    (longlines-mode)))

(add-hook 'markdown-mode-hook 'whitespace-mode)
(add-hook 'markdown-mode-hook 'pjones:markdown-mode-hook)

;;; markdown-conf.el -- Settings for markdown-mode.
(eval-when-compile
  (require 'markdown-mode))

(setq markdown-command "pandoc -f markdown -t html"
      markdown-follow-wiki-link-on-enter nil)

(defun pjones:markdown-mode-hook ()
  "Set up key bindings and other crap for markdown-mode."
  (local-set-key (kbd "C-c C-o") 'markdown-follow-link-at-point)

  ;; Files in /tmp that are *.txt are from my browser and most
  ;; websites don't like it when text you submit has newlines.
  (when (string-match "^/tmp/.*\\.txt$" (buffer-file-name))
    (visual-line-mode)))

(add-hook 'markdown-mode-hook 'whitespace-mode)
(add-hook 'markdown-mode-hook 'pjones:markdown-mode-hook)

Emacs: Use visual-line-mode instead of the deprecated longlines-mode


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

(doom!
    :completion
    (ivy +icons +prescient +fuzzy)
    (company +auto)

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

    :editor
    (evil +everywhere +commands)
    snippets
    file-templates
    multiple-cursors
    rotate-text
    fold

    :emacs
    (dired +icons)
    vc

    :tools
    lookup
    eval
    make
    magit
    lsp
    editorconfig
    pdf
    ein

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export)
    (cc +lsp)
    ocaml
    idris
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp)
    (fsharp +lsp)

    :checkers
    spell
    syntax

    :term
    vterm
    eshell

    :app
    ;;(email +gmail)    ; emacs as an email client
    ;;(rss +org)        ; emacs as an RSS reader
    (write            ; emacs as a word processor (latex + org + markdown)
        +wordnut         ; wordnet (wn) search
        +langtool)       ; a proofreader (grammar/style check) for Emacs

    )

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

(doom!
    :completion
    (ivy +icons +prescient +fuzzy)
    (company +auto)

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

    :editor
    (evil +everywhere +commands)
    snippets
    file-templates
    multiple-cursors
    rotate-text
    fold

    :emacs
    (dired +icons)
    vc

    :tools
    lookup
    eval
    make
    magit
    lsp
    editorconfig
    pdf
    ein

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export)
    (cc +lsp)
    ocaml
    idris
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp)
    (fsharp +lsp)

    :checkers
    spell
    syntax

    :term
    vterm
    eshell

    :app
    ;;(email +gmail)    ; emacs as an email client
    ;;(rss +org)        ; emacs as an RSS reader
    )

Disable emacs doom :app write, replaced by :ui zen


;; backup in one place. flat, no tree structure
;; http://ergoemacs.org/emacs/emacs_set_backup_into_a_directory.html
(setq backup-directory-alist '(("" . "~/.emacs.d/emacs-backup")))

;; setup for installing markdown-mode
;; https://jblevins.org/projects/markdown-mode/
(require 'package)
(add-to-list 'package-archives
	     '("melpa-stable"
	       . "https://stable.melpa.org/packages/"))
(package-initialize)

Add Melpa package repo for markdown-mode installation


(when (maybe-require-package 'projectile-rails)
  (after-load 'projectile
    (add-hook 'projectile-mode-hook 'projectile-rails-on)
    (after-load 'guide-key
      (add-to-list 'guide-key/guide-key-sequence "C-c r"))))

(provide 'init-rails)

(when (maybe-require-package 'projectile-rails)
  (after-load 'projectile
    (add-hook 'projectile-mode-hook 'projectile-rails-on)
    (after-load 'guide-key
      (add-to-list 'guide-key/guide-key-sequence "C-c r")
      (add-to-list 'guide-key/guide-key-sequence "C-c r !")
      (add-to-list 'guide-key/guide-key-sequence "C-c r g"))))

(provide 'init-rails)

Add more guide-key sequences for projectile-rails


;; Time-stamp: <2018-05-24 11:56:21 kmodi>

;; Nim
;; https://github.com/nim-lang/nim-mode

(use-package nim-mode
  :ensure t
  :mode (("\\.nim\\'" . nim-mode))
  :config
  (progn
    (bind-chords
     :map nim-mode-map
     ("??" . devdocs-lookup))
    (with-eval-after-load 'smart-compile
      (add-to-list 'smart-compile-alist
                   '(nim-mode . "nim c --verbosity:0 %f")))

    (when (executable-find "nimsuggest")
      (setq nim-nimsuggest-path (executable-find "nimsuggest"))
      ;; Currently nimsuggest doesn't support nimscript files, so only nim-mode ..
      ;; nimsuggest will provide hints in the minibuffer using `eldoc-mode'.
      (add-hook 'nim-mode-hook #'nimsuggest-mode)
      ;; (remove-hook 'nim-mode-hook #'nimsuggest-mode)
      )

    (use-package ob-nim
      :ensure t
      :config
      (progn
        (with-eval-after-load 'setup-org
          (add-to-list 'modi/ob-enabled-languages "nim" :append))))))

(provide 'setup-nim)

;; Time-stamp: <2018-06-19 12:13:42 kmodi>

;; Nim
;; https://github.com/nim-lang/nim-mode

(use-package nim-mode
  :ensure t
  :mode (("\\.nim\\'" . nim-mode))
  :config
  (progn
    (bind-chords
     :map nim-mode-map
     ("??" . devdocs-lookup))
    (with-eval-after-load 'smart-compile
      (add-to-list 'smart-compile-alist
                   ;; Devel build of nim is needed for --nep1:on
                   ;; switch support.
                   '(nim-mode . "nim c --verbosity:0 --nep1:on %f")))

    (when (executable-find "nimsuggest")
      (setq nim-nimsuggest-path (executable-find "nimsuggest"))
      ;; Currently nimsuggest doesn't support nimscript files, so only nim-mode ..
      ;; nimsuggest will provide hints in the minibuffer using `eldoc-mode'.
      (add-hook 'nim-mode-hook #'nimsuggest-mode)
      ;; (remove-hook 'nim-mode-hook #'nimsuggest-mode)
      )

    (use-package ob-nim
      :ensure t
      :config
      (progn
        (with-eval-after-load 'setup-org
          (add-to-list 'modi/ob-enabled-languages "nim" :append))))))

(provide 'setup-nim)

Add --nep1:on switch to smart-compile-alist for nim


;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((indent-tabs-mode . nil)
         (fill-column . 80)))
 (c++-mode . ((page-delimiter . "^///")
              (mode . subword)))
 (c-mode . ((page-delimiter . "^///")
            (mode . subword))))

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((indent-tabs-mode . nil)
         (fill-column . 80)))
 (c++-mode . ((page-delimiter . "^///")
              (mode . subword)))
 (c-mode . ((page-delimiter . "^///")
            (mode . subword)))
 ("elisp/runfiles/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../")))))
 ("examples/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../" "./" "ext/" "../bazel-bin/")))))
 ("tests/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../")))))
 ("tests/pkg/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path . ("../../")))))))

Add necessary load paths to make Flymake work


;;;; LEDGER SETTINGS

(use-package ledger-mode
  :ensure t)

(add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))

(provide 'init-ledger)

;;;; LEDGER SETTINGS

(use-package ledger-mode
  :ensure t)

(add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))

;; Use ISO-8601 date formats, for sh*t's sake
(setq ledger-use-iso-dates t)

(provide 'init-ledger)

Set ledger-mode's date format to ISO-8601


(require-package 'haskell-mode)

(add-hook 'haskell-mode-hook
          (lambda ()
            (define-key haskell-mode-map (kbd "C-c h") 'hoogle)
            (turn-on-haskell-doc-mode)
            (turn-on-haskell-indent)))

(eval-after-load 'haskell-mode
  '(define-key haskell-mode-map (kbd "RET") 'newline))

(require-package 'ghci-completion)
(add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)

(require-package 'flymake-hlint)
(add-hook 'haskell-mode-hook #'flymake-hlint-load)

(provide 'init-haskell)

(require-package 'haskell-mode)

(dolist (hook '(haskell-mode-hook inferior-haskell-mode-hook))
  (add-hook hook 'turn-on-haskell-doc-mode))

(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)

(eval-after-load 'haskell-mode
  '(progn
     (define-key haskell-mode-map (kbd "C-c h") 'hoogle)
     (define-key haskell-mode-map (kbd "RET") 'newline)))

(require-package 'ghci-completion)
(add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)

(require-package 'flymake-hlint)
(add-hook 'haskell-mode-hook #'flymake-hlint-load)

(provide 'init-haskell)

Enable more functionality in inferior-haskell-mode


;; JS Mode

(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))

;; * JS Mode

(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))

;; ** Flycheck

(setq js2-strict-missing-semi-warning nil)

[Emacs] Remove JS2 mode missing semicolon warning


;;; keybinds.el --- For miscellaneous keybindings that don't fit elsewhere

(setq leader "SPC"
      leader-double "SPC SPC"
      fallback-leader "C-c C-d"  ; Fallback used when evil is inactive
      fallback-leader-double "C-c C-d C-d")

(defmacro leader-map (&rest maps)
  "Assign the given maps with prefix leader in evil normal mode and
fallback-leader elsewhere."
  `(progn
     (general-define-key :keymaps 'evil-normal-state-map
                         :prefix leader
                         ,@maps)
     (general-define-key :prefix fallback-leader
                         ,@maps)))

(leader-map "f" 'find-file
            "d" 'switch-to-buffer)

(global-set-key (kbd "<f2>") 'base-lib/echo-major-mode)
(global-set-key (kbd "<f9>") 'base-lib/open-emacs-config)
(global-set-key (kbd "<f12>") 'base-lib/list-packages)

(provide 'keybinds)

;;; keybinds.el ends here

;;; keybinds.el --- For miscellaneous keybindings that don't fit elsewhere

(setq leader "SPC"
      leader-double "SPC SPC"
      fallback-leader "C-c C-d"  ; Fallback used when evil is inactive
      fallback-leader-double "C-c C-d C-d")

(defun leader-map (&rest maps)
  "Assign the given maps with prefix leader in evil normal mode and
fallback-leader elsewhere."
  (apply 'general-define-key
         :keymaps 'evil-normal-state-map
         :prefix leader
         maps)
  (apply 'general-define-key
         :prefix fallback-leader
         maps))

(leader-map "f" 'find-file
            "d" 'switch-to-buffer)

(global-set-key (kbd "<f2>") 'base-lib/echo-major-mode)
(global-set-key (kbd "<f9>") 'base-lib/open-emacs-config)
(global-set-key (kbd "<f12>") list-packages)

(provide 'keybinds)

;;; keybinds.el ends here

Make leader-map not a macro; fix misnamed function


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

(use-package! dart-mode
  :when (featurep! +lsp)
  :hook (dart-mode-local-vars . lsp!)
  :config
  (when (and (featurep! +flutter) IS-LINUX)
    (when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk"))
      (setq flutter-sdk-path path))))

(use-package! flutter
  :when (featurep! +flutter)
  :defer t
  :config
  (map! :map dart-mode-map
        :localleader
        "r" #'flutter-run-or-hot-reload))

(use-package! hover
  :when (featurep! +flutter)
  :defer t
  :config
  (map! :map dart-mode-map
        :localleader
        "h r" #'hover-run-or-hot-reload
        "h R" #'hover-run-or-hot-restart))

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

(use-package! dart-mode
  :when (featurep! +lsp)
  :hook (dart-mode-local-vars . lsp!)
  :config
  (when (and (featurep! +flutter) IS-LINUX)
    (when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk"))
      (setq flutter-sdk-path path)))
  (set-pretty-symbols! '(dart-mode)
    ;; Functional
    :def "Function"
    :lambda "() =>"
    ;; Types
    :null "null"
    :true "true" :false "false"
    :int "int" :float "double"
    :str "String"
    :bool "bool"
    :list "List"
    ;; Flow
    :not "!"
    :in "in"
    :and "&&" :or "||"
    :for "for"
    :return "return"
    ;; Other
    :yield "yield"))

(use-package! flutter
  :when (featurep! +flutter)
  :defer t
  :config
  (map! :map dart-mode-map
        :localleader
        "r" #'flutter-run-or-hot-reload))

(use-package! hover
  :when (featurep! +flutter)
  :defer t
  :config
  (map! :map dart-mode-map
        :localleader
        "h r" #'hover-run-or-hot-reload
        "h R" #'hover-run-or-hot-restart))

Set pretty symbols for Dart-mode

Set pretty symbols for Dart-mode


;; =============================================================================
;; Color Theme
;; -----------------------------------------------------------------------------

;; (if (> (display-color-cells) 256)
;;     (load-theme 'monokai t)
;;   (load-theme 'jazz t))

;; (progn
;;   (add-to-list 'custom-theme-load-path (concat user-emacs-directory "themes/color-theme-mgl"))
;;   (load-theme 'mgl-dark t))

;; (load-theme 'spacegray t)
;; (load-theme 'spacemacs-light t)
;; (load-theme 'spacemacs-dark t)
;; (load-theme 'zerodark t)

(use-package monokai-theme
  :ensure t
  :init
  (load-theme 'monokai t))

;; =============================================================================
;; Color Theme
;; -----------------------------------------------------------------------------

;; (if (> (display-color-cells) 256)
;;     (load-theme 'monokai t)
;;   (load-theme 'jazz t))

;; (progn
;;   (add-to-list 'custom-theme-load-path (concat user-emacs-directory "themes/color-theme-mgl"))
;;   (load-theme 'mgl-dark t))

;; (load-theme 'spacegray t)
;; (load-theme 'spacemacs-light t)
;; (load-theme 'spacemacs-dark t)
;; (load-theme 'zerodark t)

(use-package monokai-theme
  :ensure t
  :init
  (load-theme 'monokai t)

  (setq
   ;; foreground and background
   monokai-foreground     "#F8F8F2"
   monokai-background     "#272822"
   ;; highlights and comments
   monokai-comments       "#75715E"
   monokai-emphasis       "#F8F8F0"
   monokai-highlight      "#49483E"
   monokai-highlight-alt  "#3E3D31"
   monokai-highlight-line "#3C3D37"
   monokai-line-number    "#8F908A"
   ;; colours
   monokai-blue           "#66D9EF"
   monokai-cyan           "#A1EFE4"
   monokai-green          "#A6E22E"
   monokai-gray           "#64645E"
   monokai-violet         "#AE81FF"
   monokai-red            "#F92672"
   monokai-orange         "#FD971F"
   monokai-yellow         "#E6DB74"
   ))

Add current customisable monokai theme colours into config with their default values


(req-package insert-shebang
  :init
  (setq insert-shebang-file-types
         '(("py" . "python")
           ("sh" . "bash")
           ("pl" . "perl")
           ("rb" . "ruby")))
  :config
  (add-hook 'find-file-hook 'insert-shebang))

(req-package insert-shebang
  :init
  (setq insert-shebang-file-types
         '(("py" . "python")
           ("sh" . "bash")
           ("pl" . "perl")
           ("rb" . "ruby")))
  (setq insert-shebang-track-ignored-filename nil)
  :config
  (add-to-list 'find-file-not-found-functions 'insert-shebang))

Insert shebang on new file only

Insert shebang on new file only


((c-mode . ((c-file-style . "GNU")
            (indent-tabs-mode . nil)
            (c-basic-offset . 8)
            (tab-width . 8)
            (show-trailing-whitespace . t)))
(vala-mode . ((c-file-style . "GNU")
              (indent-tabs-mode . nil)
              (c-basic-offset . 2)
              (tab-width . 2)
              (show-trailing-whitespace . t))))

((c-mode . ((c-file-style . "GNU")
            (indent-tabs-mode . nil)
            (c-basic-offset . 8)
            (tab-width . 8)
            (show-trailing-whitespace . t)))
(c++-mode . ((c-file-style . "GNU")
             (indent-tabs-mode . nil)
             (c-basic-offset . 8)
             (tab-width . 8)
             (show-trailing-whitespace . t)))
(vala-mode . ((c-file-style . "GNU")
              (indent-tabs-mode . nil)
              (c-basic-offset . 2)
              (tab-width . 2)
              (show-trailing-whitespace . t))))

Adjust settings for C++ mode too

emacs: Adjust settings for C++ mode too


;; Make startup faster by reducing the frequency of garbage
;; collection.  The default is 800 kilobytes.  Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
(defconst emacs-start-time (current-time))
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

;; Make startup faster by reducing the frequency of garbage
;; collection.  The default is 800 kilobytes.  Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
(defconst emacs-start-time (current-time))
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
; should be fixed in Emacs 26.3+
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

Add fix for SSL error on elpa

emacs: Add fix for SSL error on elpa


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

;;
;; Plugins
;;

(def-package! solidity-mode
  :mode "\\.sol$"
  :init
    (setq solidity-solc-path "$HOME/.node_modules/bin/solcjs")
    (setq solidity-solium-path "$HOME/.node_modules/bin/solium")

    (setq solidity-flycheck-solc-checker-active t)
    (setq solidity-flycheck-solium-checker-active t)

    (setq flycheck-solidity-solc-addstd-contracts t)
  :config
    (setq solidity-comment-style 'slash))

(def-package! company-solidity
  :when (featurep! :completion company)
  :after solidity-mode
  :config
  (add-hook 'solidity-mode-hook
    (lambda ()
    (set (make-local-variable 'company-backends)
        (append '((company-solidity company-capf company-dabbrev-code))
        company-backends)))))

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

;;
;; Plugins
;;

(def-package! solidity-mode
  :mode "\\.sol$"
  :init
    (setq solidity-solc-path "~/.node_modules/lib/node_modules/solc/solcjs")
    (setq solidity-solium-path "~/.node_modules/lib/node_modules/solium/bin/solium.js")

    (setq solidity-flycheck-solc-checker-active t)
    (setq solidity-flycheck-solium-checker-active t)

    (setq flycheck-solidity-solc-addstd-contracts t)
  :config
    (setq solidity-comment-style 'slash))

(def-package! company-solidity
  :when (featurep! :completion company)
  :after solidity-mode
  :config
  (add-hook 'solidity-mode-hook
    (lambda ()
    (set (make-local-variable 'company-backends)
        (append '((company-solidity company-capf company-dabbrev-code))
        company-backends)))))

Fix solc and solium pathes

Fix solc and solium pathes

The bin files were links to the real thing.


(require 'flycheck)
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)

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

(require 'racer)
(setq racer-rust-src-path "/home/wilfred/src/rust/src")
(setq racer-cmd "/home/wilfred/src/racer/target/release/racer")

(add-to-list 'company-backends #'racer-company-complete)

(require 'rust-mode)
(add-hook 'rust-mode-hook #'racer-turn-on-eldoc)
(define-key rust-mode-map (kbd "M-.") #'racer-find-definition)

(provide 'rust-customisations)

(require 'flycheck)
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)

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

(require 'racer)
(setq racer-rust-src-path "/home/wilfred/src/rust/src")
(setq racer-cmd "/home/wilfred/src/racer/target/release/racer")

(add-to-list 'company-backends #'racer-company-complete)

(require 'rust-mode)
(add-hook 'rust-mode-hook #'racer-turn-on-eldoc)
(define-key rust-mode-map (kbd "M-.") #'racer-find-definition)

(defun wh/rust-toggle-visibility ()
  "Toggle the public visibility of the function at point."
  (interactive)
  (save-excursion
    ;; If we're already at the beginning of the function definition,
    ;; `beginning-of-defun' moves to the previous function, so move elsewhere.
    (end-of-line)

    (beginning-of-defun)
    (if (looking-at "pub ")
        (delete-char 4)
      (insert "pub "))))

(define-key rust-mode-map (kbd "C-c v") #'wh/rust-toggle-visibility)

(provide 'rust-customisations)

Allow toggling a function's visibility in Rust.


;; Time-stamp: <2015-06-22 09:40:27 kmodi>

;; magit
;; https://github.com/magit/magit

(use-package magit
  :commands (magit-status)
  :preface
  (progn
    (setq magit-last-seen-setup-instructions "1.4.0"))
  :config
  (progn
    (setq magit-completing-read-function #'magit-ido-completing-read)
    (setq magit-auto-revert-mode         nil)
    (setq magit-expand-staged-on-commit  nil) ; default = nil
    (setq magit-repo-dirs                `( ,user-emacs-directory))
    (setq magit-diff-options             nil) ; default
    ;; (setq magit-diff-options             '("--ignore-space-change"))

    ;; Make diffs not show whitespace difference when calling `magit-show-level-4'
    ;; using the bindings like `4' in magit Status buffer
    (defun modi/magit-ignore-whitespace-diff (orig-fun &rest args)
      (let ((magit-diff-options '("--ignore-space-change")))
        (apply orig-fun args)))
    (advice-add 'magit-show-level-4 :around #'modi/magit-ignore-whitespace-diff)

    (magit-auto-revert-mode -1)))

(provide 'setup-magit)

;; |---------+----------------------------------|
;; | Binding | Description                      |
;; |---------+----------------------------------|
;; | j n     | Jump to Untracked section        |
;; | j u     | Jump to Unstaged section         |
;; | j s     | Jump to Staged section           |
;; | j p     | Jump to Unpushed section         |
;; | M-p     | Jump to previous sibling section |
;; | M-n     | Jump to next sibling section     |
;; |---------+----------------------------------|

;; Tip: Adding prefix to above jump commands also expands those sections and
;; brings that section to the top of the buffer.
;;   So `C-u j s' is analogous to doing `j s C-l C-l 4`

;; Time-stamp: <2015-07-01 20:49:28 kmodi>

;; magit
;; https://github.com/magit/magit

(use-package magit
  :commands (magit-status))

(provide 'setup-magit)

;; |---------+----------------------------------|
;; | Binding | Description                      |
;; |---------+----------------------------------|
;; | j n     | Jump to Untracked section        |
;; | j u     | Jump to Unstaged section         |
;; | j s     | Jump to Staged section           |
;; | j p     | Jump to Unpushed section         |
;; | M-p     | Jump to previous sibling section |
;; | M-n     | Jump to next sibling section     |
;; |---------+----------------------------------|

;; Tip: Adding prefix to above jump commands also expands those sections and
;; brings that section to the top of the buffer.
;;   So `C-u j s' is analogous to doing `j s C-l C-l 4`

Remove all old magit (v1.x) var customization


;; multiple selection
(global-set-key (kbd "M-n") 'mc/mark-next-like-this)
(global-set-key (kbd "M-p") 'mc/mark-previous-like-this)

;; move lines
(global-set-key (kbd "M-S-<up>") 'drag-stuff-up)
(global-set-key (kbd "M-S-<down>") 'drag-stuff-down)

;; move between windows
(global-set-key (kbd "M-<left>") 'windmove-left)
(global-set-key (kbd "M-<right>") 'windmove-right)
(global-set-key (kbd "M-<up>") 'windmove-up)
(global-set-key (kbd "M-<down>") 'windmove-down)

;; comment line or region
(global-set-key (kbd "s-/") 'comment-line)

;; project structure
(global-set-key [f3] 'neotree-toggle)

;; magit
(global-set-key (kbd "C-x g") 'magit-status)

Add keybinding for magit status

Add keybinding for magit status


(eval-after-load "package"
  '(progn
     (when (> emacs-major-version 23)
       (add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/")))

     (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
     (add-to-list 'package-archives '("technomancy" . "http://repo.technomancy.us/emacs"))
))

(provide 'init-elpa)

(eval-after-load "package"
  '(progn
     (when (> emacs-major-version 23)
       (add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/")))
    (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
))

(provide 'init-elpa)

Drop reference to technomancy's defunct elpa archive


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

(doom!
    :completion
    (ivy +icons +prescient +fuzzy)
    (company +auto)

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

    :editor
    (evil +everywhere +commands)
    snippets
    file-templates
    multiple-cursors
    rotate-text
    fold

    :emacs
    (dired +icons)
    vc

    :tools
    lookup
    eval
    make
    magit
    lsp
    editorconfig
    pdf
    ein

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export)
    (cc +lsp)
    ocaml
    idris
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp)
    (fsharp +lsp)

    :checkers
    spell
    syntax

    :term
    vterm
    eshell

    :app
    ;;(email +gmail)    ; emacs as an email client
    ;;(rss +org)        ; emacs as an RSS reader
    )

;; Needs to be set early so it can't go into config
(setq evil-respect-visual-line-mode t)

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

(doom!
    :completion
    (ivy +icons +prescient +fuzzy)
    (company +auto)

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

    :editor
    (evil +everywhere +commands)
    snippets
    file-templates
    multiple-cursors
    rotate-text
    fold

    :emacs
    (dired +icons)
    vc

    :tools
    lookup
    eval
    make
    magit
    lsp
    editorconfig
    pdf
    ein

    :lang
    (sh +fish)
    emacs-lisp
    markdown
    (haskell +lsp)
    (org
        +attach
        +babel
        +export)
    (cc +lsp)
    ocaml
    idris
    (web +html +css)
    (latex +latexmk +viewers)
    (python +lsp)
    (fsharp +lsp)
    (javascript +lsp)
    rest

    :checkers
    spell
    syntax

    :term
    vterm
    eshell

    :app
    ;;(email +gmail)    ; emacs as an email client
    ;;(rss +org)        ; emacs as an RSS reader
    )

;; Needs to be set early so it can't go into config
(setq evil-respect-visual-line-mode t)

Add javascript and rest modules to doom emacs


(use-package company
  :defer 2
  :diminish company-mode
  :config (global-company-mode t))

;; C
(use-package irony
  :defer 2
  :diminish irony-mode
  :config
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'objc-mode-hook 'irony-mode)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

  (add-hook 'c-mode-hook
    (lambda () (local-set-key (kbd "<tab>") #'company-complete)
      (local-set-key (kbd "C-SPC") #'company-complete-selection))))

(use-package company-irony-c-headers
  :defer 2
  :config
  (eval-after-load 'company
    '(add-to-list
       'company-backends '(company-irony-c-headers company-irony))))

(use-package company
  :defer 2
  :diminish company-mode
  :config (global-company-mode t)

  (add-hook 'c-mode-hook
    (lambda () (local-set-key (kbd "<tab>") #'company-complete)
      (local-set-key (kbd "C-SPC") #'company-complete-selection))))

;; C
(use-package irony
  :defer 2
  :diminish irony-mode
  :config
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'objc-mode-hook 'irony-mode)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options))

(use-package company-irony-c-headers
  :defer 2
  :config
  (eval-after-load 'company
    '(add-to-list
       'company-backends '(company-irony-c-headers company-irony))))

Emacs: Configure company-complete keybinding and irony autosetup


(require-package 'haskell-mode)
(setq haskell-font-lock-symbols t)

(add-hook 'haskell-mode-hook
          (lambda ()
            (define-key haskell-mode-map (kbd "C-c h") 'hoogle)
            (turn-on-haskell-doc-mode)
            (turn-on-haskell-indent)))

(provide 'init-haskell)

(require-package 'haskell-mode)
(setq haskell-font-lock-symbols t)

(add-hook 'haskell-mode-hook
          (lambda ()
            (define-key haskell-mode-map (kbd "C-c h") 'hoogle)
            (turn-on-haskell-doc-mode)
            (turn-on-haskell-indent)))

(require-package 'flymake-hlint)
(add-hook 'haskell-mode-hook #'flymake-hlint-init)

(provide 'init-haskell)

Use my new flymake-hlint with haskell source


;;; magit-conf.el -- Customizations for magit.
(eval-when-compile
  (defvar magit-last-seen-setup-instructions)
  (setq magit-last-seen-setup-instructions "1.4.0")
  (require 'magit))

(custom-set-variables
 '(magit-popup-use-prefix-argument 'default))

;; Shamelessly stolen from http://whattheemacsd.com/.
(defadvice magit-status (around magit-fullscreen activate)
  (window-configuration-to-register :magit-fullscreen)
  ad-do-it
  (delete-other-windows))

(defun pjones:magit-quit-session ()
  "Restore the previous window configuration and kill the magit
buffer."
  (interactive)
  (kill-buffer)
  (jump-to-register :magit-fullscreen))

(define-key magit-status-mode-map (kbd "q") 'pjones:magit-quit-session)

;;; magit-conf.el -- Customizations for magit.
(eval-when-compile
  (defvar magit-last-seen-setup-instructions)
  (setq magit-last-seen-setup-instructions "1.4.0")
  (require 'magit))

(custom-set-variables
 '(magit-popup-use-prefix-argument 'default))

;; Shamelessly stolen from http://whattheemacsd.com/.
;; (defadvice magit-status (around magit-fullscreen activate)
;;   (window-configuration-to-register :magit-fullscreen)
;;   ad-do-it
;;   (delete-other-windows))
;;
;; (defun pjones:magit-quit-session ()
;;   "Restore the previous window configuration and kill the magit
;; buffer."
;;   (interactive)
;;   (kill-buffer)
;;   (jump-to-register :magit-fullscreen))
;;
;; (define-key magit-status-mode-map (kbd "q") 'pjones:magit-quit-session)

Comment out some older magit advice for now


(setq-default grep-highlight-matches t
              grep-scroll-output t)

(when *is-a-mac*
  (setq-default locate-command "mdfind"))

(when (executable-find "ag")
  (require-package 'ag)
  (require-package 'wgrep-ag)
  (setq-default ag-highlight-search t)
  (global-set-key (kbd "M-?") 'ag-project))

(provide 'init-grep)

(setq-default grep-highlight-matches t
              grep-scroll-output t)

(when *is-a-mac*
  (setq-default locate-command "mdfind"))

(when (and (executable-find "ag")
           (maybe-require-package 'ag))
  (require-package 'wgrep-ag)
  (setq-default ag-highlight-search t)
  (global-set-key (kbd "M-?") 'ag-project))

(when (and (executable-find "rg")
           (maybe-require-package 'rg))
  (global-set-key (kbd "M-?") 'rg-project))

(provide 'init-grep)

Install rg.el if "rg" is available

Install rg.el if "rg" is available


;;; init-coffee.el -- coffeescript setup

;;; Commentary:
;;; Coffee and related stuff

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

(use-package coffee-mode
  :mode ("\\.coffee\\'" . coffee-mode))

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

;;; init-coffee.el -- coffeescript setup

;;; Commentary:
;;; Coffee and related stuff

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

(defun my/coffee-evil-previousline-and-indent ()
  "Fix 'coffee-newline-and-indent' with 'evil-mode'."
  (interactive)
  (forward-line -1)
  (my/coffee-evil-newline-and-indent))

(defun my/coffee-evil-newline-and-indent ()
  "Fix 'coffee-newline-and-indent' with 'evil-mode'."
  (interactive)
  (end-of-line)
  (coffee-newline-and-indent)
  (evil-insert-state))

(use-package coffee-mode
  :config
  (evil-define-key 'normal coffee-mode-map "o" 'my/coffee-evil-newline-and-indent)
  (evil-define-key 'normal coffee-mode-map "O" 'my/coffee-evil-previousline-and-indent)
  (evil-define-key 'insert coffee-mode-map "RET" 'my/coffee-evil-newline-and-indent)
  :mode ("\\.coffee\\'" . coffee-mode))

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

Fix coffee-mode indentation in evil-mode


;;; tools/docker/config.el -*- lexical-binding: t; -*-

(after! docker
  (set-evil-initial-state!
    '(docker-container-mode
      docker-image-mode
      docker-network-mode
      docker-volume-mode
      docker-machine-mode)
    'emacs))

;;; tools/docker/config.el -*- lexical-binding: t; -*-

(after! docker
  (set-docsets! 'dockerfile-mode "Docker")
  (set-evil-initial-state!
    '(docker-container-mode
      docker-image-mode
      docker-network-mode
      docker-volume-mode
      docker-machine-mode)
    'emacs))

Use Docker docset for dockerfile-mode

Use Docker docset for dockerfile-mode

This patch setups the appropriate docset to use in dockerfile-mode.
Similar to how it is done for other major-modes that have associated
docsets.


(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)))
 '(global-display-line-numbers-mode t)
 '(ido-create-new-buffer 'always)
 '(ido-enable-flex-matching t)
 '(ido-everywhere t)
 '(ido-mode 'both nil (ido))
 '(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)))
(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)))
 '(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))
(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.
 )

Customize indentation behavior in Emacs

Customize indentation behavior in Emacs