;;; eglot-conf.el -- Settings for eglot
;;
;;; Commentary:
;;
;;; Code:
(require 'eglot)

(custom-set-variables
 '(eglot-auto-display-help-buffer nil)
 '(eglot-autoshutdown t))

(defvar pjones:eglot-doc-cleanup
  (list
   (list (rx (and "```haskell" ?\n (1+ (not (any ?:))) ?\n ":: ")
             (group (1+ (not (any ?`)))) ?\n "```") "`\\1`")
   (list (rx (1+ ?* (1+ (in space)))) "")
   (list (rx (and bol ?* ?\n)) ""))
  "List of regular expressions and replacement strings.
Used for cleaning up LSP server docs.")

(defun pjones:eglot-apply-doc-cleanup (string)
  "Clean STRING according to `pjones:eglot-doc-cleanup'."
  (let ((result string))
    (dolist (pat pjones:eglot-doc-cleanup)
      (while (string-match (car pat) result)
          (setq result (replace-match (cadr pat) nil nil result))))
    result))

(defun pjones:eglot--format-markup-advice (orig markup)
  "Clean docs from naughty LSP servers.
Call ORIG after modifying MARKUP"
  (let ((clean (pjones:eglot-apply-doc-cleanup (plist-get markup :value))))
    (apply orig (list (plist-put markup :value clean)))))
(advice-add
 'eglot--format-markup
 :around #'pjones:eglot--format-markup-advice)

(defun pjones:eglot--snippet-expansion-fn ()
  "Keep eglot from using yasnippet."
  nil)
(advice-add
 'eglot--snippet-expansion-fn
 :override #'pjones:eglot--snippet-expansion-fn)

;;; eglot-conf.el ends here

;;; eglot-conf.el -- Settings for eglot
;;
;;; Commentary:
;;
;;; Code:
(require 'eglot)

(custom-set-variables
 '(eglot-autoshutdown t))

(defun pjones:eglot--snippet-expansion-fn ()
  "Keep eglot from using yasnippet."
  nil)
(advice-add
 'eglot--snippet-expansion-fn
 :override #'pjones:eglot--snippet-expansion-fn)

;;; eglot-conf.el ends here

Remove deprecated options and dead code

eglot: Remove deprecated options and dead code


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

(defconst mfa-treemacs-packages '(treemacs))

(defun mfa-treemacs/post-init-treemacs ()
  (with-eval-after-load 'treemacs
    ;; Adjust icon sizes to the DPI of the display.
    (spacemacs|do-after-display-system-init
     (treemacs-resize-icons (* 22 (display-scaling-factor))))

    ;; Fixes icon background color. It's broken because Treemacs only adjusts it
    ;; as an after hook of `enable-theme', but due to lazy loading the theme
    ;; will have enabled long before treemacs gets loaded. See also:
    ;; https://github.com/Alexander-Miller/treemacs/issues/148
    (treemacs--setup-icon-background-colors)

    ;; Enhance the visibility of the currently selected line.
    (treemacs-fringe-indicator-mode t)

    ;; Moving the root with h/l is non-sensical to me. This rebinds them to
    ;; functionality that, to me, seems more intuitive to be bound to those
    ;; keys.
    (define-key evil-treemacs-state-map "l" #'treemacs-RET-action)
    (define-key evil-treemacs-state-map "h" #'treemacs-goto-parent-node)))

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

(defconst mfa-treemacs-packages '(treemacs treemacs-evil))

(defun mfa-treemacs/post-init-treemacs ()
  (with-eval-after-load 'treemacs
    ;; Adjust icon sizes to the DPI of the display.
    (spacemacs|do-after-display-system-init
     (treemacs-resize-icons (* 22 (display-scaling-factor))))

    ;; Fixes icon background color. It's broken because Treemacs only adjusts it
    ;; as an after hook of `enable-theme', but due to lazy loading the theme
    ;; will have enabled long before treemacs gets loaded. See also:
    ;; https://github.com/Alexander-Miller/treemacs/issues/148
    (treemacs--setup-icon-background-colors)

    ;; Enhance the visibility of the currently selected line.
    (treemacs-fringe-indicator-mode t)))

(defun mfa-treemacs/post-init-treemacs-evil ()
  (with-eval-after-load 'treemacs-evil
    ;; Moving the root with h/l is non-sensical to me. This rebinds them to
    ;; functionality that, to me, seems more intuitive to be bound to those
    ;; keys.
    (evil-define-key 'treemacs treemacs-mode-map (kbd "h") #'treemacs-goto-parent-node)
    (evil-define-key 'treemacs treemacs-mode-map (kbd "l") #'treemacs-RET-action)))

Fix customizations of Treemacs key bindings

The customized key bindings for "h/l" did not take effect until this change.


;;; 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))

;; 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)

Fix an issue with magit

Fix an issue with magit


(require 'cc-mode)
(require 'semantic)

(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(global-semantic-stickyfunc-mode 1)
(semantic-mode 1)

(defun rz/cedet-hook ()
  (evil-leader/set-key
    "j" 'semantic-ia-fast-jump
    "cs" 'semantic-ia-show-summary))

(add-hook 'c-mode-common-hook 'rz/cedet-hook)
(add-hook 'c-mode-hook 'rz/cedet-hook)
(add-hook 'c++-mode-hook 'rz/cedet-hook)

(require 'ede)
(global-ede-mode)

(provide 'cedet-settings)

(require 'cc-mode)
(require 'semantic)

(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(global-semantic-stickyfunc-mode 1)
(semantic-mode 1)

(defun rz/cedet-hook ()
  (evil-leader/set-key
    "j" 'semantic-ia-fast-jump
    "cs" 'semantic-ia-show-summary
    "ci" 'helm-semantic-or-imenu))

(add-hook 'c-mode-common-hook 'rz/cedet-hook)
(add-hook 'c-mode-hook 'rz/cedet-hook)
(add-hook 'c++-mode-hook 'rz/cedet-hook)

(require 'ede)
(global-ede-mode)

(provide 'cedet-settings)

Add a command to display helm semantic or imenu


;; Time-stamp: <2015-10-09 16:49:24 kmodi>

;; Paradox
;; https://github.com/Malabarba/paradox

(use-package paradox
  :commands (package-list-packages
             paradox-list-packages hydra-launch/paradox-list-packages-and-exit)
  :config
  (progn
    ;; The "paradox-token" file is supposed to contain this line:
    ;;     (setq paradox-github-token "<YOUR_TOKEN>")
    (load (locate-user-emacs-file "paradox-token") :noerror :nomessage)
    (setq paradox-lines-per-entry 1)
    (setq paradox-automatically-star t)

    (paradox-enable)))

(provide 'setup-paradox)

;; Time-stamp: <2015-10-14 16:24:24 kmodi>

;; Paradox
;; https://github.com/Malabarba/paradox

(use-package paradox
  :commands (package-list-packages
             paradox-list-packages
             hydra-launch/paradox-list-packages-and-exit)
  :config
  (progn
    ;; The "paradox-token" file is supposed to contain this line:
    ;;     (setq paradox-github-token "<YOUR_TOKEN>")
    (load (locate-user-emacs-file "paradox-token") :noerror :nomessage)

    (setq paradox-lines-per-entry 1)
    (setq paradox-automatically-star t)

    (define-key paradox--filter-map "k" nil) ; Unbind redundant key

    (defhydra hydra-paradox-filter (:color blue
                                    :hint nil)
      "
_f_ilter                 filter _r_egexp            _i_nstalled      _d_ependencies
g_n_u elpa packages      available _u_pgrades       _a_vailable      _c_lear filter
_m_elpa packages         packages with _s_tars      _b_uilt-in
"
      ("f" package-menu-filter)
      ("n" (package-menu-filter "arc:gnu"))
      ("m" (package-menu-filter "arc:melpa"))
      ("r" paradox-filter-regexp)
      ("u" paradox-filter-upgrades)
      ("s" paradox-filter-stars)
      ("i" (package-menu-filter "status:installed"))
      ("a" (package-menu-filter "status:available"))
      ("b" (package-menu-filter "status:built-in"))
      ("d" (package-menu-filter "status:dependency"))
      ("c" paradox-filter-clear)
      ("g" paradox-filter-clear)
      ("q" nil "cancel" :color blue))
    (bind-key "f" #'hydra-paradox-filter/body paradox-menu-mode-map)

    (paradox-enable)))

(provide 'setup-paradox)

Add hydra-paradox-filter, bound to "f" key


;;;; lk/customipaczations.el -- custom functions which make using emacs easier
;;; Commentary:
;;; If stuff grows too big, move it out to a separate file
;;; Code:

;; Editing helpers

(defun lk/count-buffers ()
  (length (buffer-list)))

;; OSX stuff, make sure alt is meta in GUI emacs
(defun mac-switch-meta nil
  "switch meta between Option and Command"
  (interactive)
  (if (eq mac-option-modifier nil)
      (progn
        (setq mac-option-modifier 'meta)
        (setq mac-command-modifier 'hyper))
    (progn
      (setq mac-option-modifier nil)
      (setq mac-command-modifier 'meta))))
(mac-switch-meta)
(mac-switch-meta)

(use-package sane-term
    :ensure t
	  :bind (( "C-x n t" . sane-term)
           ("C-x n T" . sane-term-create)))

(global-set-key (kbd "C-x n e") 'eshell)

(provide 'lk/customizations)
;;; customizations.el ends here

;;;; lk/customipaczations.el -- custom functions which make using emacs easier
;;; Commentary:
;;; If stuff grows too big, move it out to a separate file
;;; Code:

;; Editing helpers

(defun lk/count-buffers ()
  (length (buffer-list)))

;; OSX stuff, make sure alt is meta in GUI emacs
(defun mac-switch-meta nil
  "switch meta between Option and Command"
  (interactive)
  (if (eq mac-option-modifier nil)
      (progn
        (setq mac-option-modifier 'meta)
        (setq mac-command-modifier 'hyper))
    (progn
      (setq mac-option-modifier nil)
      (setq mac-command-modifier 'meta))))

(when (string-equal system-type "darwin")
  (mac-switch-meta)
  (mac-switch-meta))

(use-package sane-term
    :ensure t
	  :bind (( "C-x n t" . sane-term)
           ("C-x n T" . sane-term-create)))

(global-set-key (kbd "C-x n e") 'eshell)

(provide 'lk/customizations)
;;; customizations.el ends here

Make it work with Linux

[emacs] Make it work with Linux


;;; Character sets

(defcustom sanityinc/force-default-font-for-symbols nil
  "When non-nil, force Emacs to use your default font for symbols."
  :type 'boolean)

(defun sanityinc/maybe-use-default-font-for-symbols ()
  "Force Emacs to render symbols using the default font, if so configured."
  (when sanityinc/force-default-font-for-symbols
    (set-fontset-font "fontset-default" 'symbol (face-attribute 'default :family))))

(add-hook 'after-init-hook 'sanityinc/maybe-use-default-font-for-symbols)

;;; Changing font sizes

(require-package 'default-text-scale)
(global-set-key (kbd "C-M-=") 'default-text-scale-increase)
(global-set-key (kbd "C-M--") 'default-text-scale-decrease)

(provide 'init-fonts)

;;; Character sets

(defcustom sanityinc/force-default-font-for-symbols nil
  "When non-nil, force Emacs to use your default font for symbols."
  :type 'boolean)

(defun sanityinc/maybe-use-default-font-for-symbols ()
  "Force Emacs to render symbols using the default font, if so configured."
  (when sanityinc/force-default-font-for-symbols
    (set-fontset-font "fontset-default" 'symbol (face-attribute 'default :family))))

(add-hook 'after-init-hook 'sanityinc/maybe-use-default-font-for-symbols)

;;; Changing font sizes

(require-package 'default-text-scale)
(global-set-key (kbd "C-M-=") 'default-text-scale-increase)
(global-set-key (kbd "C-M--") 'default-text-scale-decrease)

(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font (frame-parameter nil 'font)
                    charset (font-spec :family "STHeiti")))
(setq face-font-rescale-alist '(("STHeiti" . 1.2)))
;;; (setq face-font-rescale-alist '(("Menlo" . 1.2) ("WenQuanYi Zen Hei" . 1.2)))

(provide 'init-fonts)

Add Asian fonts fix for OSX

Add Asian fonts fix for OSX


(setq lsp-modeline-code-actions-segments '(count name))

(setq lsp-rust-clippy-preference "on")

(set-face-attribute 'lsp-lsp-flycheck-warning-unnecessary-face nil :foreground nil)

;; Don't override my navigation bindings.
(define-key lsp-signature-mode-map (kbd "M-n") nil)
(define-key lsp-signature-mode-map (kbd "M-p") nil)

Fix M-n and M-p when LSP is active

Fix M-n and M-p when LSP is active


(use-package eshell-git-prompt
  :config
  (eshell-git-prompt-use-theme 'powerline))

(provide 'init-eshell)

(use-package eshell-git-prompt
  :hook
  (eshell-mode . (lambda () (setq show-trailing-whitespace nil)))
  :config
  (eshell-git-prompt-use-theme 'powerline))

(provide 'init-eshell)

Remove trailing whitespaces in eshell mode


(require 'helm-config)
(helm-mode 1)

(bind-keys :map shell-mode-map
          ("C-c C-l" . helm-comint-input-ring))

(bind-keys :map minibuffer-local-map
           ("C-c C-l" . helm-minibuffer-history))

(setq helm-M-x-fuzzy-match t)
(setq helm-buffers-fuzzy-matching t)

(require 'helm-ls-git)

(setq helm-ls-git-show-abs-or-relative 'relative)

;; (setq helm-ff-skip-boring-files t)
;; ;; TODO: these don't work. Looks like having the '.' and '..' on top
;; ;; of the list is by design.
;; (push "\\.\\.$" helm-boring-file-regexp-list)
;; (push "\\.$" helm-boring-file-regexp-list)

(require 'helm-config)
(helm-mode 1)

(bind-keys :map shell-mode-map
          ("C-c C-l" . helm-comint-input-ring))

(bind-keys :map minibuffer-local-map
           ("C-c C-l" . helm-minibuffer-history))

(setq helm-grep-save-buffer-name-no-confirm t)
(setq helm-M-x-fuzzy-match t)
(setq helm-buffers-fuzzy-matching t)

(require 'helm-ls-git)

(setq helm-ls-git-show-abs-or-relative 'relative)

;; (setq helm-ff-skip-boring-files t)
;; ;; TODO: these don't work. Looks like having the '.' and '..' on top
;; ;; of the list is by design.
;; (push "\\.\\.$" helm-boring-file-regexp-list)
;; (push "\\.$" helm-boring-file-regexp-list)

Save w/o asking me the buffer name

Save w/o asking me the buffer name


;;; Package -- Summary
;;; Commentary:
;;; Dumping ground for interactive functions, and things like that.
;;; Maybe extensions is a better name? Must ponder.
;;; Code:

;; This should really be region specific.
(defun toggle-comment-on-line ()
  "Comment or uncomment current line."
  (interactive)
  (comment-or-uncomment-region (line-beginning-position) (line-end-position)))
;(global-set-key (kbd "C-;") 'toggle-comment-on-line)

;; use 2 spaces for tabs
(defun die-tabs ()
  "Untabify a buffer."
  (interactive)
  (set-variable 'tab-width 2)
  (mark-whole-buffer)
  (untabify (region-beginning) (region-end))
  (keyboard-quit))

(provide 'config-addons)
;;; config-addons ends here

;;; Package -- Summary
;;; Commentary:
;;; Dumping ground for interactive functions, and things like that.
;;; Maybe extensions is a better name? Must ponder.
;;; Code:

;; This should really be region specific.
(defun toggle-comment-on-line ()
  "Comment or uncomment current line."
  (interactive)
  (comment-or-uncomment-region (line-beginning-position) (line-end-position)))
;(global-set-key (kbd "C-;") 'toggle-comment-on-line)

;; use 2 spaces for tabs
(defun die-tabs ()
  "Untabify a buffer."
  (interactive)
  (set-variable 'tab-width 2)
  (mark-whole-buffer)
  (untabify (region-beginning) (region-end))
  (keyboard-quit))

(defun insert-date ()
  "Insert a date string."
  (interactive)
  (insert
   (concat
    "========= " (format-time-string "%Y-%m-%d (%A)") " =========\n\n")))

;; More stealing from @brandon-rhodes
;; (defun search-forward-symbol-at-point ()
;;   (interactive)
;;   (end-of-thing 'symbol)
;;   (let ((case-fold-search nil))
;;     (re-search-forward (concat "\\_<" (thing-at-point 'symbol) "\\_>"))))

;; (defun search-backward-symbol-at-point ()
;;   (interactive)
;;   (beginning-of-thing 'symbol)
;;   (let ((case-fold-search nil))
;;     (re-search-backward (concat "\\_<" (thing-at-point 'symbol) "\\_>"))))
(provide 'config-addons)
;;; config-addons ends here

Add a few more addons

Add a few more addons


(prelude-require-packages '(ag
                            aggressive-indent
                            helm-ag
                            color-theme-sanityinc-tomorrow
                            gruvbox-theme
                            solarized-theme
                            monokai-theme
                            evil-args
                            evil-jumper
                            evil-matchit
                            evil-nerd-commenter
                            fill-column-indicator
                            js2-refactor
                            paredit
                            multiple-cursors
                            nlinum
                            rhtml-mode
                            rust-mode
                            flycheck-rust
                            ruby-compilation
                            smartrep
                            nyan-mode
                            toggle-quotes
                            window-number
                            yagist
                            yasnippet))

;; vendored packages
(personal/load-init-file "personal/vendor/rcodetools")
(personal/load-init-file "personal/vendor/scad-mode")
(personal/load-init-file "personal/vendor/smartrep")

(prelude-require-packages '(
                            ag
                            aggressive-indent
                            chruby
                            color-theme-sanityinc-tomorrow
                            evil-args
                            evil-jumper
                            evil-matchit
                            evil-nerd-commenter
                            fill-column-indicator
                            flycheck-rust
                            gruvbox-theme
                            helm-ag
                            js2-refactor
                            monokai-theme
                            multiple-cursors
                            nlinum
                            nyan-mode
                            paredit
                            projectile-rails
                            rhtml-mode
                            ruby-compilation
                            rust-mode
                            smartrep
                            solarized-theme
                            toggle-quotes
                            window-number
                            yagist
                            yasnippet
                            ))

;; vendored packages
(personal/load-init-file "personal/vendor/rcodetools")
(personal/load-init-file "personal/vendor/scad-mode")
(personal/load-init-file "personal/vendor/smartrep")

Include chruby and projectile rails

Include chruby and projectile rails

Sorted the package list


;;; 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


;;; emacs/term/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defun +term/open (&optional project-root)
  "Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
non-nil, cd into the current project's root."
  (interactive "P")
  (let ((default-directory (if project-root (doom-project-root 'nocache) default-directory)))
    (call-interactively #'multi-term)))

;;;###autoload
(defun +term/open-popup (arg)
  "Open a terminal popup window. If ARG (universal argument) is
non-nil, cd into the current project's root."
  (interactive "P")
  (require 'multi-term)
  (let ((default-directory (if arg (doom-project-root 'nocache) default-directory))
        (buffer (multi-term-get-buffer current-prefix-arg)))
    (pop-to-buffer buffer)
    (setq multi-term-buffer-list (nconc multi-term-buffer-list (list buffer)))
    (multi-term-internal)))

;;;###autoload
(defun +term/open-popup-in-project (arg)
  "Open a terminal popup window in the root of the current project.

If ARG (universal argument) is non-nil, open it in `default-directory' instead."
  (interactive "P")
  (+term/open-popup (not arg)))

;;; emacs/term/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defun +term/open (&optional project-root)
  "Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
non-nil, cd into the current project's root."
  (interactive "P")
  (let ((default-directory
          (if project-root
              (doom-project-root 'nocache)
            default-directory)))
    ;; Doom's switch-buffer hooks prevent themselves from triggering when
    ;; switching from buffer A back to A. Because `multi-term' uses `set-buffer'
    ;; before `switch-to-buffer', the hooks don't trigger, so we use this
    ;; roundabout way to trigger them properly.
    (switch-to-buffer (save-window-excursion (multi-term)))))

;;;###autoload
(defun +term/open-popup (arg)
  "Open a terminal popup window. If ARG (universal argument) is
non-nil, cd into the current project's root."
  (interactive "P")
  (let ((default-directory
          (if arg
              (doom-project-root 'nocache)
            default-directory)))
    (pop-to-buffer (save-window-excursion (multi-term)))))

;;;###autoload
(defun +term/open-popup-in-project (arg)
  "Open a terminal popup window in the root of the current project.

If ARG (universal argument) is non-nil, open it in `default-directory' instead."
  (interactive "P")
  (+term/open-popup (not arg)))

Fix multi-term buffers missing from buffer list

Caused because switch buffer hooks weren't triggering, due to
multi-term's odd use of set-buffer before switch-to-buffer.


;; Company mode
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

(provide 'init-company)

;; Company mode
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

;; Fix compatibility issue with fill-column-indicator
(defun on-off-fci-before-company(command)
  (when (string= "show" command)
    (turn-off-fci-mode))
  (when (string= "hide" command)
    (turn-on-fci-mode)))

(advice-add 'company-call-frontends :before #'on-off-fci-before-company)

(provide 'init-company)


;;; init-display.el -- display setup

;;; Commentary:
;;; customize emacs display

;;; Code:
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)

(setq indicate-buffer-boundaries
      '((t . right) (bottom . right)))
(setq indicate-empty-lines t)
(setq scroll-margin 3)
(setq scroll-step 1)
(setq-default scroll-preserver-screen-position t)

(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message t)
(setq initial-scratch-message ";; *scratch*")

(set-frame-font  "Source Code Pro for Powerline-12")

(add-to-list 'default-frame-alist '(fullscreen . maximized))

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

;;; init-display.el -- display setup

;;; Commentary:
;;; customize emacs display

;;; Code:
(require-package 'fill-column-indicator)

(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)

(setq indicate-buffer-boundaries
      '((t . right) (bottom . right)))
(setq indicate-empty-lines t)
(setq scroll-margin 3)
(setq scroll-step 1)
(setq-default scroll-preserver-screen-position t)

(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message t)
(setq initial-scratch-message ";; *scratch*")

(set-frame-font  "Source Code Pro for Powerline-12")

(add-to-list 'default-frame-alist '(fullscreen . maximized))

(add-hook 'prog-mode-hook 'fci-mode)

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

Add fill-column indicator to Emacs

Add fill-column indicator to Emacs


;;; setup-modes.el --- Modes that don't require separate files.
;;; Commentary:
;;; Code:

;; yaml-mode. mainly for syntax highlighting
(use-package yaml-mode
  :ensure t ;; seems like overkill
  :config
  (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)))

(use-package camcorder
  :defer t)

;; not sure where to put this
(use-package feature-mode
  :ensure t)

;; this one is builtin
(use-package subword
  :defer t
  :diminish "")

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

;;; setup-modes.el --- Modes that don't require separate files.
;;; Commentary:
;;; Code:

;; yaml-mode. mainly for syntax highlighting
(use-package yaml-mode
  :ensure t ;; seems like overkill
  :config
  (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)))

(use-package camcorder
  :defer t)

;; not sure where to put this
(use-package feature-mode
  :ensure t)

;; this one is builtin
(use-package subword
  :defer t
  :diminish "w")

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

Diminish subword mode to "w"

Diminish subword mode to "w"


;; Time-stamp: <2015-06-30 16:51:07 kmodi>

;; Conf Mode

(use-package conf-mode
  :mode (("\\.conf\\'"    . conf-space-mode)
         ("\\.setup.*\\'" . conf-space-mode)))

(provide 'setup-conf)

;; Time-stamp: <2017-08-15 12:05:32 kmodi>

;; Conf Mode

(use-package conf-mode
  :mode (("\\.conf\\'" . conf-space-mode)
         ("\\.setup.*\\'" . conf-space-mode))
  :config
  (progn
    (defun modi/conf-quote-normal ()
      "Enable `conf-quote-normal' for *.setup files."
      (when-let* ((fname (buffer-file-name))
                  (enable-conf-quote-normal (string-match-p "\\.setup.*" fname)))
        ;; Set the syntax of ' and " to punctuation.
        (conf-quote-normal nil)))
    (add-hook 'conf-space-mode-hook #'modi/conf-quote-normal)))

(provide 'setup-conf)

Set syntax of ' and " to punctuation for some conf-space-mode files


;; Time-stamp: <2018-05-10 09:44:07 kmodi>

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

(use-package nim-mode
  :ensure t
  :mode (("\\.nim\\'" . nim-mode))
  :config
  (progn
    (key-chord-define 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-05-24 11:56:21 kmodi>

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

(use-package nim-mode
  :ensure t
  :mode (("\\.nim\\'" . nim-mode))
  :chords (:map nim-mode-map
           ("??" . devdocs-lookup))
  :config
  (progn
    (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)

Move the nim-mode specific key-chord binding to :chords


(add-to-list 'auto-mode-alist '("\.S" . asm-mode))

;; Forcibly prepend the following auto-mode-alist.
(seq-doseq (mode '(("\\.[sS]\\'" . asm-mode)))
  (add-to-list 'auto-mode-alist mode
               nil (lambda (a b) nil)))

Fix auto-mode-alist regex patter for asm-mode.


(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


;; Time-stamp: <2015-06-15 17:08:47 kmodi>

(use-package buffer-move
  :config
  (progn
    (bind-to-modi-map "," #'buf-move-left)
    (bind-to-modi-map "." #'buf-move-right)
    (bind-to-modi-map "k" #'buf-move-up)
    (bind-to-modi-map "K" #'buf-move-down)))

(provide 'setup-buffer-move)

;; Time-stamp: <2015-11-06 11:01:35 kmodi>

;; https://github.com/lukhas/buffer-move

(use-package buffer-move
  :commands (modi/buf-move-left
             modi/buf-move-right
             modi/buf-move-up
             modi/buf-move-down)
  :init
  (progn
    (bind-to-modi-map "," #'modi/buf-move-left)
    (bind-to-modi-map "." #'modi/buf-move-right)
    (bind-to-modi-map "k" #'modi/buf-move-up)
    (bind-to-modi-map "j" #'modi/buf-move-down))
  :config
  (progn
    (setq buffer-move-behavior 'swap) ; values = 'swap (default), 'move

    (defun modi/buf-move-left (swap)
      "Calls `buf-move-left' with the “move” behavior.
If SWAP is non-nil, the default “swap” behavior is used."
      (interactive "P")
      (let ((buffer-move-behavior (if swap 'swap 'move)))
        (buf-move-left)))

    (defun modi/buf-move-right (swap)
      "Calls `buf-move-right' with the “move” behavior.
If SWAP is non-nil, the default “swap” behavior is used."
      (interactive "P")
      (let ((buffer-move-behavior (if swap 'swap 'move)))
        (buf-move-right)))

    (defun modi/buf-move-up (swap)
      "Calls `buf-move-up' with the “move” behavior.
If SWAP is non-nil, the default “swap” behavior is used."
      (interactive "P")
      (let ((buffer-move-behavior (if swap 'swap 'move)))
        (buf-move-up)))

    (defun modi/buf-move-down (swap)
      "Calls `buf-move-down' with the “move” behavior.
If SWAP is non-nil, the default “swap” behavior is used."
      (interactive "P")
      (let ((buffer-move-behavior (if swap 'swap 'move)))
        (buf-move-down)))))

(provide 'setup-buffer-move)

Make “move” the dflt behav for buf-move cmds

- Also added wrapper functions to pick either the 'swap or 'move
  behavior


(require 'package)
(add-to-list 'package-archives
             '("technomancy" . "http://repo.technomancy.us/emacs/") t)
(package-initialize)

(provide 'init-elpa)

(require 'package)
(package-initialize)

(provide 'init-elpa)

Remove reference to technomancy's deleted ELPA repo


;; Quack mode for Racket
(require 'quack)

;; ParEdit
(autoload 'paredit-mode "paredit"
  "Minor mode for pseudo-structurally editing Lisp code." t)

;; File extensions/major mode bindings
(add-to-list 'auto-mode-alist '("\\.rkt$" . scheme-mode))
(add-to-list 'auto-mode-alist '("\\.transit$" . scheme-mode))
(add-to-list 'auto-mode-alist '("\\.k$" . k3-mode))

;; Quack mode for Racket
(require 'quack)

;; ParEdit
(autoload 'paredit-mode "paredit"
  "Minor mode for pseudo-structurally editing Lisp code." t)

;; File extensions/major mode bindings
(add-to-list 'auto-mode-alist '("\\.rkt$" . scheme-mode))
(add-to-list 'auto-mode-alist '("\\.transit$" . scheme-mode))
(add-to-list 'auto-mode-alist '("\\.ttest$" . scheme-mode))
(add-to-list 'auto-mode-alist '("\\.k$" . k3-mode))

Add .ttest as scheme-mode extension

Add .ttest as scheme-mode extension


;;; Uncomment the modules you'd like to use and restart Prelude afterwards

;; Emacs IRC client
(require 'prelude-erc)
(require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more
(require 'prelude-helm) ;; Interface for narrowing and search
(require 'prelude-helm-everywhere) ;; Enable Helm everywhere
(require 'prelude-company)
(require 'prelude-key-chord) ;; Binds useful features to key combinations
(require 'prelude-mediawiki)
;; (require 'prelude-evil)

;;; Programming languages support
(require 'prelude-c)
(require 'prelude-clojure)
(require 'prelude-coffee)
(require 'prelude-common-lisp)
(require 'prelude-css)
(require 'prelude-emacs-lisp)
(require 'prelude-erlang)
(require 'prelude-go)
(require 'prelude-haskell)
(require 'prelude-js)
(require 'prelude-latex)
(require 'prelude-lisp)
(require 'prelude-ocaml)
(require 'prelude-org) ;; Org-mode helps you keep TODO lists, notes and more
(require 'prelude-perl)
(require 'prelude-python)
(require 'prelude-ruby)
(require 'prelude-scala)
(require 'prelude-scheme)
(require 'prelude-shell)
(require 'prelude-scss)
(require 'prelude-web) ;; Emacs mode for web templates
(require 'prelude-xml)
(require 'prelude-yaml)

;;; Uncomment the modules you'd like to use and restart Prelude afterwards

;; Emacs IRC client
(require 'prelude-erc)
(require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more
(require 'prelude-helm) ;; Interface for narrowing and search
(require 'prelude-helm-everywhere) ;; Enable Helm everywhere
(require 'prelude-company)
;; (require 'prelude-key-chord) ;; Binds useful features to key combinations
(require 'prelude-mediawiki)
(require 'prelude-evil)

;;; Programming languages support
(require 'prelude-c)
(require 'prelude-clojure)
(require 'prelude-coffee)
(require 'prelude-common-lisp)
(require 'prelude-css)
(require 'prelude-emacs-lisp)
(require 'prelude-erlang)
(require 'prelude-go)
(require 'prelude-haskell)
(require 'prelude-js)
(require 'prelude-latex)
(require 'prelude-lisp)
(require 'prelude-ocaml)
(require 'prelude-org) ;; Org-mode helps you keep TODO lists, notes and more
(require 'prelude-perl)
(require 'prelude-python)
(require 'prelude-ruby)
(require 'prelude-scala)
(require 'prelude-scheme)
(require 'prelude-shell)
(require 'prelude-scss)
(require 'prelude-web) ;; Emacs mode for web templates
(require 'prelude-xml)
(require 'prelude-yaml)

Disable key-chords because we're using evil mode now


;;; init-direnv.el --- Integrate with direnv -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(defun sanityinc/maybe-enable-envrc-global-mode ()
  "Enable `envrc-global-mode' if `direnv' is installed."
  (when (executable-find "direnv")
    (envrc-global-mode)))

(when (maybe-require-package 'envrc)
  (with-eval-after-load 'envrc
    (define-key envrc-mode-map (kbd "C-c e") 'envrc-command-map))
  (add-hook 'after-init-hook 'sanityinc/maybe-enable-envrc-global-mode))

(provide 'init-direnv)

;;; init-direnv.el ends here

;;; init-direnv.el --- Integrate with direnv -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(when (maybe-require-package 'envrc)
  (defun sanityinc/maybe-enable-envrc-global-mode ()
    "Enable `envrc-global-mode' if `direnv' is installed."
    (when (executable-find "direnv")
      (envrc-global-mode)))

  (with-eval-after-load 'envrc
    (define-key envrc-mode-map (kbd "C-c e") 'envrc-command-map))
  (add-hook 'after-init-hook 'sanityinc/maybe-enable-envrc-global-mode))

(provide 'init-direnv)

;;; init-direnv.el ends here

Define function inside conditional block which uses it


;; This file is automatically generated by the multiple-cursors extension.
;; It keeps track of your preferences for running commands with multiple cursors.

(setq mc/cmds-to-run-for-all
      '(
        backward-sexp
        beginning-of-line-dwim
        c-electric-delete-forward
        c-electric-semi&comma
        c-electric-slash
        c-electric-star
        forward-sexp
        kill-or-delete-region
        org-delete-char
        org-self-insert-command
        python-indent-electric-colon
        sp--self-insert-command
        yas-expand
        zap-up-to-char
        zap-up-to-non-whitespace
        ))

(setq mc/cmds-to-run-once
      '(
        ag-project-at-point
        mouse-set-region
        smex
        sp-rewrap-sexp
        sp-splice-sexp
        ))

;; This file is automatically generated by the multiple-cursors extension.
;; It keeps track of your preferences for running commands with multiple cursors.

(setq mc/cmds-to-run-for-all
      '(
        backward-sexp
        beginning-of-line-dwim
        c-electric-delete-forward
        c-electric-semi&comma
        c-electric-slash
        c-electric-star
        forward-sexp
        kill-or-delete-region
        org-delete-char
        org-self-insert-command
        python-indent-electric-colon
        sgml-slash
        sp--self-insert-command
        yas-expand
        zap-up-to-char
        zap-up-to-non-whitespace
        ))

(setq mc/cmds-to-run-once
      '(
        ag-project-at-point
        mouse-set-region
        smex
        sp-rewrap-sexp
        sp-splice-sexp
        ))

Enable another command with multiple-cursors.


;;; init-yasnippet.el -- yasnippet setup

;;; Commentary:
;;; yasnippet and custom snippets

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

(require 'yasnippet)

(yas-global-mode 1)

(setq yas-snippet-dirs
      '("~/.emacs.d/snippets" "~/code/yasnippet-snippets"))

(diminish 'yas-minor-mode)

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

;;; init-yasnippet.el -- yasnippet setup

;;; Commentary:
;;; yasnippet and custom snippets

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

(require 'yasnippet)

(setq yas-snippet-dirs
      '("~/.emacs.d/snippets" "~/code/yasnippet-snippets"))

(yas-global-mode 1)
(define-key yas-keymap (kbd "DEL") 'yas-skip-and-clear-or-delete-char)

(diminish 'yas-minor-mode)

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

Fix Emacs YAS backspace in middle of snippet


(add-hook 'go-mode-hook 'my/common-programming-hook)
(add-hook 'go-mode-hook
  (lambda()
    (local-set-key (kbd "C-x C-o") 'ff-find-other-file)
   )
 )

(add-hook 'go-mode-hook 'my/common-programming-hook)
(add-hook 'go-mode-hook
  (lambda()
    (local-set-key (kbd "C-x C-o") 'ff-find-other-file)
    (add-hook 'before-save-hook 'gofmt-before-save nil 'local)
   )
 )

Call gofmt on buffer save.

Call gofmt on buffer save.


;;; olical-evil --- Tweaks and additions for evil mode.

;;; Commentary:

;; I want to add some bindings I miss, like [e from distinguished and
;; a few sexp manipulation bindings.

;;; Code:

(provide 'olical-evil)
;;; olical-evil.el ends here

;;; olical-evil --- Tweaks and additions for evil mode.

;;; Commentary:

;; I want to add some bindings I miss, like [e from distinguished and
;; a few sexp manipulation bindings.

;;; Code:

(require 'evil)

(defun olical-evil-new-line-above (count)
  "Create new lines above your current one.  COUNT is the number of new lines."
  (interactive "p")
  (evil-open-above count)
  (evil-force-normal-state)
  (evil-next-line 1))

(defun olical-evil-new-line-below (count)
  "Create new lines below your current one.  COUNT is the number of new lines."
  (interactive "p")
  (evil-open-below count)
  (evil-force-normal-state)
  (evil-previous-line 1))

(define-key evil-normal-state-map (kbd "[ SPC") 'olical-evil-new-line-above)
(define-key evil-normal-state-map (kbd "] SPC") 'olical-evil-new-line-below)

(provide 'olical-evil)
;;; olical-evil.el ends here

Set up [SPC and ]SPC new line binds

Set up [SPC and ]SPC new line binds


;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/rust/doctor.el

(assert! (or (not (featurep! +lsp))
             (featurep! :tools lsp))
         "This module requires (:tools lsp)")

(unless (executable-find "rustc")
  (warn! "Couldn't find rustc binary"))

(unless (executable-find "cargo")
  (warn! "Couldn't find cargo binary"))

(if (featurep! +lsp)
    (let ((lsp-server 'rls))
      (when (require 'rustic nil t)
        (setq lsp-server rustic-lsp-server))
      (pcase lsp-server
        (`rust-analyzer
         (unless (executable-find "ra_lsp_server")
           (warn! "Couldn't find rust analyzer (ra_lsp_server)")))
        (`rls
         (unless (executable-find "rls")
           (warn! "Couldn't find rls")))))
  (when (require 'racer nil t)
    ;; racer
    (unless (file-exists-p racer-cmd)
      (warn! "Couldn't find the racer binary at `racer-cmd'"))
    ;; rust source code (rustup component add rust-src)
    (unless (file-directory-p racer-rust-src-path)
      (warn! "Couldn't find Rust's source code at RUST_SRC_PATH or `racer-rust-src-path'"))))

;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/rust/doctor.el

(assert! (or (not (featurep! +lsp))
             (featurep! :tools lsp))
         "This module requires (:tools lsp)")

(unless (executable-find "rustc")
  (warn! "Couldn't find rustc binary"))

(unless (executable-find "cargo")
  (warn! "Couldn't find cargo binary"))

(if (featurep! +lsp)
    (let ((lsp-server 'rls))
      (when (require 'rustic nil t)
        (setq lsp-server rustic-lsp-server))
      (pcase lsp-server
        (`rust-analyzer
         (unless (executable-find "rust-analyzer")
           (warn! "Couldn't find rust analyzer (rust-analyzer)")))
        (`rls
         (unless (executable-find "rls")
           (warn! "Couldn't find rls")))))
  (when (require 'racer nil t)
    ;; racer
    (unless (file-exists-p racer-cmd)
      (warn! "Couldn't find the racer binary at `racer-cmd'"))
    ;; rust source code (rustup component add rust-src)
    (unless (file-directory-p racer-rust-src-path)
      (warn! "Couldn't find Rust's source code at RUST_SRC_PATH or `racer-rust-src-path'"))))

Fix references to old rust-analyzer binary

Closes #2588


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

(defconst my-yadm-packages '(magit))

(defun my-yadm/post-init-magit ()
  (spacemacs/set-leader-keys "oy" #'yadm-status)

  (when (configuration-layer/package-used-p 'magit-todos)
    (advice-add 'magit-todos--insert-todos :around
                #'yadm--magit-todos-manual-scan-ad))

  (with-eval-after-load 'tramp
    (add-to-list 'tramp-methods
                 '("yadm"
                   (tramp-login-program "yadm")
                   (tramp-login-args (("enter")))
                   (tramp-login-env (("SHELL") ("/bin/sh")))
                   (tramp-remote-shell "/bin/sh")
                   (tramp-remote-shell-args ("-c"))))))

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

(defconst my-yadm-packages '(magit))

(defun my-yadm/post-init-magit ()
  (spacemacs/set-leader-keys "oy" #'yadm-status)

  (when (configuration-layer/package-used-p 'magit-todos)
    (advice-add 'magit-todos--insert-todos :around
                #'yadm--magit-todos-manual-scan-ad))

  (with-eval-after-load 'tramp
    (add-to-list 'tramp-methods
                 '("yadm"
                   (tramp-login-program "env")
                   (tramp-login-args (("SHELL=/bin/sh") ("yadm") ("enter")))
                   (tramp-remote-shell "/bin/sh")
                   (tramp-remote-shell-args ("-c"))))))

Fix yadm integration to work with Emacs 27.1 as well

Since tramp-login-env is no more, this achieves the same effect without it.


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

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

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

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

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

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

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

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

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

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

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

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

Add a package for switching windows easily


(use-package exec-path-from-shell
  :ensure t
  :if (memq window-system '(mac ns x))
  :config
  (exec-path-from-shell-copy-env "LANG")
  (exec-path-from-shell-copy-env "MAKEFLAGS")
  (exec-path-from-shell-initialize))

(use-package exec-path-from-shell
  :ensure t
  :if (memq window-system '(mac ns x))
  :config
  (exec-path-from-shell-copy-env "PATH")
  (exec-path-from-shell-copy-env "LANG")
  (exec-path-from-shell-copy-env "MAKEFLAGS")
  (exec-path-from-shell-initialize))

Emacs: Copy $PATH env when running exec-path-from-shell


;;; init-projectile.el -- projetile setup

;;; Commentary:
;;; load projectile and customizations

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

(use-package projectile
  :commands (projectile-global-mode)
  :config
  (projectile-global-mode 1)
  (define-key projectile-mode-map (kbd "C-c p R") 'my/projectile-regenerate-tags)
  (with-eval-after-load 'evil
    (key-seq-define evil-normal-state-map ",t" 'helm-projectile))
  :diminish projectile-mode
  :init
  (add-hook 'after-init-hook 'projectile-global-mode))

(defun my/projectile-regenerate-tags ()
  "Regenerate projectile tags using git ctags."
  (interactive)
  (progn
    (start-process-shell-command
     "tags" nil (format "cd %s; git ctags"
                        (projectile-project-root)))
    (message "Generating tags file")))

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

;;; init-projectile.el -- projetile setup

;;; Commentary:
;;; load projectile and customizations

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

(use-package projectile
  :commands (projectile-global-mode)
  :config
  (projectile-global-mode 1)
  (define-key projectile-mode-map (kbd "C-c p R") 'my/projectile-regenerate-tags)
  (with-eval-after-load 'evil
    (key-seq-define evil-normal-state-map ",t" 'helm-projectile))
  (setq projectile-switch-project-action 'projectile-commander)
  (def-projectile-commander-method ?s
    "Open a *shell* buffer for the project."
    (projectile-run-shell))
  (def-projectile-commander-method ?d
    "Open project root in dired."
    (projectile-dired))
  :diminish projectile-mode
  :init
  (add-hook 'after-init-hook 'projectile-global-mode))

(defun my/projectile-regenerate-tags ()
  "Regenerate projectile tags using git ctags."
  (interactive)
  (progn
    (start-process-shell-command
     "tags" nil (format "cd %s; git ctags"
                        (projectile-project-root)))
    (message "Generating tags file")))

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

Use projectile commander as default action


(require 'slime-autoloads)
(global-set-key [f4] 'slime-selector)

(eval-after-load "slime"
  '(progn
     (add-to-list 'load-path (concat (directory-of-library "slime") "/contrib"))
     (add-hook 'slime-mode-hook 'pretty-lambdas)
     (add-hook 'slime-mode-hook 'enable-paredit-mode)
     (add-hook 'slime-repl-mode-hook 'enable-paredit-mode)
     (slime-setup '(slime-repl slime-fuzzy slime-highlight-edits))
     (setq slime-complete-symbol*-fancy t)
     (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)

     (require 'ac-slime)
     (add-hook 'slime-mode-hook 'set-up-slime-ac)
     (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)

     (require 'hippie-expand-slime)
     (add-hook 'slime-mode-hook 'set-up-slime-hippie-expand)
     (add-hook 'slime-repl-mode-hook 'set-up-slime-hippie-expand)))

(provide 'init-slime)

(require 'slime-autoloads)
(global-set-key [f4] 'slime-selector)

(eval-after-load "slime"
  '(progn
     (add-to-list 'load-path (concat (directory-of-library "slime") "/contrib"))
     (add-hook 'slime-mode-hook 'pretty-lambdas)
     (add-hook 'slime-mode-hook 'enable-paredit-mode)
     (add-hook 'slime-repl-mode-hook 'enable-paredit-mode)
     (slime-setup '(slime-repl slime-fuzzy slime-highlight-edits))
     (setq slime-complete-symbol*-fancy t)
     (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)

     ;; Stop SLIME's REPL from grabbing DEL, which is annoying when backspacing over a '('
     (defun override-slime-repl-bindings-with-paredit ()
       (define-key slime-repl-mode-map (read-kbd-macro paredit-backward-delete-key) nil))
     (add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)

     (require 'ac-slime)
     (add-hook 'slime-mode-hook 'set-up-slime-ac)
     (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)

     (require 'hippie-expand-slime)
     (add-hook 'slime-mode-hook 'set-up-slime-hippie-expand)
     (add-hook 'slime-repl-mode-hook 'set-up-slime-hippie-expand)))

(provide 'init-slime)


(require 'eclim)
(global-eclim-mode)

(require 'eclimd)

(set 'eclim-eclipse-dirs '("~/code/eclipse"))
(set 'eclim-executable "~/code/eclipse/eclim")
(set 'eclimd-wait-for-process nil)

;; don't think we can change this now :(
(set 'eclimd-workspace-dir "~/.eclipse-workspace")

(require 'ac-emacs-eclim-source)
(ac-emacs-eclim-config)

(defun java-keys ()
  (interactive)
  ;; (local-set-key (kbd "M-.") 'eclim-java-find-declaration)

  (local-set-key (kbd "C-c") '())

  ;; ;; Fix tab bindings (messed up by yas and/or binding C-i
  ;; (local-set-key (kbd "TAB") '())
  ;; (set-tab)

  )
(add-hook 'java-mode-hook 'java-keys)

;; Run eclimd automatically when we open a java buffer (if not running
;; already).
(add-hook 'java-mode-hook
          (lambda () (unless (eclimd--running-p)
                       (start-eclimd eclimd-workspace-dir)
                       (define-key java-mode-map (kbd "C-c") nil))))

;; (require 'eclim)
;; (global-eclim-mode)

;; (require 'eclimd)

;; (set 'eclim-eclipse-dirs '("~/code/eclipse"))
;; (set 'eclim-executable "~/code/eclipse/eclim")
;; (set 'eclimd-wait-for-process nil)

;; ;; don't think we can change this now :(
;; (set 'eclimd-workspace-dir "~/.eclipse-workspace")

;; (require 'ac-emacs-eclim-source)
;; (ac-emacs-eclim-config)

(defun java-keys ()
  (interactive)
  ;; (local-set-key (kbd "M-.") 'eclim-java-find-declaration)

  (local-set-key (kbd "C-c") '())

  ;; ;; Fix tab bindings (messed up by yas and/or binding C-i
  ;; (local-set-key (kbd "TAB") '())
  ;; (set-tab)

  )
(add-hook 'java-mode-hook 'java-keys)

;; ;; Run eclimd automatically when we open a java buffer (if not running
;; ;; already).
;; (add-hook 'java-mode-hook
;;           (lambda () (unless (eclimd--running-p)
;;                        (start-eclimd eclimd-workspace-dir)
;;                        (define-key java-mode-map (kbd "C-c") nil))))

Disable eclim, it's too slow!

Disable eclim, it's too slow!


(add-auto-mode 'haml-mode "\.haml$")
(add-auto-mode 'sass-mode "\.sass$" "\.scss$")

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

(provide 'init-haml)

(add-auto-mode 'sass-mode "\.scss$")

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

(provide 'init-haml)

Remove redundant haml config that is provided by elpa packages


(load-library "rng-auto")
(add-to-list 'auto-mode-alist
              (cons (concat "\\." (regexp-opt '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss") t) "\\'")
                    'nxml-mode))
(unify-8859-on-decoding-mode)
(setq magic-mode-alist (cons '("<＼＼?xml " . nxml-mode) magic-mode-alist))
(fset 'html-mode 'nxml-mode)
(fset 'xml-mode 'nxml-mode)
(add-hook 'nxml-mode-hook (lambda ()
                            (make-variable-buffer-local 'ido-use-filename-at-point)
                            (setq ido-use-filename-at-point nil)))

(load-library "rng-auto")
(add-to-list 'auto-mode-alist
              (cons (concat "\\." (regexp-opt '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss") t) "\\'")
                    'nxml-mode))
(unify-8859-on-decoding-mode)
(setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
(fset 'html-mode 'nxml-mode)
(fset 'xml-mode 'nxml-mode)
(add-hook 'nxml-mode-hook (lambda ()
                            (make-variable-buffer-local 'ido-use-filename-at-point)
                            (setq ido-use-filename-at-point nil)))

Fix some odd unicode backslashes that sneaked in


;;; module-php.el

(use-package php-mode
  :mode "\\.\\(php\\|inc\\)$"
  :init
  (setq php-template-compatibility nil)
  :config
  (require 'php-extras)
  (add-company-backend! php-mode '(php-extras-company))

  ;; TODO Tie into emr
  (require 'php-refactor-mode)
  (add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)))

(provide 'module-php)
;;; module-php.el ends here

;;; module-php.el

(use-package php-mode
  :mode "\\.\\(php\\|inc\\)$"
  :init
  (setq php-template-compatibility nil
        php-extras-eldoc-functions-file (concat narf-temp-dir "php-extras-eldoc-functions"))
  :config
  (require 'php-extras)
  (add-company-backend! php-mode '(php-extras-company))

  ;; TODO Tie into emr
  (require 'php-refactor-mode)
  (add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)))

(provide 'module-php)
;;; module-php.el ends here

Save php-extras-eldoc-functions-file in cache dir


(kotct/load-corresponding)

(describe "sh config"
  (it "adds a tab variable setter for `sh-basic-offset'"
    (expect (assoc 'sh-basic-offset kotct/tab-variable-setters) :to-be-truthy))
  (it "adds a tab variable setter for `sh-indentation'"
    (expect (assoc 'sh-indentation kotct/tab-variable-setters) :to-be-truthy)))

(kotct/load-corresponding)

(describe "sh config"
  (it "adds a tab variable setter for `sh-basic-offset'"
    (expect (assoc 'sh-basic-offset kotct/tab-variable-setters) :to-be-truthy))
  (it "adds a tab variable setter for `sh-indentation'"
    (expect (assoc 'sh-indentation kotct/tab-variable-setters) :to-be-truthy))
  (it "sets the indentation for case labels to 0"
    (expect sh-indent-for-case-label :to-be 0))
  (it "sets the indentation for case alts to be one level"
    (expect sh-indent-for-case-alt :to-be '+)))

Add the rest of the specs for the sh configuration

Note that I did not include a test for `sh-mode-hook` having `indent-tabs-mode` set to `t` by default.  This is primarily due to concerns about equality checking, since it currently runs a `lambda`.  I plan to make API changes to `indentation` to improve all of this, however, so it might be best to ship it like this.


(require 'multiple-cursors)

(smartrep-define-key global-map "C-l v" '(("n" . 'mc/mark-next-lines)
                                          ("p" . 'mc/mark-previous-lines)
                                          (">" . 'mc/mark-next-like-this)
                                          ("<" . 'mc/mark-previous-like-this)))

(smartrep-define-key global-map "C-l C-v" '(("C-n" . 'mc/mark-next-lines)
                                            ("C-p" . 'mc/mark-previous-lines)
                                            ("C->" . 'mc/mark-next-like-this)
                                            ("C-<" . 'mc/mark-previous-like-this)))

(mapc (lambda (cmd)
        (add-to-list 'mc/cmds-to-run-for-all cmd))
      '(
        sp--self-insert-command
        god-mode-self-insert
        ))

(mapc (lambda (cmd)
        (add-to-list 'mc/cmds-to-run-once cmd))
      '(
        god-mode
        god-mode-all
        god-local-mode
        helm-confirm-and-exit-minibuffer
        split-window-horizontally
        split-window-vertically
        mc/mark-next-lines
        mc/mark-next-like-this
        undo-tree-visualizer-quit
        undo-tree-visualize
        keyboard-escape-quit
        ))

(require 'multiple-cursors)

(smartrep-define-key global-map "C-l v" '(("n" . 'mc/mark-next-lines)
                                          ("p" . 'mc/mark-previous-lines)
                                          (">" . 'mc/mark-next-like-this)
                                          ("<" . 'mc/mark-previous-like-this)))

(smartrep-define-key global-map "C-l C-v" '(("C-n" . 'mc/mark-next-lines)
                                            ("C-p" . 'mc/mark-previous-lines)
                                            ("C->" . 'mc/mark-next-like-this)
                                            ("C-<" . 'mc/mark-previous-like-this)))

(mapc (lambda (cmd)
        (add-to-list 'mc/cmds-to-run-for-all cmd))
      '(
        sp--self-insert-command
        god-mode-self-insert
        prelude-move-beginning-of-line
        ))

(mapc (lambda (cmd)
        (add-to-list 'mc/cmds-to-run-once cmd))
      '(
        god-mode
        god-mode-all
        god-local-mode
        helm-confirm-and-exit-minibuffer
        split-window-horizontally
        split-window-vertically
        mc/mark-next-lines
        mc/mark-next-like-this
        undo-tree-visualizer-quit
        undo-tree-visualize
        keyboard-escape-quit
        ))

Add prelude-move-beginning-of-line to mc all array


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

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

    :ui
    doom
    doom-dashboard
    modeline
    ophints
    hl-todo
    nav-flash
    (popup +all +defaults)
    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
    undo

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

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

    :checkers
    grammar
    (spell +flyspell)
    (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
    (popup +all +defaults)
    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
    undo

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

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

    :checkers
    grammar
    (spell +flyspell)
    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)

[emacs] Disable flycheck childframe. It's annoying


;; 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.
 '(explicit-bash-args (quote ("--noediting" "--login" "-i")))
 '(ns-function-modifier (quote control))
 '(org-hide-emphasis-markers t)
 '(package-selected-packages
   (quote
    (yasnippet yaml-mode use-package markdown-mode magit helm exec-path-from-shell evil ess emmet-mode)))
 '(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.
 '(explicit-bash-args (quote ("--noediting" "--login" "-i")))
 '(js-indent-level 2)
 '(ns-function-modifier (quote control))
 '(org-hide-emphasis-markers t)
 '(package-selected-packages
   (quote
    (yasnippet yaml-mode use-package markdown-mode magit helm exec-path-from-shell evil ess emmet-mode)))
 '(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.
 )

Use indent level of 2 for javascript.

Use indent level of 2 for javascript.


(use-package idris-mode
  :ensure t
  )

(provide 'pkg-idris)

(use-package idris-mode
  :ensure t
  :init
  (custom-set-faces
   '(idris-semantic-bound-face ((t (:foreground "#fe8019"))))
   '(idris-semantic-data-face ((t (:foreground "#8ec07c"))))
   '(idris-semantic-function-face ((t (:foreground "#d3869b"))))
   '(idris-semantic-implicit-face ((t (:foreground "#303030"))))
   ;; '(idris-semantic-module-face ((t (:foreground "#"))))
   ;; '(idris-semantic-namespace-face ((t (:foreground "#"))))
   '(idris-semantic-postulate-face ((t (:foreground "#98971a"))))
   '(idris-semantic-type-face ((t (:foreground "#458588"))))
   )
  )

(provide 'pkg-idris)

Fix type faces of idris-mode

Fix type faces of idris-mode


(defvar kotct/dependency-list
  '(linum-off ;; turn linum off in certain modes
    ido-vertical-mode ;; use vertical menus for ido
    ido-grid-mode ;; use a grid selection menu for ido
    smex ;; ido-enabled M-x
    anzu ;; nicer search environment
    volatile-highlights ;; highlight changed areas
    buffer-move ;; easily move buffers between windows
    expand-region ;; expand region to successively larger sexps
    magit ;; make Git and Emacs both way cooler
    auto-complete ;; code autocompletion
    markdown-mode ;; major mode for markdown
    smart-tabs-mode ;; indentation with tabs and spaces
    ace-jump-mode ;; immediately jump to any visible character
    ace-jump-zap ;; zap-to-char but harnessing ace-jump
    editorconfig ;; editorconfig plugin
    hl-todo ;; highlight TODO, FIXME, FAIL, etc.
    highlight-symbol ;; navigate between and highlight symbols
    web-mode ;; for editing web files
    elixir-mode ;; for editing Elixir code
    rust-mode ;; for editing Rust code
    buttercup ;; for tests

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

(provide 'dependencies)

(defvar kotct/dependency-list
  '(linum-off ;; turn linum off in certain modes
    ido-vertical-mode ;; use vertical menus for ido
    ido-grid-mode ;; use a grid selection menu for ido
    smex ;; ido-enabled M-x
    anzu ;; nicer search environment
    volatile-highlights ;; highlight changed areas
    buffer-move ;; easily move buffers between windows
    expand-region ;; expand region to successively larger sexps
    magit ;; make Git and Emacs both way cooler
    auto-complete ;; code autocompletion
    markdown-mode ;; major mode for markdown
    smart-tabs-mode ;; indentation with tabs and spaces
    ace-jump-mode ;; immediately jump to any visible character
    ace-jump-zap ;; zap-to-char but harnessing ace-jump
    editorconfig ;; editorconfig plugin
    hl-todo ;; highlight TODO, FIXME, FAIL, etc.
    highlight-symbol ;; navigate between and highlight symbols
    web-mode ;; for editing web files
    elixir-mode ;; for editing Elixir code
    rust-mode ;; for editing Rust code
    buttercup ;; for tests
    smartparens ;; for dealing with paired control flow symbols

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

(provide 'dependencies)

Add smartparens as a dependency

Add smartparens as a dependency


(require 'flycheck)

;; todo: show eldoc in modeline, since the minibuffer is used by
;; flycheck.
(add-hook 'c-mode-hook #'c-turn-on-eldoc-mode)

;; TODO: this doesn't belong here.
(require 'which-func)
(setq which-func-modes (list #'c-mode))
(which-function-mode)

;; C++
(add-hook
 'c++-mode-hook
 (lambda ()
   (setq flycheck-clang-language-standard "c++11"
         flycheck-clang-definitions '("__STDC_LIMIT_MACROS"
                                      "__STDC_CONSTANT_MACROS"))))

(provide 'c-customisations)

(require 'flycheck)

;; todo: show eldoc in modeline, since the minibuffer is used by
;; flycheck.
(add-hook 'c-mode-hook #'c-turn-on-eldoc-mode)

;; TODO: this doesn't belong here.
(require 'which-func)
(setq which-func-modes (list #'c-mode))
(which-function-mode)

;; C++
(add-hook
 'c++-mode-hook
 (lambda ()
   (setq flycheck-clang-language-standard "c++11"
         flycheck-clang-definitions '("__STDC_LIMIT_MACROS"
                                      "__STDC_CONSTANT_MACROS"))))

(add-hook
 'c++-mode-hook
 (lambda ()
   ;; LLVM convention
   (setq c-basic-offset 2)))

(provide 'c-customisations)

Use 2 spaces when indenting C++.

Use 2 spaces when indenting C++.


(require-package 'darcsum)
(require-package 'vc-darcs)

;; TODO: include this in the vc-darcs ELPA package
(add-to-list 'vc-handled-backends 'DARCS)
(autoload 'vc-darcs-find-file-hook "vc-darcs")
(add-hook 'find-file-hooks 'vc-darcs-find-file-hook)

(setq darcsum-whatsnew-switches "-l")

(provide 'init-darcs)

(require-package 'darcsum)
(require-package 'vc-darcs)

;; TODO: include this in the vc-darcs ELPA package
(add-to-list 'vc-handled-backends 'DARCS)
(autoload 'vc-darcs-find-file-hook "vc-darcs")
(add-hook 'find-file-hooks 'vc-darcs-find-file-hook)

(after-load 'vc-darcs
  ;; This variable was removed in an Emacs 25.x snapshot, but vc-darcs
  ;; hasn't been fixed accordingly
  (unless (boundp 'vc-disable-async-diff)
    (setq vc-disable-async-diff nil)))

(setq darcsum-whatsnew-switches "-l")

(provide 'init-darcs)

Work around breakage of vc-darcs by Emacs 25.x changes


(require 'ibuffer)

(require 'ibuffer-vc)

(defun ibuffer-set-up-preferred-filters ()
  (ibuffer-vc-set-filter-groups-by-vc-root)
  (ibuffer-do-sort-by-filename/process))
(add-hook 'ibuffer-mode-hook 'ibuffer-set-up-preferred-filters)

;; Use human readable Size column instead of original one
(define-ibuffer-column size-h
  (:name "Size" :inline t)
  (cond
   ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
   ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
   (t (format "%8d" (buffer-size)))))

;; Modify the default ibuffer-formats
(setq ibuffer-formats
      '((mark modified read-only vc-status-mini " "
              (name 18 18 :left :elide)
              " "
              (size-h 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " "
              (vc-status 16 16 :left)
              " "
              filename-and-process)))

(global-set-key (kbd "C-x C-b") 'ibuffer)

(provide 'init-ibuffer)

(require 'ibuffer)

(require 'ibuffer-vc)

(defun ibuffer-set-up-preferred-filters ()
  (ibuffer-vc-set-filter-groups-by-vc-root)
  (ibuffer-do-sort-by-filename/process))
(add-hook 'ibuffer-mode-hook 'ibuffer-set-up-preferred-filters)

;; Use human readable Size column instead of original one
(define-ibuffer-column size-h
  (:name "Size" :inline t)
  (cond
   ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
   ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
   (t (format "%8d" (buffer-size)))))

;; Modify the default ibuffer-formats
(setq ibuffer-formats
      '((mark modified read-only vc-status-mini " "
              (name 18 18 :left :elide)
              " "
              (size-h 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " "
              (vc-status 16 16 :left)
              " "
              filename-and-process)))

(global-set-key (kbd "C-x C-b") 'ibuffer)

(provide 'init-ibuffer)

Fix size-h ibuffer column definition borrowed from elsewhere, which was incorrect


(setq abbrev-file-name "~/.emacs_abbrev_def")
(setq save-abbrevs t)
(setq-default abbrev-mode t)
(when (file-exists-p abbrev-file-name)
  (quietly-read-abbrev-file))

(setq abbrev-file-name "~/.emacs_abbrev_def")
(unless (file-exists-p abbrev-file-name)
  (write-region "" nil abbrev-file-name))
(setq save-abbrevs t)
(setq-default abbrev-mode t)
(when (file-exists-p abbrev-file-name)
  (quietly-read-abbrev-file))

Create abbrev-file-name if it does not exist to avoid being asked later to create it.


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

;;;###autoload
(add-hook! 'doom-init-ui-hook
  (defun +unicode-init-fonts-h ()
    "Set up `unicode-fonts' to eventually run; accommodating the daemon, if
necessary."
    (setq-default bidi-display-reordering t
                  doom-unicode-font nil)
    (if initial-window-system
        (+unicode-setup-fonts-h (selected-frame))
      (add-hook 'after-make-frame-functions #'+unicode-setup-fonts-h))))

;;;###autoload
(defun +unicode-setup-fonts-h (&optional frame)
  "Initialize `unicode-fonts', if in a GUI session."
  (when (and frame (display-graphic-p frame))
    (with-selected-frame frame
      (require 'unicode-fonts)
      ;; NOTE will impact startup time on first run
      (unicode-fonts-setup))))

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

;;;###autoload
(add-hook! 'doom-init-ui-hook
  (defun +unicode-init-fonts-h ()
    "Set up `unicode-fonts' to eventually run; accommodating the daemon, if
necessary."
    (setq-default bidi-display-reordering t
                  doom-unicode-font nil)
    (if (display-graphic-p)
        (+unicode-setup-fonts-h (selected-frame))
      (add-hook 'after-make-frame-functions #'+unicode-setup-fonts-h))))

;;;###autoload
(defun +unicode-setup-fonts-h (&optional frame)
  "Initialize `unicode-fonts', if in a GUI session."
  (when (and frame (display-graphic-p frame))
    (with-selected-frame frame
      (require 'unicode-fonts)
      ;; NOTE will impact startup time on first run
      (unicode-fonts-setup))))

Make unicode-fonts-setup run when emacs is started in daemon mode


(if nixos
    (progn
      (set-face-attribute 'default nil :family "Inconsolata")
      (set-face-attribute 'default nil :height 130))
  (set-face-attribute 'default nil :family "Input Mono")
  (set-face-attribute 'default nil :height 130))

(defun mjhoy/proportional ()
  "Use a proportional font"
  (interactive)
  (setq buffer-face-mode-face '(:family "Input Sans" :height 130))
  (setq line-spacing 0.3)
  (buffer-face-mode))

(defun mjhoy/mono ()
  "Use a monospace font"
  (interactive)
  (setq buffer-face-mode-face '(:family "Input Mono" :height 130))
  (setq line-spacing 0.2)
  (buffer-face-mode))

;; input is a little tight; increase the line-spacing
(setq-default line-spacing 0.2)
(menu-bar-mode 0)
(when (string-equal system-type "darwin")
  (when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
  (when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
  (when (fboundp 'menu-bar-mode) (menu-bar-mode -1)))

;; right option key use as mac normal option (so i can type é easily)
(setq ns-right-alternate-modifier 'none)

(setq scroll-conservatively 10000)
(show-paren-mode t)
(setq ring-bell-function 'ignore)

(provide 'init-ui)

(set-face-attribute 'default nil :family "Input Mono")
(set-face-attribute 'default nil :height 130)

(defun mjhoy/proportional ()
  "Use a proportional font"
  (interactive)
  (setq buffer-face-mode-face '(:family "Input Sans" :height 130))
  (setq line-spacing 0.3)
  (buffer-face-mode))

(defun mjhoy/mono ()
  "Use a monospace font"
  (interactive)
  (setq buffer-face-mode-face '(:family "Input Mono" :height 130))
  (setq line-spacing 0.2)
  (buffer-face-mode))

;; input is a little tight; increase the line-spacing
(setq-default line-spacing 0.2)
(menu-bar-mode 0)
(when (string-equal system-type "darwin")
  (when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
  (when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
  (when (fboundp 'menu-bar-mode) (menu-bar-mode -1)))

;; right option key use as mac normal option (so i can type é easily)
(setq ns-right-alternate-modifier 'none)

(setq scroll-conservatively 10000)
(show-paren-mode t)
(setq ring-bell-function 'ignore)

(provide 'init-ui)

Revert "emacs: use inconsolata on nix"

Revert "emacs: use inconsolata on nix"

This reverts commit 2c912efc70f7f5ddd78cd9bc9658ca170206b73a.

I've figured out how to install input on nix now.


(require 'package)
(package-initialize)

(provide 'init-elpa)

(require 'package)
(package-initialize)

(when (> emacs-major-version 23)
  (setq package-archives (cons '("tromey" . "http://tromey.com/elpa/") package-archives)))

(provide 'init-elpa)

Add Tom Tromey's ELPA package archive when using Emacs 24, since the new gnu.org archive is almost empty


(require 'anything-config)

(setq anything-sources
      '(anything-c-source-buffers
        anything-c-source-recentf
        anything-c-source-occur
        anything-c-source-files-in-current-dir
        anything-c-source-emacs-commands
        anything-c-source-emacs-functions))

(setq anything-samewindow nil)
(setq anything-input-idle-delay 0.05)

(global-set-key [\M-f10] 'anything)

(provide 'init-anything)

(require 'anything-config)

(setq anything-sources
      '(anything-c-source-org-headline
        anything-c-source-buffers
        anything-c-source-recentf
        anything-c-source-files-in-current-dir
        anything-c-source-emacs-commands
        anything-c-source-emacs-functions
        anything-c-source-minibuffer-history))

(setq anything-samewindow nil)
(setq anything-input-idle-delay 0.2)

(global-set-key [\M-f10] 'anything-at-point) ;; With C-u prefix, starts with symbol at point

(provide 'init-anything)

Add to 'anything-sources, and bind 'anything-at-point instead of 'anything


;;; lang/latex/+viewers.el -*- lexical-binding: t; -*-

;; Update PDF buffers after successful LaTeX runs

(when (featurep! +okular)
  ;; Configure Okular as viewer. Including a bug fix
  ;; (https://bugs.kde.org/show_bug.cgi?id=373855)
  (add-to-list 'TeX-view-program-list '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
  (add-to-list 'TeX-view-program-selection '(output-pdf "Okular")))

;; Or Skim
(when (featurep! +skim)
  (add-to-list 'TeX-view-program-selection 'output-pdf '("Skim")))

;; Or Zathura
(when (featurep! +zathura)
  (add-to-list 'TeX-view-program-selection '(output-pdf "Zathura")))

;; Or PDF-tools, but only if the module is also loaded
(when (and (featurep! :tools pdf)
           (featurep! +pdf-tools))
  (add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
  (add-hook 'TeX-after-compilation-finished-function #'TeX-revert-document-buffer))

;;; lang/latex/+viewers.el -*- lexical-binding: t; -*-

(when (featurep! +okular)
  ;; Configure Okular as viewer. Including a bug fix
  ;; (https://bugs.kde.org/show_bug.cgi?id=373855)
  (add-to-list 'TeX-view-program-list '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
  (add-to-list 'TeX-view-program-selection '(output-pdf "Okular")))

;; Or Skim
(when (featurep! +skim)
  (add-to-list 'TeX-view-program-selection 'output-pdf '("Skim")))

;; Or Zathura
(when (featurep! +zathura)
  (add-to-list 'TeX-view-program-selection '(output-pdf "Zathura")))

;; Or PDF-tools, but only if the module is also loaded
(when (and (featurep! :tools pdf)
           (featurep! +pdf-tools))
  (add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
  ;; Update PDF buffers after successful LaTeX runs
  (add-hook 'TeX-after-compilation-finished-function #'TeX-revert-document-buffer))

Put comment in right place

Put comment in right place


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set windowed interface before immediately to prevent choppy ui changes ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(when window-system
  (menu-bar-mode 1)
  (tool-bar-mode -1)
  (scroll-bar-mode -1)
  (tooltip-mode 1))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set Package repositories ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
	     '("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Install use-package if it's not already installed.            ;;
;; package-refresh-contents ensure packages loaded in new emacs. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; From use-package README ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when-compile
  (require 'use-package))
(require 'diminish)
(require 'bind-key)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load the org config file ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(org-babel-load-file (concat user-emacs-directory "config.org"))

Set up windowed gui at startup.

Set up windowed gui at startup.


;;; setup-help.el --- Help enhancements.
;;; Commentary:
;;; Code:

;; Looking for a way to explore a keymap I found a pretty cool package:
(use-package help-fns+
  :ensure t)

;; Apparently it doesn't have autoload, so let's do this
(require 'help-fns+)
(define-key help-map "\M-k" 'describe-keymap)

;; I use `describe-face' quite often, I'd really like a key for it
(define-key help-map (kbd "C-f") nil)
(define-key help-map (kbd "C-f") #'counsel-describe-face)

;; Command-log is useful sometimes, but let's not autoinstall as it
;; will only slow first run time.
(use-package command-log-mode
  :defer t)

;; which-key seems like a really nice help
(use-package which-key
  :ensure t
  :config
  (which-key-mode)
  :demand
  :diminish which-key-mode)

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

;;; setup-help.el --- Help enhancements.
;;; Commentary:
;;; Code:

;; Looking for a way to explore a keymap I found a pretty cool package:
(use-package help-fns+
  :ensure t)

;; Apparently it doesn't have autoload, so let's do this
(require 'help-fns+)
(define-key help-map "\M-k" 'describe-keymap)

;; I use `describe-face' quite often, I'd really like a key for it
(define-key help-map (kbd "C-f") nil)
(define-key help-map (kbd "C-f") #'counsel-describe-face)

;; Command-log is useful sometimes, but let's not autoinstall as it
;; will only slow first run time.
(use-package command-log-mode
  :defer t)

;; which-key seems like a really nice help
(use-package which-key
  :ensure t
  :config
  (which-key-mode)
  :demand
  :diminish which-key-mode)

;; I've been using woman
(define-key help-map (kbd "C-w") 'woman)

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

Set up a woman key

Set up a woman key


(use-package irony
  :ensure t
  :config
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'objc-mode-hook 'irony-mode)
  )

;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's function
(defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))

(use-package company-irony
  :ensure t
  :config
  (add-to-list 'company-backends '(company-irony))
  (add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
  (add-hook 'irony-mode-hook 'my-irony-mode-hook)
  )

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

(provide 'setup-irony)

(use-package irony
  :ensure t
  :config
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'objc-mode-hook 'irony-mode)
  )

;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's function
(defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))

(use-package company-irony
  :ensure t
  :config
  (add-to-list 'company-backends '(company-irony))
  (add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
  (add-hook 'irony-mode-hook 'my-irony-mode-hook)
  )

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

(use-package irony-eldoc
  :ensure t
  (add-hook 'irony-mode-hook 'irony-eldoc)
  )

(provide 'setup-irony)

Add irony-eldoc to emacs config

Add irony-eldoc to emacs config


;;; lang/rust/autoload.el -*- lexical-binding: t; -*-

;; TODO (defun +rust/run-cargo () (interactive))

;;;###autoload
(defun +rust-cargo-project-p ()
  "Return t if this is a cargo project."
  (locate-dominating-file buffer-file-name "Cargo.toml"))

;;;###autoload
(defun +rust-racer-lookup-documentation (identifier)
  "A `+lookup/documentation' handler for Rust + Racer."
  (let ((buf (racer--describe identifier)))
    (when buf
      (pop-to-buffer buf)
      t)))

;;
;;; Custom Cargo commands

;;;###autoload
(defun +rust/cargo-audit ()
  "Run 'cargo audit' for the current project."
  (interactive)
  (rustic-run-cargo-command "cargo audit -f"))

;;; lang/rust/autoload.el -*- lexical-binding: t; -*-

;; TODO (defun +rust/run-cargo () (interactive))

;;;###autoload
(defun +rust-cargo-project-p ()
  "Return t if this is a cargo project."
  (locate-dominating-file buffer-file-name "Cargo.toml"))

;;;###autoload
(defun +rust-racer-lookup-documentation (identifier)
  "A `+lookup/documentation' handler for Rust + Racer."
  (let ((buf (racer--describe identifier)))
    (when buf
      (pop-to-buffer buf)
      t)))

;;
;;; Custom Cargo commands

;;;###autoload
(defun +rust/cargo-audit ()
  "Run 'cargo audit' for the current project."
  (interactive)
  (rustic-run-cargo-command "cargo audit"))

Modify command to execute `cargo audit`

Modify command to execute `cargo audit`


;; don't show the startup help screen
(setq inhibit-startup-screen t)

;; mode line settings
(column-number-mode t)
(line-number-mode t)
(size-indication-mode t)

;; remove clutter from the UI
(menu-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)

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

;; blinking cursor
(blink-cursor-mode t)

;; enable mouse gestures in terminal
(require 'mouse)
(xterm-mouse-mode t)

;; disable alarm bell beep
(setq ring-bell-function 'ignore)

;; powerline customization
(setq powerline-arrow-shape 'arrow)

;; font
(set-default-font "monospace 12" nil t)

;; don't show the startup help screen
(setq inhibit-startup-screen t)

;; mode line settings
(column-number-mode t)
(line-number-mode t)
(size-indication-mode t)

;; remove clutter from the UI
(menu-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)

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

;; blinking cursor
(blink-cursor-mode t)

;; enable mouse gestures in terminal
(require 'mouse)
(xterm-mouse-mode t)

;; disable alarm bell beep
(setq ring-bell-function 'ignore)

;; powerline customization
(setq powerline-arrow-shape 'arrow)

;; font
(custom-set-faces
 '(default ((t (:family "monospace" :height 120)))))

Change way of customizing the font

Change way of customizing the font


;; disable menu/toolbar/scrollbar
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)

;; open emacs blank scratch
(setq inhibit-splash-screen t
      initial-scratch-message nil)

;; status bar settings
(column-number-mode t)

;; display and format line numbers
(global-linum-mode t)
(setq linum-format "%2d ")

;; highlight current line
(global-hl-line-mode 1)
(set-face-background 'hl-line "#330")

;; enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)

;; show trailing whitespace
(require 'whitespace)
(setq whitespace-line-column 80
      whitespace-style '(face lines-tail trailing))
(add-hook 'prog-mode-hook 'whitespace-mode)

;; syntax highlighting everywhere
(global-font-lock-mode 1)

;; Add proper word wrapping
(global-visual-line-mode t)

;; set tabs to 2 spaces
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)

;; prefer utf8
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

;; load zenburn theme
(load-theme 'zenburn t)

(provide 'jl-ui)

;; disable menu/toolbar/scrollbar
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)

;; open emacs blank scratch
(setq inhibit-splash-screen t
      initial-scratch-message nil)

;; status bar settings
(column-number-mode t)

;; display and format line numbers
(global-linum-mode t)
(setq linum-format "%2d ")

;; highlight current line
(global-hl-line-mode 1)
(set-face-background 'hl-line "#ggg")

;; enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)

;; show trailing whitespace
(require 'whitespace)
(setq whitespace-line-column 80
      whitespace-style '(face lines-tail trailing))
(add-hook 'prog-mode-hook 'whitespace-mode)

;; syntax highlighting everywhere
(global-font-lock-mode 1)

;; Add proper word wrapping
(global-visual-line-mode t)

;; set tabs to 2 spaces
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)

;; prefer utf8
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

;; load zenburn theme
(load-theme 'zenburn t)

(provide 'jl-ui)

emacs: Set the current highlight line color to dark gray


;; Load Evil
(add-to-list 'load-path "~/.emacs.d/evil")
(require 'evil)
(evil-mode 1)

;; Open .v files with Proof General's Coq mode
(load "~/.emacs.d/lisp/PG/generic/proof-site")

(load-theme 'iceberg t)

;; Load Evil
(setq evil-want-abbrev-expand-on-insert-exit nil)
(add-to-list 'load-path "~/.emacs.d/evil")
(require 'evil)
(evil-mode 1)

;; Open .v files with Proof General's Coq mode
(load "~/.emacs.d/lisp/PG/generic/proof-site")

(load-theme 'iceberg t)

emacs: Fix Evil and Proof General compatibility error

See
https://github.com/ProofGeneral/PG/issues/174
https://github.com/syl20bnr/spacemacs/issues/8853


;;; lang/java/+lsp.el -*- lexical-binding: t; -*-
;;;###if (featurep! +lsp)

(use-package! lsp-java
  :after (lsp-clients dap-mode)
  :preface
  (setq lsp-java-server-install-dir (concat doom-etc-dir "eclipse.jdt.ls/server/")
        lsp-java-workspace-dir (concat doom-etc-dir "java-workspace"))
  (add-hook! java-mode-local-vars #'lsp!)
  :config
  ;; TODO keybinds
  )

;;; lang/java/+lsp.el -*- lexical-binding: t; -*-
;;;###if (featurep! +lsp)

(use-package! lsp-java
  :after (lsp-clients dap-mode)
  :preface
  (setq lsp-java-server-install-dir (concat doom-etc-dir "eclipse.jdt.ls/server/")
        lsp-java-workspace-dir (concat doom-etc-dir "java-workspace")
        lsp-jt-root (concat doom-etc-dir "eclipse.jdt.ls/server/java-test/server/"))
  (add-hook! java-mode-local-vars #'lsp!)
  :config
  ;; TODO keybinds
  )

Fix lsp-jt-root in case someone wants to experiment with java-test


;;; vterm-conf.el -- Settings for `vterm' -*- lexical-binding: t -*-
;;
;;; Commentary:
;;
;;; Code:

(require 'vterm)

(declare-function puni-mode "puni")

(custom-set-variables
  '(vterm-buffer-name-string "vterm %s"))

(defun pjones:vterm-mode-hook ()
  "Mode hook for `vterm-mode'."
  (puni-mode -1)) ; Disable puni mode.

(add-hook 'vterm-mode-hook #'pjones:vterm-mode-hook)

;;; vterm-conf.el ends here

;;; vterm-conf.el -- Settings for `vterm' -*- lexical-binding: t -*-
;;
;;; Commentary:
;;
;;; Code:

(require 'vterm)

(declare-function puni-mode "puni")

(custom-set-variables
  '(vterm-buffer-name-string "vterm %s"))

(let ((map vterm-mode-map))
  (define-key map (kbd "C-c C-d") #'pjones:vterm-change-dir)
  (define-key map (kbd "C-c C-g") #'vterm-send-C-g)
  (define-key map (kbd "C-c C-x") #'vterm-send-C-x))

(defun pjones:vterm-change-dir (dir)
  "Change to DIR in the current vterm shell."
  (interactive (list (read-directory-name "cd: ")))
  (vterm-insert "cd " dir)
  (vterm-send-return))

(defun pjones:vterm-mode-hook ()
  "Mode hook for `vterm-mode'."
  (puni-mode -1)) ; Disable puni mode.

(defun pjones:vterm-copy-mode-hook ()
  "Mode hook for `vterm-copy-mode'."
  ;; Restore cursor if it was forced to block:
  (setq cursor-type (alist-get 'cursor-type default-frame-alist))
  ;; Don't move beyond prompt, breaks copy mode:
  (setq-local next-line-add-newlines nil))

(add-hook 'vterm-mode-hook #'pjones:vterm-mode-hook)
(add-hook 'vterm-copy-mode-hook #'pjones:vterm-copy-mode-hook)

;;; vterm-conf.el ends here

vterm: Add some useful key bindings and settings


;; flyspell - On-the-fly spell checking in Emacs
;; http://www-sop.inria.fr/members/Manuel.Serrano/flyspell/flyspell.html
;; This package is installed manually
(use-package flyspell
  :ensure flyspell
  :config
  (add-hook 'markdown-mode-hook 'flyspell-mode)
  (add-hook 'org-mode-hook 'flyspell-mode))

;; popop - Visual Popup Interface Library for Emacs
;; https://github.com/auto-complete/popup-el
;; Custom keys not yet working
(use-package popup
  :ensure popup
  :config
  (evil-define-key 'normal popup-menu-keymap
    (kbd "j") 'popup-next
    (kbd "k") 'popup-previous))

;; flyspell-correct-popup - Correcting words with flyspell via custom interface.
;; https://github.com/d12frosted/flyspell-correct
(use-package flyspell-correct-popup
  :ensure flyspell-correct-popup
  :config
  (evil-leader/set-key "z" 'flyspell-correct-previous-word-generic))

;; auto-dictionaryEmacs: Automatic dictionary switcher for flyspell
;; https://github.com/nschum/auto-dictionary-mode
(use-package auto-dictionary
  :ensure auto-dictionary
  :config
  (add-hook 'flyspell-mode-hook 'auto-dictionary-mode))

(provide 'my-spellchecking)

;; flyspell - On-the-fly spell checking in Emacs
;; http://www-sop.inria.fr/members/Manuel.Serrano/flyspell/flyspell.html
;; This package is installed manually
(use-package flyspell
  :ensure flyspell
  :config
  (add-hook 'markdown-mode-hook 'flyspell-mode)
  (add-hook 'org-mode-hook 'flyspell-mode))

;; popop - Visual Popup Interface Library for Emacs
;; https://github.com/auto-complete/popup-el
;; Custom keys not yet working
(use-package popup
  :ensure popup
  :config
  (evil-define-key 'nil popup-menu-keymap
    (kbd "j") 'popup-next
    (kbd "k") 'popup-previous))

;; flyspell-correct-popup - Correcting words with flyspell via custom interface.
;; https://github.com/d12frosted/flyspell-correct
(use-package flyspell-correct-popup
  :ensure flyspell-correct-popup
  :config
  (evil-leader/set-key "z" 'flyspell-correct-previous-word-generic))

;; auto-dictionaryEmacs: Automatic dictionary switcher for flyspell
;; https://github.com/nschum/auto-dictionary-mode
(use-package auto-dictionary
  :ensure auto-dictionary
  :config
  (add-hook 'flyspell-mode-hook 'auto-dictionary-mode))

(provide 'my-spellchecking)

Fix evil keys not working in popup-menu

Fix evil keys not working in popup-menu


(("verilog-mode/src"
  . ((nil . ((do-not-delete-trailing-whitespace . t)
             ;; Thu Jan 26 11:12:48 EST 2017 - kmodi
             ;; Do not turn on whitespace-mode as magit does not like it.
             ;; user-error: Whitespace-Mode isn’t compatible with Magit.  See
             ;; `magit-diff-paint-whitespace' for an alternative.
             ;; (eval . (whitespace-mode 1))
             ))
     (emacs-lisp-mode . ((lisp-indent-function . lisp-indent-function)
                         (aggressive-indent-mode . nil)))))
 ("matlab-emacs/src"
  . ((emacs-lisp-mode . ((lisp-indent-function . lisp-indent-function)
                         (aggressive-indent-mode . nil))))))

(("verilog-mode/src"
  . ((nil . ((do-not-delete-trailing-whitespace . t)
             ;; Thu Jan 26 11:12:48 EST 2017 - kmodi
             ;; Do not turn on whitespace-mode as magit does not like it.
             ;; user-error: Whitespace-Mode isn’t compatible with Magit.  See
             ;; `magit-diff-paint-whitespace' for an alternative.
             ;; (eval . (whitespace-mode 1))
             (fill-column . 70)))
     (emacs-lisp-mode . ((lisp-indent-function . lisp-indent-function)
                         (aggressive-indent-mode . nil)))))
 ("matlab-emacs/src"
  . ((emacs-lisp-mode . ((lisp-indent-function . lisp-indent-function)
                         (aggressive-indent-mode . nil))))))

Set fill-column to the default 70 for files in verilog-mode repo


;;; config.el --- Haskell Layer configuration File for Spacemacs
;;
;; Copyright (c) 2015 Bjarke Vad Andersen
;;
;; Author: Bjarke Vad Andersen <bjarke.vad90@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;; Variables

(spacemacs|defvar-company-backends haskell-mode)
(spacemacs|defvar-company-backends haskell-cabal-mode)

(defvar haskell-enable-ghci-ng-support nil
  "If non-nil ghci-ng support is enabled")

(defvar haskell-enable-shm-support nil
  "If non-nil structured-haskell-mode support is enabled")

(defvar haskell-enable-hindent-style nil
  "Style to use for formatting with hindent; available are: fundamental johan-tibell chris-done andrew-gibiansky. If nil hindent is disabled.")

(defvar haskell-enable-ghc-mod-support t
  "If non-nil ghc-mod support is enabled")

;;; config.el --- Haskell Layer configuration File for Spacemacs
;;
;; Copyright (c) 2015 Bjarke Vad Andersen
;;
;; Author: Bjarke Vad Andersen <bjarke.vad90@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;; Variables

(spacemacs|defvar-company-backends haskell-mode)
(spacemacs|defvar-company-backends haskell-cabal-mode)

(defvar haskell-enable-ghci-ng-support nil
  "If non-nil ghci-ng support is enabled")

(defvar haskell-enable-shm-support nil
  "If non-nil structured-haskell-mode support is enabled")

(defvar haskell-enable-hindent-style nil
  "Style to use for formatting with hindent; available are: fundamental johan-tibell chris-done gibiansky. If nil hindent is disabled.")

(defvar haskell-enable-ghc-mod-support t
  "If non-nil ghc-mod support is enabled")

Update doc string for haskell-enable-hindent-style

Info was updated in README file, but not in doc string. Following #1786.


(maybe-require-package 'httprepl)
(when (maybe-require-package 'restclient)
  (defun sanityinc/restclient ()
    (interactive)
    (with-current-buffer (get-buffer-create "*restclient*")
      (restclient-mode)
      (pop-to-buffer (current-buffer)))))

(provide 'init-http)

(maybe-require-package 'httprepl)
(when (maybe-require-package 'restclient)
  (add-auto-mode 'restclient-mode "\\.rest\\'")

  (defun sanityinc/restclient ()
    (interactive)
    (with-current-buffer (get-buffer-create "*restclient*")
      (restclient-mode)
      (pop-to-buffer (current-buffer)))))

(provide 'init-http)

Use restclient-mode for .rest files

Use restclient-mode for .rest files


;; coffee-mode
(require 'coffee-mode)

(defun coffee-custom ()
  "coffee-mode-hook"
  (set (make-local-variable 'tab-width) 2)
  (set (make-local-variable 'coffee-tab-width) 2))

(add-hook 'coffee-mode-hook
  '(lambda() (coffee-custom)))

;; flymake-coffee
(require 'flymake-coffee)
(add-hook 'coffee-mode-hook 'flymake-coffee-load)
(setq flymake-coffee-coffeelint-configuration-file (expand-file-name "~/.emacs.d/coffeelint.json"))

;; coffee-mode
(require 'coffee-mode)

(defun coffee-custom ()
  "coffee-mode-hook"
  (set (make-local-variable 'tab-width) 2)
  (set (make-local-variable 'coffee-tab-width) 2))

(add-hook 'coffee-mode-hook
  '(lambda() (coffee-custom)))

;; ;; flymake-coffee
;; ;; Removed 26/09/2016 as it stopped search and replace accross multiple coffeescript files from working.
;; (require 'flymake-coffee)
;; (add-hook 'coffee-mode-hook 'flymake-coffee-load)
;; (setq flymake-coffee-coffeelint-configuration-file (expand-file-name "~/.emacs.d/coffeelint.json"))

Fix search and replace across coffeescript files