;;; radian-help.el --- Improve the Emacs help system

(require 'radian-package)

;; This package provides several useful features, but the most
;; important is `describe-keymap'. Because the package is rather
;; outdated, it's not autoloaded. (But `use-package' takes care of
;; that for us.)
(use-package help-fns+
  :defer-install t
  :bind (("C-h M-k" . describe-keymap)))

(provide 'radian-help)

;;; radian-help.el ends here

;;; radian-help.el --- Improve the Emacs help system

(require 'radian-package)

;; This package provides several useful features, but the most
;; important is `describe-keymap'. Because the package is rather
;; outdated, it's not autoloaded. (But `use-package' takes care of
;; that for us.)
(use-package help-fns+
  :defer-install t
  :bind (("C-h M-k" . describe-keymap)
         ;; Prevent help-fns+ from overriding this built-in
         ;; keybinding:
         ("C-h o" . describe-symbol)))

(provide 'radian-help)

;;; radian-help.el ends here

Make sure describe-symbol isn't unbound

Make sure describe-symbol isn't unbound


(require 'maxframe)
(when *is-cocoa-emacs*
  (fset 'maximize-frame 'x-maximize-frame)
  (fset 'restore-frame 'x-restore-frame))
(when *macbook-pro-support-enabled*
  (setq mf-max-width 1440
        mf-max-height 890
        mf-display-padding-width 4
        mf-offset-x 0
        mf-display-padding-height (if ns-auto-hide-menu-bar
                                      23
                                    (+ 22 23))))

(defun maybe-maximize-frame (&optional frame)
  (with-selected-frame frame
    (if window-system (maximize-frame))))

(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)

(defun maximized-p (&optional frame)
  (or (not (with-selected-frame frame window-system))
      (and (<= (abs (- (mf-max-display-pixel-width) (frame-pixel-width frame))) (frame-char-width frame))
           (<= (abs (- (mf-max-display-pixel-height) (+ mf-display-padding-height (frame-pixel-height frame)))) (+ 5 (frame-char-height frame))))))

(provide 'init-maxframe)

(require 'maxframe)
(when *is-cocoa-emacs*
  (fset 'maximize-frame 'x-maximize-frame)
  (fset 'restore-frame 'x-restore-frame))
(when *macbook-pro-support-enabled*
  (setq mf-max-width 1440
        mf-max-height 894
        mf-display-padding-width 4
        mf-offset-x 0
        mf-display-padding-height (if ns-auto-hide-menu-bar
                                      23
                                    (+ 22 23))))

(defun maybe-maximize-frame (&optional frame)
  (with-selected-frame frame
    (if window-system (maximize-frame))))

(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)

(defun maximized-p (&optional frame)
  (or (not (with-selected-frame frame window-system))
      (and (<= (abs (- (mf-max-display-pixel-width) (frame-pixel-width frame))) (frame-char-width frame))
           (<= (abs (- (mf-max-display-pixel-height) (+ mf-display-padding-height (frame-pixel-height frame)))) (+ 5 (frame-char-height frame))))))

(provide 'init-maxframe)

Tweak max window height for maxframe under OS X


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

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

(defvar pjones:packages
  '( bbdb
     bm
     company
     company-flx
     company-ghc
     dictionary
     flycheck
     flx
     flx-ido
     gist
     haskell-mode
     htmlize
     http
     hydra
     inf-ruby
     kite
     magit
     markdown-mode
     nix-mode
     projectile
     rhtml-mode
     ruby-end
     scad-mode
     smex
     yaml-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
  '(("org"       . "http://orgmode.org/elpa/")
    ("melpa"     . "http://melpa.org/packages/")
    ("marmalade" . "http://marmalade-repo.org/packages/"))
  "List of package archives to use with Emacs.")

(defvar pjones:packages
  '( bbdb
     bm
     company
     company-flx
     company-ghc
     dictionary
     flycheck
     flx
     flx-ido
     gist
     haskell-mode
     htmlize
     http
     hydra
     inf-ruby
     kite
     magit
     markdown-mode
     nix-mode
     projectile
     no-littering
     rhtml-mode
     ruby-end
     scad-mode
     smex
     yaml-mode )
  "A list of packages to ensure are installed at launch.")

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

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

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

Add the no-littering package. Still need to configure it


(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.
 '(global-hl-todo-mode t)
 '(hl-todo-activate-in-modes (quote (prog-mode yaml-mode)))
 '(safe-local-variable-values
   (quote
    ((org-src-preserve-indentation . t)
     (org-src-fontify-natively . t)))))
(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.
 )

;; TODO: (add-to-list 'org-structure-template-alist '("n" "#+NAME: ?"))

Add note re: org-mode hack

[emacs] Add note re: org-mode hack


(require 'workgroups2)
(setq wg-use-default-session-file nil)
(workgroups-mode 1) ; put this one at the bottom of .emacs
;; by default, the sessions are saved in "~/.emacs_workgroups"
(provide 'init-workgroups2)

(require 'workgroups2)
(workgroups-mode 1) ; put this one at the bottom of .emacs
;; by default, the sessions are saved in "~/.emacs_workgroups"
(provide 'init-workgroups2)

Revert "prevent workgroups2 to load profile when start up"

This reverts commit 44cdfcb5a64062b5ba494efd02c3d882f3510389.


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

(use-package! highlight-indent-guides
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character)
  :config
  (defun +indent-guides-init-faces-h ()
    (when (display-graphic-p)
      (highlight-indent-guides-auto-set-faces)))

  ;; HACK `highlight-indent-guides' calculates its faces from the current theme,
  ;;      but is unable to do so properly in terminal Emacs, where it only has
  ;;      access to 256 colors. So if the user uses a daemon we must wait for
  ;;      the first graphical frame to be available to do.
  (add-hook (if (daemonp)
                'server-after-make-frame-hook
              'doom-load-theme-hook)
            #'+indent-guides-init-faces-h)

  ;; `highlight-indent-guides' breaks when `org-indent-mode' is active
  (add-hook! 'org-indent-mode-hook
    (defun +indent-guides-disable-maybe-h ()
      (when highlight-indent-guides-mode
        (highlight-indent-guides-mode -1)))))

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

(use-package! highlight-indent-guides
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character)

  ;; HACK The default \x2502 appears to be slow on macOS. This needs more
  ;;      testing, but for now we use another bar unicode glyph, which is
  ;;      reportedly faster.
  (when IS-MAC
    (setq highlight-indent-guides-character ?\xFFE8))
  :config
  (defun +indent-guides-init-faces-h ()
    (when (display-graphic-p)
      (highlight-indent-guides-auto-set-faces)))

  ;; HACK `highlight-indent-guides' calculates its faces from the current theme,
  ;;      but is unable to do so properly in terminal Emacs, where it only has
  ;;      access to 256 colors. So if the user uses a daemon we must wait for
  ;;      the first graphical frame to be available to do.
  (add-hook (if (daemonp)
                'server-after-make-frame-hook
              'doom-load-theme-hook)
            #'+indent-guides-init-faces-h)

  ;; `highlight-indent-guides' breaks when `org-indent-mode' is active
  (add-hook! 'org-indent-mode-hook
    (defun +indent-guides-disable-maybe-h ()
      (when highlight-indent-guides-mode
        (highlight-indent-guides-mode -1)))))

Use (supposedly) faster indent-guides glyph


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

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

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

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

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

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

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

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

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

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

Update the tab key to run hippie-expand

Update the tab key to run hippie-expand


(require 'css-mode)

(add-hook 'css-mode-hook #'set-tab)
(add-hook 'css-mode-hook #'electric-operator-mode)
(add-hook 'css-mode-hook #'aggressive-indent-mode)

(require 'css-mode)

(add-hook 'css-mode-hook #'set-tab t)
(add-hook 'css-mode-hook #'electric-operator-mode)
(add-hook 'css-mode-hook #'aggressive-indent-mode)

Fix tab key in css mode

Fix tab key in css mode


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

;;;###autoload
(defun +hl-todo|use-face-detection ()
  "Use a different, more primitive method of locating todo keywords.

This is useful for major modes that don't use or have a valid syntax-table entry
for comment start/end characters."
  (set (make-local-variable 'hl-todo-keywords)
       `(((lambda (limit)
            (let (case-fold-search)
              (and (re-search-forward hl-todo-regexp limit t)
                   (memq 'font-lock-comment-face (doom-enlist (get-text-property (point) 'face)))))
            (1 (hl-todo-get-face) t t))))))

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

;;;###autoload
(defun +hl-todo|use-face-detection ()
  "Use a different, more primitive method of locating todo keywords.

This is useful for major modes that don't use or have a valid syntax-table entry
for comment start/end characters."
  (set (make-local-variable 'hl-todo-keywords)
       '(((lambda (limit)
            (let (case-fold-search)
              (and (re-search-forward hl-todo-regexp limit t)
                   (memq 'font-lock-comment-face (doom-enlist (get-text-property (point) 'face))))))
          (1 (hl-todo-get-face) t t))))
  (when hl-todo-mode
    (hl-todo-mode -1)
    (hl-todo-mode +1)))

Reset hl-todo-mode if already active

Reset hl-todo-mode if already active


;;; init-grep.el --- Settings for grep and grep-like tools -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

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

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

(require-package 'wgrep)
(with-eval-after-load 'grep
  (dolist (key (list (kbd "C-c C-q") (kbd "w")))
    (define-key grep-mode-map key 'wgrep-change-to-wgrep-mode)))

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

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

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

;;; init-grep.el --- Settings for grep and grep-like tools -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

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

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

(require-package 'wgrep)
(with-eval-after-load 'grep
  (dolist (key (list (kbd "C-c C-q") (kbd "w")))
    (define-key grep-mode-map key 'wgrep-change-to-wgrep-mode)))

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

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

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

Make it work with tramp

[WIP] rg: Make it work with tramp


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

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

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

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

Revise key bindings for string-inflection package

  - camelCase -> c
  - CamelCase -> C
  - lisp -> l


;; common
(load-file "~/.emacs.d/conf/common/package.el")
(load-file "~/.emacs.d/conf/common/el-get.el")

(load-file "~/.emacs.d/conf/common/mailcrypt.el")
;; multi-term breaks with emacs 24.4
;;(load-file "~/.emacs.d/conf/common/multi-term.el")
(load-file "~/.emacs.d/conf/common/tramp.el")

(load-file "~/.emacs.d/conf/dired.el")

(setq inhibit-startup-screen t)
(tool-bar-mode -1)
(setq display-time-mode nil)

;; common
(load-file "~/.emacs.d/conf/common/package.el")
(load-file "~/.emacs.d/conf/common/el-get.el")

(load-file "~/.emacs.d/conf/common/mailcrypt.el")
;; multi-term breaks with emacs 24.4
;;(load-file "~/.emacs.d/conf/common/multi-term.el")
(load-file "~/.emacs.d/conf/common/tramp.el")

(load-file "~/.emacs.d/conf/common/dired.el")

(setq inhibit-startup-screen t)
(tool-bar-mode -1)
(setq display-time-mode nil)

Fix the path to dired.el

Fix the path to dired.el


(require 'maxframe)
(when *is-cocoa-emacs*
  (fset 'maximize-frame 'x-maximize-frame)
  (fset 'restore-frame 'x-restore-frame))
(when *macbook-pro-support-enabled*
  (setq mf-max-width 1440)
  (setq mf-max-height 898)
  (setq mf-offset-x 0))

(defmacro with-selected-frame (frame &rest forms)
  (let ((prev-frame (gensym)))
    `(progn
       (let ((,prev-frame (selected-frame)))
         (select-frame (or ,frame (selected-frame)))
         (unwind-protect
             (progn ,@forms)
           (select-frame ,prev-frame))))))

(defun maybe-maximize-frame (&optional frame)
  (with-selected-frame frame
    (if window-system (maximize-frame))))

(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)

(defun maximized-p (&optional frame)
  (or (not (with-selected-frame frame window-system))
      (and (<= (abs (- (mf-max-display-pixel-width) (frame-pixel-width frame))) (frame-char-width frame))
           (<= (abs (- (mf-max-display-pixel-height) (+ mf-display-padding-height (frame-pixel-height frame)))) (+ 5 (frame-char-height frame))))))

(provide 'init-maxframe)

(require 'maxframe)
(when *is-cocoa-emacs*
  (fset 'maximize-frame 'x-maximize-frame)
  (fset 'restore-frame 'x-restore-frame))
(when *macbook-pro-support-enabled*
  (setq mf-max-width 1440)
  (setq mf-max-height 890)
  (setq mf-offset-x 0))

(defmacro with-selected-frame (frame &rest forms)
  (let ((prev-frame (gensym)))
    `(progn
       (let ((,prev-frame (selected-frame)))
         (select-frame (or ,frame (selected-frame)))
         (unwind-protect
             (progn ,@forms)
           (select-frame ,prev-frame))))))

(defun maybe-maximize-frame (&optional frame)
  (with-selected-frame frame
    (if window-system (maximize-frame))))

(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)

(defun maximized-p (&optional frame)
  (or (not (with-selected-frame frame window-system))
      (and (<= (abs (- (mf-max-display-pixel-width) (frame-pixel-width frame))) (frame-char-width frame))
           (<= (abs (- (mf-max-display-pixel-height) (+ mf-display-padding-height (frame-pixel-height frame)))) (+ 5 (frame-char-height frame))))))

(provide 'init-maxframe)

Fix macbook pro max screen height

Fix macbook pro max screen height


;; 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
    (geiser flycheck 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
    (feature-mode geiser flycheck 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.
 )

Add feature-mode for writing gherkin format files.


(use-package tex
  :ensure auctex
  :init
  (setq TeX-PDF-mode t)
  (add-hook 'LaTeX-mode-hook 'visual-line-mode)
    )

(use-package auctex-latexmk
  :ensure t
  :init (auctex-latexmk-setup)
  (setq auctex-latexmk-inherit-TeX-PDF-mode t)
  )

(use-package company-auctex
  :ensure t
  )

(provide 'setup-tex)

(use-package tex
  :ensure auctex
  :init
  (setq TeX-PDF-mode t)
  (add-hook 'LaTeX-mode-hook 'visual-line-mode)
  ;; ##### Always ask for the master file
  ;; ##### when creating a new TeX file.
  (setq-default TeX-master nil)

  ;; ##### Enable synctex correlation. From Okular just press
  ;; ##### Shift + Left click to go to the good line.
  (setq TeX-source-correlate-mode t
        TeX-source-correlate-start-server t)

  ;; ### Set Okular as the default PDF viewer.
  (eval-after-load "tex"
    '(setcar (cdr (assoc 'output-pdf TeX-view-program-selection)) "Okular"))
  )

(use-package auctex-latexmk
  :ensure t
  :init (auctex-latexmk-setup)
  (setq auctex-latexmk-inherit-TeX-PDF-mode t)
  )

(use-package company-auctex
  :ensure t
  )

;; ##### Don't forget to configure
;; ##### Okular to use emacs in
;; ##### "Configuration/Configure Okular/Editor"
;; ##### => Editor => Emacsclient. (you should see
;; ##### emacsclient -a emacs --no-wait +%l %f
;; ##### in the field "Command".

(provide 'setup-tex)

Add sync for okular and emacs

Add sync for okular and emacs


;; Time-stamp: <2016-05-19 22:18:00 kmodi>

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

(use-package magit
  :defer t)

(provide 'setup-magit)

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

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

;; Time-stamp: <2017-05-09 15:49:51 kmodi>

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

(use-package magit
  :bind (:map modi-mode-map
         ("C-c g". hydra-magit/body))
  :commands (magit-status magit-log-all-branches)
  :config
  (progn
    (defhydra hydra-magit (:color blue
                           :columns 4)
      "Magit"
      ("g" magit-status "status")
      ("s" magit-status "status")
      ("l" magit-log-all-branches "log")
      ("b" magit-branch-popup "branch popup")
      ("r" magit-rebase-popup "rebase popup")
      ("f" magit-fetch-popup "fetch popup")
      ("P" magit-push-popup "push popup")
      ("F" magit-pull-popup "pull popup")
      ("W" magit-format-patch "format patch")
      ("$" magit-process "process"))))

(provide 'setup-magit)

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

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

Add hydra-magit; bind to C-c g

Add hydra-magit; bind to C-c g


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

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

(prelude-require-packages '(
                            ag
                            aggressive-indent
                            bats-mode
                            chruby
                            color-theme-sanityinc-tomorrow
                            editorconfig
                            ember-mode
                            evil-args
                            evil-exchange
                            evil-jumper
                            evil-matchit
                            evil-nerd-commenter
                            evil-smartparens
                            fill-column-indicator
                            flycheck-rust
                            frame-cmds
                            gruvbox-theme
                            handlebars-mode
                            helm-ag
                            js2-refactor
                            monokai-theme
                            multiple-cursors
                            nginx-mode
                            nlinum
                            nyan-mode
                            paredit
                            php-mode
                            projectile-rails
                            rhtml-mode
                            ruby-compilation
                            rust-mode
                            solarized-theme
                            smart-mode-line
                            toggle-quotes
                            window-jump
                            window-number
                            yagist
                            yasnippet
                            ))

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

Add handlebars and ember modes

Add handlebars and ember modes


(req-package org
  :mode ("\\.org\\'" . org-mode))

(req-package org-bullets
  :require org
  :init
  (progn
    (add-hook 'org-mode-hook 'org-bullets-mode)))

(req-package org
  :mode ("\\.org\\'" . org-mode)
  :config
  (progn
    (add-to-list 'org-latex-packages-alist '("" "minted"))
    (setq org-latex-listings 'minted)
    (setq org-latex-pdf-process
          '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
            "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
            "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
    (setq org-latex-minted-options '(("breaklines" "true")))))

(req-package org-bullets
  :require org
  :init
  (progn
    (add-hook 'org-mode-hook 'org-bullets-mode)))

Add minted for latex code block

Add minted for latex code block


;;; seanmacs-version-control.el --- Version control -*- lexical-binding: t; -*-

;;; Commentary:
;; VC configuration.

;;; Code:

(use-package ediff
  ;; built-in
  :init
  (setq-default ediff-split-window-function #'split-window-horizontally
                ediff-merge-split-window-function #'split-window-horizontally
                ediff-window-setup-function #'ediff-setup-windows-plain))

(use-package magit
  :straight t
  :defer t)

(use-package forge
  :straight t
  :after magit
  :config
  (setq forge-pull-notifications nil)
  (transient-append-suffix 'forge-dispatch "c u"
    '("c r" "review pull request" github-review-forge-pr-at-point)))

(use-package github-review
  :straight t
  :defer t
  :commands (github-review-start github-review-forge-pr-at-point))

(use-package evil-magit
  :straight t
  :after magit)

(use-package diff-hl
  :straight t
  :config
  (global-diff-hl-mode)
  :hook ((magit-post-refresh . diff-hl-magit-post-refresh)))

(provide 'seanmacs-version-control)
;;; seanmacs-version-control.el ends here

;;; seanmacs-version-control.el --- Version control -*- lexical-binding: t; -*-

;;; Commentary:
;; VC configuration.

;;; Code:

(use-package ediff
  ;; built-in
  :init
  (setq-default ediff-split-window-function #'split-window-horizontally
                ediff-merge-split-window-function #'split-window-horizontally
                ediff-window-setup-function #'ediff-setup-windows-plain))

(use-package magit
  :straight t
  :defer t
  :config
  (add-to-list 'magit-status-sections-hook 'magit-insert-modules t)
  (setq magit-module-sections-nested nil))

(use-package forge
  :straight t
  :after magit
  :config
  (setq forge-pull-notifications nil)
  (transient-append-suffix 'forge-dispatch "c u"
    '("c r" "review pull request" github-review-forge-pr-at-point)))

(use-package github-review
  :straight t
  :defer t
  :commands (github-review-start github-review-forge-pr-at-point))

(use-package evil-magit
  :straight t
  :after magit)

(use-package diff-hl
  :straight t
  :config
  (global-diff-hl-mode)
  :hook ((magit-post-refresh . diff-hl-magit-post-refresh)))

(provide 'seanmacs-version-control)
;;; seanmacs-version-control.el ends here

Add modules section to magit status buffer


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

;; Place your private configuration here

(setq
 doom-font (font-spec :family "Iosevka" :size 16)
 doom-theme 'doom-one-light)

; doom-theme 'doom-molokai)

; ln -s /Users/david/Library/Mobile\ Documents/iCloud\~com\~appsonthemove\~beorg/Documents/org org
(setq org-agenda-files
      (list
       "~/org/inbox.org"
       "~/org/notes.org"
       "~/org/zignyl.org"))

; log the time when something is marked done
(setq org-log-done 'time)

(map! (:map override
        "C-l" #'switch-to-buffer)

      ;; global keybindings
      :n "J" #'evil-scroll-page-down
      :n "K" #'evil-scroll-page-up

      :v "\\\\" #'evil-commentary-line)

;      :localleader
;      "s" #'whitespace-mode)

(setq
 mac-command-modifier 'meta
 mac-option-modifier 'super)

(setq doom-localleader-key ",")

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

;; Place your private configuration here

(setq
 doom-font (font-spec :family "Iosevka" :size 16)
 doom-theme 'leuven)

; doom-theme 'doom-molokai)

; ln -s /Users/david/Library/Mobile\ Documents/iCloud\~com\~appsonthemove\~beorg/Documents/org org
(setq org-agenda-files '("~/org"))

; log the time when something is marked done
(setq org-log-done 'time)

(map! (:map override
        "C-l" #'switch-to-buffer)

      ;; global keybindings
      :n "J" #'evil-scroll-page-down
      :n "K" #'evil-scroll-page-up

      :v "\\\\" #'evil-commentary-line)

;      :localleader
;      "s" #'whitespace-mode)

(setq
 mac-command-modifier 'meta
 mac-option-modifier 'super)

(setq doom-localleader-key ",")

Change color theme, track all under ~/org


(require 'flycheck)

(flycheck-define-checker sbt
  "Checker for compilation with SBT"
  :command ("esbt")
  :error-patterns
  ((error line-start "[error] " (file-name) ":" line ": "
          (message (zero-or-more not-newline)
                   (one-or-more "\n" blank
                                 (zero-or-more not-newline)))
          line-end)
   (warn line-start "[warn] " (file-name) ":" line ": "
          (message (zero-or-more not-newline)
                   (one-or-more "\n" blank
                                 (zero-or-more not-newline)))
          line-end))
  :modes scala-mode)

(flycheck-add-next-checker 'sbt 'scala)

(global-set-key (kbd "<f7>") 'flycheck-previous-error)
(global-set-key (kbd "<f8>") 'flycheck-buffer)
(global-set-key (kbd "<f9>") 'flycheck-next-error)

(require 'flycheck)

(flycheck-define-checker sbt
  "Checker for compilation with SBT"
  :command ("esbt")
  :error-patterns
  ((error line-start "[error] " (file-name) ":" line ": "
          (message (zero-or-more not-newline)
                   (one-or-more "\n" blank
                                 (zero-or-more not-newline)))
          line-end)
   (warn line-start "[warn] " (file-name) ":" line ": "
          (message (zero-or-more not-newline)
                   (one-or-more "\n" blank
                                 (zero-or-more not-newline)))
          line-end))
  :modes scala-mode)

(flycheck-add-next-checker 'sbt 'scala)

(defun touch-and-check-buffer ()
  "Touch and save the buffer before checking syntax."
  (interactive)
  (save-excursion
    (end-of-line nil)
    (insert " ")
    (save-buffer)
    (flycheck-buffer)))

(global-set-key (kbd "<f7>") 'flycheck-previous-error)
(global-set-key (kbd "<f8>") 'touch-and-check-buffer)
(global-set-key (kbd "<f9>") 'flycheck-next-error)

Tweak flycheck-check-buffer so it modifies the file


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

;; I used to have a prefix for the mode toggle, but I think hydras can be very useful, because the help can be displayed vertically.
(defhydra mode-toggle (:color blue
                       :columns 1)
  "Toggle one of these modes"
  ("e" evil-mode "Evil mode")
  ("w" whitespace-mode "Whitespace mode")
  ("l" linum-relative-mode "Linum relative")
  ("c" color-identifiers-mode "Color identifiers mode")
  ("v" visual-line-mode "Visual line mode")
  ("p" projectile-mode "Projectile")
  ("k" which-key-mode "Which key")
  ("h" global-hl-line-mode "Highlight line")
  ("a" artist-mode "Artist mode")
  ("s" key-chord-mode "Key chord mode")
  ("q" nil "quit"))

(global-set-key (kbd "<f6>") 'mode-toggle/body)

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

;; I tried this but I don't really like vim so let's not ensure this
;; one
(use-package evil
  :defer t)

(use-package camcorder
  :defer t)

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

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

;; I used to have a prefix for the mode toggle, but I think hydras can be very useful, because the help can be displayed vertically.
(defhydra mode-toggle (:color blue
                       :columns 1)
  "Toggle one of these modes"
  ("e" evil-mode "Evil mode")
  ("w" whitespace-mode "Whitespace mode")
  ("l" linum-relative-mode "Linum relative")
  ("c" color-identifiers-mode "Color identifiers mode")
  ("v" visual-line-mode "Visual line mode")
  ("p" projectile-mode "Projectile")
  ("k" which-key-mode "Which key")
  ("h" hl-line-mode "Highlight line")
  ("a" artist-mode "Artist mode")
  ("s" key-chord-mode "Key chord mode")
  ("q" nil "quit"))

(define-key meta-m-map (kbd "m") 'mode-toggle/body)

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

;; I tried this but I don't really like vim so let's not ensure this
;; one
(use-package evil
  :defer t)

(use-package camcorder
  :defer t)

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

Fix hl-line mode and bind mode hydra to meta-m map


(defun /lsp/activate ()
  (interactive)

  (require-package 'lsp-mode)
  (require-package 'lsp-ui)
  (require-package 'lsp-treemacs)
  (require-package 'company-lsp)

  (setq lsp-prefer-flymake nil) ;; use flycheck
  (setq lsp-session-file (concat dotemacs-cache-directory ".lsp-session-v1"))
  (setq lsp-keep-workspace-alive nil)

  (setq lsp-ui-doc-include-signature t)
  (setq lsp-ui-doc-header t)
  (setq lsp-ui-doc-position 'top)

  (lsp)
  (lsp-treemacs-sync-mode t))

(defun /lsp/suggest-project-root ()
  "Suggests the nearest project that is not a dependency."
  (or
   (locate-dominating-file
    (buffer-file-name)
    (lambda (dir)
      (if (string-match-p "node_modules" dir)
          nil
        (file-exists-p (concat dir "package.json")))))
   (projectile-project-root)))

(after 'lsp-mode
  (advice-add #'lsp--suggest-project-root :override #'/lsp/suggest-project-root))

(provide 'config-lsp)

(defgroup dotemacs-lsp nil
  "Configuration options for LSP."
  :group 'dotemacs
  :prefix 'dotemacs-lsp)

(defcustom dotemacs-lsp/inhibit-paths '("node_modules")
  "A list of paths that should not activate LSP."
  :type '(repeat string)
  :group 'dotemacs-lsp)

(defun /lsp/activate ()
  (interactive)
  (unless (seq-filter
           (lambda (path)
             (string-match-p path (buffer-file-name)))
           dotemacs-lsp/inhibit-paths)
    (/lsp/do-activate)))

(defun /lsp/do-activate ()
  (require-package 'lsp-mode)
  (require-package 'lsp-ui)
  (require-package 'lsp-treemacs)
  (require-package 'company-lsp)

  (setq lsp-prefer-flymake nil) ;; use flycheck
  (setq lsp-session-file (concat dotemacs-cache-directory ".lsp-session-v1"))
  (setq lsp-keep-workspace-alive nil)

  (setq lsp-ui-doc-include-signature t)
  (setq lsp-ui-doc-header t)
  (setq lsp-ui-doc-position 'top)

  (lsp)
  (lsp-treemacs-sync-mode t))

(defun /lsp/suggest-project-root ()
  "Suggests the nearest project that is not a dependency."
  (or
   (locate-dominating-file
    (buffer-file-name)
    (lambda (dir)
      (if (string-match-p "node_modules" dir)
          nil
        (file-exists-p (concat dir "package.json")))))
   (projectile-project-root)))

(after 'lsp-mode
  (advice-add #'lsp--suggest-project-root :override #'/lsp/suggest-project-root))

(provide 'config-lsp)

Add inhibit filter for LSP

Add inhibit filter for LSP


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

(def-package! highlight-indent-guides
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character
        highlight-indent-guides-responsive 'top)
  :config
  ;; Don't display first level of indentation
  (defun +indent-guides-for-all-but-first-column (level responsive display)
    (unless (< level 1)
      (highlight-indent-guides--highlighter-default level responsive display)))
  (setq highlight-indent-guides-highlighter-function #'+indent-guides-for-all-but-first-column))

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

(def-package! highlight-indent-guides
  :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode)
  :init
  (setq highlight-indent-guides-method 'character
        highlight-indent-guides-responsive 'top)
  :config
  ;; Don't display first level of indentation
  (defun +indent-guides-for-all-but-first-column (level responsive display)
    (unless (< level 1)
      (highlight-indent-guides--highlighter-default level responsive display)))
  (setq highlight-indent-guides-highlighter-function #'+indent-guides-for-all-but-first-column)

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

Disable indent guides in incompatible modes

e.g. visual-line-mode & org-indent-mode


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

(def-package! intero
  :commands intero-mode
  :init
  (defun +haskell|init-intero ()
    "Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
This is necessary because `intero-mode' doesn't do its own error checks."
    (when (derived-mode-p 'haskell-mode)
      (if (executable-find "intero")
          (intero-mode +1)
        (message "Couldn't find intero. Refusing to enable intero-mode."))))
  (add-hook 'haskell-mode-hook #'+haskell|init-intero)
  :config
  (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition))

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

(def-package! intero
  :commands intero-mode
  :init
  (defun +haskell|init-intero ()
    "Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
This is necessary because `intero-mode' doesn't do its own error checks."
    (when (derived-mode-p 'haskell-mode)
      (if (executable-find "stack")
          (intero-mode +1)
        (message "Couldn't find stack. Refusing to enable intero-mode."))))
  (add-hook 'haskell-mode-hook #'+haskell|init-intero)
  :config
  (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition))

Revert "Refuse to enable intero-mode if intero is absent"

This reverts commit 4f40fef59265d86ee25d458be9c478035b3cd9b4.

This was short sighted. The intero check doesn't find per-project built
instances of intero.


(global-set-key (kbd "<f6>") 'toggle-menu-bar-mode-from-frame)
(global-set-key (kbd "<f7>") 'neotree-toggle)

(add-hook
 'neotree-mode-hook
 (lambda ()
   (define-key neotree-mode-map (kbd "RET") 'neotree-enter-hide)))

(global-set-key (kbd "<f9>") 'format-buffer)
(global-set-key (kbd "<f9>") 'format-buffer)

(global-set-key (kbd "<f12>") 'eval-buffer)

Add new keybindings to eval complete buffer and to auto-indent complete buffer


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

;;;###autoload
(defface +eshell-prompt-pwd '((t :inherit font-lock-constant-face))
  "TODO"
  :group 'eshell)

;;;###autoload
(defface +eshell-prompt-git-branch '((t :inherit font-lock-builtin-face))
  "TODO"
  :group 'eshell)

(defun +eshell--current-git-branch ()
  (let ((branch (car (cl-loop for match in (split-string (shell-command-to-string "git branch") "\n")
                              if (string-match-p "^\*" match)
                              collect match))))
    (if (not (eq branch nil))
        (format " [%s]" (substring branch 2))
      "")))

;;;###autoload
(defun +eshell-default-prompt ()
  "Generate the prompt string for eshell. Use for `eshell-prompt-function'."
  (concat (if (bobp) "" "\n")
          (propertize (abbreviate-file-name (shrink-path-file (eshell/pwd)))
                      'face '+eshell-prompt-pwd)
          (propertize (+eshell--current-git-branch)
                      'face '+eshell-prompt-git-branch)
          (propertize " λ" 'face (if (zerop eshell-last-command-status) 'success 'error))
          " "))

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

;;;###autoload
(defface +eshell-prompt-pwd '((t :inherit font-lock-constant-face))
  "TODO"
  :group 'eshell)

;;;###autoload
(defface +eshell-prompt-git-branch '((t :inherit font-lock-builtin-face))
  "TODO"
  :group 'eshell)

(defun +eshell--current-git-branch ()
  (let ((branch (car (cl-loop for match in (split-string (shell-command-to-string "git branch") "\n")
                              if (string-match-p "^\*" match)
                              collect match))))
    (if (not (eq branch nil))
        (format " [%s]" (substring branch 2))
      "")))

;;;###autoload
(defun +eshell-default-prompt ()
  "Generate the prompt string for eshell. Use for `eshell-prompt-function'."
  (concat (if (bobp) "" "\n")
          (let ((pwd (eshell/pwd)))
            (propertize (if (equal pwd "~")
                            pwd
                          (abbreviate-file-name (shrink-path-file pwd)))
                        'face '+eshell-prompt-pwd))
          (propertize (+eshell--current-git-branch)
                      'face '+eshell-prompt-git-branch)
          (propertize " λ" 'face (if (zerop eshell-last-command-status) 'success 'error))
          " "))

Fix "home/~" PWD in eshell prompt

Fix "home/~" PWD in eshell prompt


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

;; Markdown Mode
;; http://jblevins.org/projects/markdown-mode/

(use-package markdown-mode
  :mode (("\\.md\\'"       . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :config
  (progn
    ;; http://daringfireball.net/projects/markdown/
    ;; Download the Markdown source from above, extract the .pl from that
    ;; and place it in one of the folders in the environment PATH
    (setq markdown-command "Markdown.pl")

    ;; https://github.com/cadadr/emacs.d
    (defun gk-markdown-preview-buffer ()
      (interactive)
      (require 'shr)
      (let* ((buf-this (buffer-name (current-buffer)))
             (buf-html (get-buffer-create
                        (format "*md-html (%s)*" buf-this))))
        (markdown-other-window (buffer-name buf-html))
        (shr-render-buffer buf-html)
        (eww-mode)
        (kill-buffer buf-html)))

    (bind-keys
     :map markdown-mode-map
      ;; Mimicking the org-export style bindings
      ("C-c C-e o" . gk-markdown-preview-buffer))))

(provide 'setup-markdown)

;; C-c C-s C-p - `markdown-pre-region'
;;                Indent the selected region 4 spaces to the right
;;                (code block formatting used on reddit, stackexchange, etc.)

;; Time-stamp: <2016-01-19 22:40:31 kmodi>

;; Markdown Mode
;; http://jblevins.org/projects/markdown-mode/

(use-package markdown-mode
  :mode (("\\.md\\'"       . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :config
  (progn
    ;; http://daringfireball.net/projects/markdown/
    ;; Download the Markdown source from above, extract the .pl from that
    ;; and place it in one of the folders in the environment PATH
    (when (executable-find "Markdown.pl")
      (setq markdown-command "Markdown.pl"))

    ;; https://github.com/cadadr/emacs.d
    (defun gk-markdown-preview-buffer ()
      (interactive)
      (require 'shr)
      (let* ((buf-this (buffer-name (current-buffer)))
             (buf-html (get-buffer-create
                        (format "*md-html (%s)*" buf-this))))
        (markdown-other-window (buffer-name buf-html))
        (shr-render-buffer buf-html)
        (eww-mode)
        (kill-buffer buf-html)))

    (bind-keys
     :map markdown-mode-map
      ;; Mimicking the org-export style bindings
      ("C-c C-e o" . gk-markdown-preview-buffer))))

(provide 'setup-markdown)

;; C-c C-s C-p - `markdown-pre-region'
;;                Indent the selected region 4 spaces to the right
;;                (code block formatting used on reddit, stackexchange, etc.)

Check if Markdown.pl is available first

Check if Markdown.pl is available first


(add-hook 'after-init-hook
          ;;; Load yasnippet first to avoid precedence issues
          (lambda ()
            (use-package yasnippet
              :init
              (progn
                (yas-global-mode 1)))
            )

          ((lambda ()
             (use-package auto-complete-config
               :init
               (progn
                 (setq ac-comphist-file emacs-acomphistfile-file)
                 (setq ac-auto-start nil)
                 (setq ac-quick-help-delay 0.5)

                 (add-to-list 'ac-dictionary-directories emacs-autocompletedict)
                 (ac-config-default)
                 (ac-set-trigger-key "TAB")
                 (define-key ac-mode-map  [(control tab)] 'auto-complete)
                 (setq-default ac-sources '(ac-source-yasnippet
                                            ac-source-abbrev
                                            ac-source-dictionary
                                            ac-source-words-in-same-mode-buffers))
                 (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
                 (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
                 (add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
                 (add-hook 'css-mode-hook 'ac-css-mode-setup)
                 (add-hook 'auto-complete-mode-hook 'ac-common-setup)
                 (global-auto-complete-mode t)))
             )))

; load yasnippet
 (add-hook 'after-init-hook
           ; Load yasnippet first to avoid precedence issues
           (lambda ()
             (use-package yasnippet
               :init
               (progn
                 (yas-global-mode 1)))))

; load auto-complete-config
 (add-hook 'after-init-hook
           (lambda ()
             (use-package auto-complete-config
               :init
               (progn
                  (setq ac-comphist-file emacs-acomphistfile-file)
                  (setq ac-auto-start nil)
                  (setq ac-quick-help-delay 0.5)

                  (add-to-list 'ac-dictionary-directories emacs-autocompletedict)
                  (ac-config-default)
                  (ac-set-trigger-key "TAB")
                  (define-key ac-mode-map  [(control tab)] 'auto-complete)
                  (setq-default ac-sources '(ac-source-yasnippet
                                             ac-source-abbrev
                                             ac-source-dictionary
                                             ac-source-words-in-same-mode-buffers))
                  (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
                  (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
                  (add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
                  (add-hook 'css-mode-hook 'ac-css-mode-setup)
                  (add-hook 'auto-complete-mode-hook 'ac-common-setup)
                  (global-auto-complete-mode t)))))

Split single add-hook lambda into 2. Moved some ac settings into use-package.


;;; package --- Summary

;;; Commentary:

;;; Code:

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

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

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

;;; package --- Summary

;;; Commentary:

;;; Code:

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

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

(load-theme 'badger)

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

Use theme with more contrast

Use theme with more contrast


(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)

(when (not package-archive-contents)
  (package-refresh-contents))

(defvar my-packages '(starter-kit starter-kit-ruby starter-kit-js
                                  starter-kit-lisp starter-kit-bindings
                                  solarized-theme)
  "A list of packages to ensure are installed at launch.")

(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

(load-theme 'solarized-dark t)

(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.
 '(custom-safe-themes (quote ("501caa208affa1145ccbb4b74b6cd66c3091e41c5bb66c677feda9def5eab19c" default))))
(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.
 )

(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)

(when (not package-archive-contents)
  (package-refresh-contents))

(defvar my-packages '(starter-kit
                      starter-kit-ruby
                      starter-kit-js
                      starter-kit-lisp
                      starter-kit-bindings
                      solarized-theme
                      erlang
                      haskell-mode
                      evil
                      evil-leader)
  "A list of packages to ensure are installed at launch.")

(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

(load-theme 'solarized-dark t)

(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.
 '(custom-safe-themes (quote ("501caa208affa1145ccbb4b74b6cd66c3091e41c5bb66c677feda9def5eab19c" default))))
(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.
 )

Add Erlang & Haskell support to Emacs

Add Erlang & Haskell support to Emacs


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

(after! kotlin-mode
  (set-docsets! 'kotlin-mode "Kotlin")

  (map! :map kotlin-mode-map
        :localleader
        :prefix ("b" . "build")
        :desc "gradlew assemble" "a" (λ! (+kotlin/run-gradlew "assemble"))
        :desc "gradlew build"    "b" (λ! (+kotlin/run-gradlew "build"))
        :desc "gradlew test"     "t" (λ! (+kotlin/run-gradlew "test"))))

(use-package! flycheck-kotlin
  :when (featurep! :tools flycheck)
  :hook (kotlin-mode . flycheck-kotlin-setup))

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

(use-package! kotlin-mode
  :init
  (when (featurep! +lsp)
    (add-hook 'kotlin-mode-local-vars-hook #'lsp!)))

(after! kotlin-mode
  (set-docsets! 'kotlin-mode "Kotlin")

  (map! :map kotlin-mode-map
        :localleader
        :prefix ("b" . "build")
        :desc "gradlew assemble" "a" (λ! (+kotlin/run-gradlew "assemble"))
        :desc "gradlew build"    "b" (λ! (+kotlin/run-gradlew "build"))
        :desc "gradlew test"     "t" (λ! (+kotlin/run-gradlew "test"))))

(use-package! flycheck-kotlin
  :when (featurep! :tools flycheck)
  :hook (kotlin-mode . flycheck-kotlin-setup))

Add LSP support to Kotlin

Add LSP support to Kotlin

`lsp-mode` has built in support for Kotlin. This makes it automatically used if you use the `+lsp` flag.


;; Time-stamp: <2016-07-19 17:26:52 kmodi>

;; Hungry Delete
;; https://github.com/nflath/hungry-delete

(use-package hungry-delete
  :config
  (progn
    (setq hungry-delete-chars-to-skip " \t\r\f\v")

    (defun modi/turn-off-hungry-delete-mode ()
      "Turn off hungry delete mode."
      (hungry-delete-mode -1))

    ;; Enable `hungry-delete-mode' everywhere ..
    (global-hungry-delete-mode)

    ;; Except ..
    ;; `hungry-delete-mode'-loaded backspace does not work in `wdired-mode',
    ;; i.e. when editing file names in the *Dired* buffer.
    (add-hook 'wdired-mode-hook #'modi/turn-off-hungry-delete-mode)))

(provide 'setup-hungry-delete)

;; Time-stamp: <2016-11-21 08:46:41 kmodi>

;; Hungry Delete
;; https://github.com/nflath/hungry-delete

(use-package hungry-delete
  :config
  (progn
    (setq hungry-delete-chars-to-skip " \t\r\f\v")

    ;; Mon Nov 21 08:45:42 EST 2016 - kmodi
    ;; Override the default definitions of `hungry-delete-skip-ws-forward' and
    ;; `hungry-delete-skip-ws-backward'; do not delete back-slashes at EOL.
    (defun hungry-delete-skip-ws-forward ()
      "Skip over any whitespace following point.
This function skips over horizontal and vertical whitespace."
      (skip-chars-forward hungry-delete-chars-to-skip)
      (while (get-text-property (point) 'read-only)
        (backward-char)))

    (defun hungry-delete-skip-ws-backward ()
      "Skip over any whitespace preceding point.
This function skips over horizontal and vertical whitespace."
      (skip-chars-backward hungry-delete-chars-to-skip)
      (while (get-text-property (point) 'read-only)
        (forward-char)))

    (defun modi/turn-off-hungry-delete-mode ()
      "Turn off hungry delete mode."
      (hungry-delete-mode -1))

    ;; Enable `hungry-delete-mode' everywhere ..
    (global-hungry-delete-mode)

    ;; Except ..
    ;; `hungry-delete-mode'-loaded backspace does not work in `wdired-mode',
    ;; i.e. when editing file names in the *Dired* buffer.
    (add-hook 'wdired-mode-hook #'modi/turn-off-hungry-delete-mode)))

(provide 'setup-hungry-delete)

Patch hungry-delete functions: Do not auto delete EOL back-slashes


(setq evil-snipe-packages '(evil-snipe))

(defun evil-snipe/init-evil-snipe ()
  (use-package evil-snipe
    :diminish evil-snipe-local-mode
    :init
    (setq evil-snipe-scope 'whole-buffer
          evil-snipe-enable-highlight t
          evil-snipe-enable-incremental-highlight t
          evil-snipe-auto-disable-substitute t
          evil-snipe-show-prompt nil
          evil-snipe-smart-case t)
    :config
    (progn
      (evil-snipe-mode 1)
      (if (configuration-layer/layer-usedp 'git)
          (progn
            (add-hook 'magit-mode-hook 'turn-off-evil-snipe-override-mode)
            (add-hook 'git-rebase-mode-hook 'turn-off-evil-snipe-override-mode)))
      (when evil-snipe-enable-alternate-f-and-t-behaviors
        (setq evil-snipe-repeat-scope 'whole-buffer)
        (evil-snipe-override-mode 1)))))

(setq evil-snipe-packages '(evil-snipe))

(defun evil-snipe/init-evil-snipe ()
  (use-package evil-snipe
    :diminish evil-snipe-local-mode
    :init
    (setq evil-snipe-scope 'whole-buffer
          evil-snipe-enable-highlight t
          evil-snipe-enable-incremental-highlight t
          evil-snipe-auto-disable-substitute t
          evil-snipe-show-prompt nil
          evil-snipe-smart-case t)
    :config
    (progn
      (if evil-snipe-enable-alternate-f-and-t-behaviors
          (progn
            (setq evil-snipe-repeat-scope 'whole-buffer)
            (evil-snipe-override-mode 1)
            (when (configuration-layer/layer-usedp 'git)
              (add-hook 'magit-mode-hook 'turn-off-evil-snipe-override-mode)
              (add-hook 'git-rebase-mode-hook 'turn-off-evil-snipe-override-mode)))
        (evil-snipe-mode 1)
        (when (configuration-layer/layer-usedp 'git)
          (add-hook 'magit-mode-hook 'turn-off-evil-snipe-mode)
          (add-hook 'git-rebase-mode-hook 'turn-off-evil-snipe-mode))))))

Use separate hooks for override mode

evil-snipe: Use separate hooks for override mode


(defconst mfa-mwim-packages '(mwim))

(defun mfa-mwim/init-mwim ()
  (use-package mwim
    :defer t
    :init
    (progn
      (global-set-key (kbd "C-a") #'mwim-beginning-of-code-or-line)
      (global-set-key (kbd "C-e") #'mwim-end-of-code-or-line)
      (global-set-key (kbd "<home>") #'mwim-beginning-of-line-or-code)
      (global-set-key (kbd "<end>") #'mwim-end-of-line-or-code)
      (with-eval-after-load 'evil
        (define-key evil-normal-state-map (kbd "C-e") #'mwim-end-of-line-or-code)
        (define-key evil-motion-state-map (kbd "C-e") #'mwim-end-of-line-or-code)
        (define-key evil-insert-state-map (kbd "C-e") #'mwim-end-of-line-or-code)
        (define-key evil-visual-state-map (kbd "C-e") #'mwim-end-of-line-or-code)))))

(defconst mfa-mwim-packages '(mwim))

(defun mfa-mwim/init-mwim ()
  (use-package mwim
    :defer t
    :init
    (progn
      (global-set-key (kbd "C-a") #'mwim-beginning)
      (global-set-key (kbd "C-e") #'mwim-end)
      (global-set-key (kbd "<home>") #'mwim-beginning)
      (global-set-key (kbd "<end>") #'mwim-end)
      (with-eval-after-load 'evil
        (define-key evil-normal-state-map (kbd "C-e") #'mwim-end)
        (define-key evil-motion-state-map (kbd "C-e") #'mwim-end)
        (define-key evil-insert-state-map (kbd "C-e") #'mwim-end)
        (define-key evil-visual-state-map (kbd "C-e") #'mwim-end)
        (evil-declare-motion 'mwim-beginning)
        (evil-declare-motion 'mwim-end)))))

Make mwim motions play nice with evil repeat

Also leave it up to mwim to choose where exactly to move to.


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

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

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

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

    :emacs
    (dired +icons)
    vc

    :tools
    lookup
    eval
    make
    magit
    lsp
    editorconfig
    pdf
    ein

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

    :checkers
    spell
    syntax

    :term
    vterm
    eshell

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

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

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

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

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

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

    :emacs
    (dired +icons)
    vc

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

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

    :checkers
    spell
    syntax

    :term
    vterm
    eshell

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

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

Enable +peek in lsp module

Enable +peek in lsp module


(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

    ;; 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
    hl-todo ;; highlight TODO, FIXME, FAIL, etc.

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

(provide 'dependencies)

Add hl-todo as a dependency

Add hl-todo as a dependency


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

;;;###autoload
(defun +doom-dashboard/open (frame)
  "Switch to the dashboard in the current window, of the current FRAME."
  (interactive (list (selected-frame)))
  (with-selected-frame frame
    (switch-to-buffer (doom-fallback-buffer))
    (+doom-dashboard-reload)))

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

;;;###autoload
(defun +doom-dashboard/open (frame)
  "Switch to the dashboard in the current window, of the current FRAME."
  (interactive (list (selected-frame)))
  (with-selected-frame frame
    (switch-to-buffer (doom-fallback-buffer))))

Remove redundant reload in +doom-dashboard/open


(require 'em-cmpl)

;; Auto-complete in eshell should stop at the first ambiguity.
(setq eshell-cmpl-cycle-completions nil)

(defadvice eshell (around eshell-append-cwd (&optional arg) activate)
  "New eshell buffers should be named according to their working directory."
  (interactive "P")
  (if (and arg (not (numberp arg)))
      ;; Non-numeric prefix arg given, change the eshell buffer name.
      (let* ((current-dir (f-parent (buffer-file-name)))
             (eshell-buffer-name (format "*eshell*<%s>" current-dir)))
        ad-do-it)
    ;; Otherwise, continue as normal
    ad-do-it))

(provide 'eshell-customisations)

(require 'em-cmpl)

;; Auto-complete in eshell should stop at the first ambiguity.
(setq eshell-cmpl-cycle-completions nil)

(defadvice eshell (around eshell-append-cwd (&optional arg) activate)
  "New eshell buffers should be named according to their working directory."
  (interactive "P")
  (if (and arg (not (numberp arg)))
      ;; Non-numeric prefix arg given, change the eshell buffer name.
      (let* ((eshell-buffer-name (format "*eshell*<%s>" default-directory)))
        ad-do-it)
    ;; Otherwise, continue as normal
    ad-do-it))

(provide 'eshell-customisations)

Use default-directory to find which directory to use.

dired buffers return nil for (buffer-file-name).


;;; eshell.el --- Configuration for Eshell

;;; Commentary:

;;; Code:

;;; eshell.el ends here

;;; eshell.el --- Configuration for Eshell

;;; Commentary:
;; Load and configure Eshell with smart mode

;;; Code:

;; Load Eshell and Smart mode
(require 'eshell)
(require 'em-smart)

;; Settings
(setq eshell-where-to-jump 'begin)
(setq eshell-review-quick-commands nil)
(setq eshell-smart-space-goes-to-end t)

;;; eshell.el ends here

Configure Eshell and smart display

Configure Eshell and smart display


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

(setq ranger-packages '(dired
                        ranger))

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

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

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

(setq ranger-packages '(dired
                        ranger))

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

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

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

Fix misplaced keybinding definition for ranger


(use-package undo-tree)
;; undo
(add-hook 'ruby-mode-hook 'undo-tree-mode)

(use-package undo-tree
  :init
  (add-hook 'ruby-mode-hook 'undo-tree-mode)
  :defer)

Convert undo tree into use-package format.


;; Set some variables based on environment
;; Are we on a mac?
(setq is-mac (equal system-type 'darwin))

;; Turn off mouse interface early in startup to avoid momentary display
;;;; Do show menu bar (running as cocoa app)
;;;; TODO turn of menu bar when running emacs from terminal
;;(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; No splash screen
(setq inhibit-startup-message t)

;; Set up load path
(setq loadpath-mine (expand-file-name "conf" user-emacs-directory))
(add-to-list 'load-path loadpath-mine)

(require '_packages)
(require '_global)
(require '_appearance)
(require '_key_bindings)

(require 'theme-park-mode)

;; Functions (load all files in defuns-dir)
(setq defuns-dir (expand-file-name "defuns" user-emacs-directory))
(dolist (file (directory-files defuns-dir t "\\w+"))
  (when (file-regular-p file)
    (load file)))

(when is-mac (require '_mac))

;; Set some variables based on environment
;; Are we on a mac?
(setq is-mac (equal system-type 'darwin))

;; Turn off mouse interface early in startup to avoid momentary display
;;;; Do show menu bar (running as cocoa app)
;;;; TODO turn of menu bar when running emacs from terminal
;;(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; No splash screen
(setq inhibit-startup-message t)

;; Set up load path
(setq loadpath-mine (expand-file-name "conf" user-emacs-directory))
(setq loadpath-vendor (expand-file-name "vendor" user-emacs-directory))

(add-to-list 'load-path loadpath-mine)
(add-to-list 'load-path loadpath-vendor)

;;;; add projects from vendor..
(dolist (project (directory-files loadpath-vendor t "\\w+"))
 (when (file-directory-p project)
   (add-to-list 'load-path project)))

(require '_packages)
(require '_global)
(require '_appearance)
(require '_key_bindings)

(require 'theme-park-mode)

;; Functions (load all files in defuns-dir)
(setq defuns-dir (expand-file-name "defuns" user-emacs-directory))
(dolist (file (directory-files defuns-dir t "\\w+"))
  (when (file-regular-p file)
    (load file)))

(when is-mac (require '_mac))

Add vendor to load path

Add vendor to load path


(use-package rainbow-identifiers
  :init
  (progn (add-hook 'prog-mode-hook 'rainbow-identifiers-mode)))

(use-package rainbow-identifiers
  :init
  (add-to-hooks 'rainbow-identifiers-mode '(prog-mode-hook erlang-mode-hook)))

Add rainbow identifiers to erlang-mode

Add rainbow identifiers to erlang-mode


(use-package git-gutter-fringe
  :commands git-gutter-mode
  :init
  (add-to-hooks 'git-gutter-mode '(erlang-mode-hook
                                   org-mode-hook
                                   prog-mode-hook
                                   ))
  :config
  (progn
    (setq git-gutter:hide-gutter t)
    ;; Don't need log/message.
    (setq git-gutter:verbosity 0)
    (setq git-gutter-fr:side 'right-fringe)
    ;; (setq git-gutter:update-hooks '(after-save-hook after-revert-hook))
    ;; custom graphics that works nice with half-width fringes
    (fringe-helper-define 'git-gutter-fr:added nil
      "..X...."
      "..X...."
      "XXXXX.."
      "..X...."
      "..X...."
      )
    (fringe-helper-define 'git-gutter-fr:deleted nil
      "......."
      "......."
      "XXXXX.."
      "......."
      "......."
      )
    (fringe-helper-define 'git-gutter-fr:modified nil
      "..X...."
      ".XXX..."
      "XXXXX.."
      ".XXX..."
      "..X...."
      )))

(use-package git-gutter-fringe
  :commands git-gutter-mode
  :init
  (add-to-hooks 'git-gutter-mode '(erlang-mode-hook
                                   markdown-mode-hook
                                   org-mode-hook
                                   prog-mode-hook
                                   ))
  :config
  (progn
    (setq git-gutter:hide-gutter t)
    ;; Don't need log/message.
    (setq git-gutter:verbosity 0)
    (setq git-gutter-fr:side 'right-fringe)
    ;; (setq git-gutter:update-hooks '(after-save-hook after-revert-hook))
    ;; custom graphics that works nice with half-width fringes
    (fringe-helper-define 'git-gutter-fr:added nil
      "..X...."
      "..X...."
      "XXXXX.."
      "..X...."
      "..X...."
      )
    (fringe-helper-define 'git-gutter-fr:deleted nil
      "......."
      "......."
      "XXXXX.."
      "......."
      "......."
      )
    (fringe-helper-define 'git-gutter-fr:modified nil
      "..X...."
      ".XXX..."
      "XXXXX.."
      ".XXX..."
      "..X...."
      )))

Add git-gutter-fringe to markdown mode hook


;;; init-locales.el --- Configure default locale -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(defun sanityinc/utf8-locale-p (v)
  "Return whether locale string V relates to a UTF-8 locale."
  (and v (string-match-p "UTF-8" v)))

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

(when (or window-system (sanityinc/locale-is-utf8-p))
  (set-language-environment 'utf-8)
  (setq locale-coding-system 'utf-8)
  (set-selection-coding-system (if (eq system-type 'windows-nt) 'utf-16-le 'utf-8))
  (prefer-coding-system 'utf-8))

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

;;; init-locales.el --- Configure default locale -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(defun sanityinc/locale-var-encoding (v)
  "Return the encoding portion of the locale string V, or nil if missing."
  (when v
    (save-match-data
      (let ((case-fold-search t))
        (when (string-match "\\.\\([^.]*\\)\\'" v)
          (intern (downcase (match-string 1 v))))))))

(dolist (varname '("LC_ALL" "LANG" "LC_CTYPE"))
  (let ((encoding (sanityinc/locale-var-encoding (getenv varname))))
    (unless (memq encoding '(nil utf8 utf-8))
      (message "Warning: non-UTF8 encoding in environment variable %s may cause interop problems with this Emacs configuration." varname))))

(when (fboundp 'set-charset-priority)
  (set-charset-priority 'unicode))
(prefer-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(unless (eq system-type 'windows-nt)
  (set-selection-coding-system 'utf-8))

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

Streamline code for setting locales

Streamline code for setting locales

See #717


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

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

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

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

(provide 'init-grep)

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

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

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

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

(provide 'init-grep)

Use deadgrep package when "rg" is available


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

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

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

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

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

(provide 'init-misc)

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

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

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

(setq-default regex-tool-backend 'perl)
(after-load 're-builder
  ;; Support a slightly more idiomatic quit binding in re-builder
  (define-key reb-mode-map (kbd "C-c C-k") 'reb-quit))

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

(provide 'init-misc)

Support quitting with C-c C-k in re-builder


(use-package lsp-mode
  :config
  ;; For some reason icons aren't currently rendering, so don't show them.
  (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)

  (define-key lsp-mode-map (kbd "C-c f") #'lsp-format-buffer)
  (define-key lsp-mode-map (kbd "C-c r") #'lsp-rename)

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

(provide 'lsp-customisations)

(use-package lsp-mode
  :config
  ;; For some reason icons aren't currently rendering, so don't show them.
  (setq lsp-modeline-code-actions-segments '(count name))

  (setq lsp-rust-analyzer-cargo-watch-command "clippy")
  (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)

  (define-key lsp-mode-map (kbd "C-c f") #'lsp-format-buffer)
  (define-key lsp-mode-map (kbd "C-c r") #'lsp-rename)

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

(provide 'lsp-customisations)

Enable clippy as check command fo rlints


;;; flycheck-conf.el -- Configuration for flycheck.
;;
;;; Commentary:
;;
;;; Code:
(require 'flycheck)

(custom-set-variables
 '(flycheck-disabled-checkers '(javascript-gjslint))
 '(flycheck-standard-error-navigation nil))

;;; flycheck-conf.el ends here

;;; flycheck-conf.el -- Configuration for flycheck.
;;
;;; Commentary:
;;
;;; Code:
(require 'flycheck)

(custom-set-variables
 '(flycheck-disabled-checkers '(javascript-gjslint))
 '(flycheck-emacs-lisp-load-path 'inherit)
 '(flycheck-standard-error-navigation nil))

;;; flycheck-conf.el ends here

elisp: Use the current load-path when running flycheck

This lets flycheck see the packages that are loaded into the current
Emacs session and prevents it from stopping at `require` lines due to
errors.


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

(setq lsp-session-file (concat doom-etc-dir "lsp-session")
      lsp-auto-guess-root t
      lsp-keep-workspace-alive nil)

(def-package! lsp-ui
  :hook (lsp-mode . lsp-ui-mode)
  :config
  (setq lsp-prefer-flymake nil
        lsp-ui-doc-max-height 8
        lsp-ui-doc-max-width 35
        lsp-ui-sideline-ignore-duplicate t)
  (define-key! lsp-ui-mode-map
    [remap xref-find-definitions] #'lsp-ui-peek-find-definitions
    [remap xref-find-references]  #'lsp-ui-peek-find-references)
  (set-lookup-handlers! 'lsp-ui-mode
    :definition #'lsp-ui-peek-find-definitions
    :references #'lsp-ui-peek-find-references))

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

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

(setq lsp-session-file (concat doom-etc-dir "lsp-session")
      lsp-auto-guess-root t
      lsp-keep-workspace-alive nil)

;; Don't prompt to restart LSP servers while quitting Emacs
(add-hook! 'kill-emacs-hook (setq lsp-restart 'ignore))

(def-package! lsp-ui
  :hook (lsp-mode . lsp-ui-mode)
  :config
  (setq lsp-prefer-flymake nil
        lsp-ui-doc-max-height 8
        lsp-ui-doc-max-width 35
        lsp-ui-sideline-ignore-duplicate t)
  (define-key! lsp-ui-mode-map
    [remap xref-find-definitions] #'lsp-ui-peek-find-definitions
    [remap xref-find-references]  #'lsp-ui-peek-find-references)
  (set-lookup-handlers! 'lsp-ui-mode
    :definition #'lsp-ui-peek-find-definitions
    :references #'lsp-ui-peek-find-references))

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

Fix LSP restart prompt when killing Emacs


;; To be consistent with our paredit keybindings, use super for syntatic movement.
(global-set-key (kbd "s-a") #'beginning-of-defun)

;; avy -- quickly jump to an arbitrary word or line
(require 'avy)
(setq avy-case-fold-search nil)
;; Only consider the current window (i.e. the current buffer we're
;; focused in).
(setq avy-all-windows nil)
(setq avy-keys
      (append (number-sequence ?a ?z) (number-sequence ?A ?Z)))
(define-key global-map (kbd "<f11>") #'avy-goto-word-or-subword-1)
(global-set-key (kbd "<f10>") #'avy-goto-line)

;; Use `n' and `p' as movement keys in *compilation* buffers.
;; M-n and M-p are already bound, but n/p are less typing and ag.el
;; has trained me to expect those bindings.
(require 'compile)
(define-key compilation-mode-map (kbd "n") #'compilation-next-error)
(define-key compilation-mode-map (kbd "p") #'compilation-previous-error)

(require 'modalka-customisations)

(provide 'movement-customisations)

Add a super keybinding for beginning-of-defun.


Use my customized monokai theme.

Use my customized monokai theme.


(require 'fractL)

;; 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$" . racket-mode))
(add-to-list 'auto-mode-alist '("\\.transit$" . fractL-mode))
(add-to-list 'auto-mode-alist '("\\.ttest$" . racket-mode))
(add-to-list 'auto-mode-alist '("\\.k$" . k3-mode))

(require 'fractL)

;; 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$" . racket-mode))
(add-to-list 'auto-mode-alist '("\\.transit$" . fractL-mode))
(add-to-list 'auto-mode-alist '("\\.ls$" . racket-mode))
(add-to-list 'auto-mode-alist '("\\.ttest$" . racket-mode))
(add-to-list 'auto-mode-alist '("\\.k$" . k3-mode))

Add hook for racket-mode for .ls files

Add hook for racket-mode for .ls files


;; 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
      '(
        ng-C-k
        ng-C-w
        ng-end
        ng-home
        ))

(setq mc/cmds-to-run-once
      '(
        ng-add-cursor-on-click
        ))

;; 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
      '(
        comment-dwim
        comment-line
        ng-C-k
        ng-C-w
        ng-end
        ng-home
        ))

(setq mc/cmds-to-run-once
      '(
        ng-add-cursor-on-click
        ))

Add comment commands to run-all list for multiple cursors


(setq vim-empty-lines-packages
      '(
        (vim-empty-lines-mode :location local)
        (vi-tilde-fringe :excluded t)
        ))

(defun vim-empty-lines/init-vim-empty-lines-mode ()
  (use-package vim-empty-lines-mode
    :diminish vim-empty-lines-mode
    :init
    (spacemacs/add-to-hooks (lambda () (vim-empty-lines-mode -1)) '(comint-mode-hook
                                                                    eshell-mode-hook
                                                                    eww-mode-hook
                                                                    shell-mode-hook
                                                                    term-mode-hook))
    :config
    (progn
      (global-vim-empty-lines-mode)
      (spacemacs|add-toggle vim-empty-lines-mode
        :mode global-vim-empty-lines-mode
        :documentation
        "Display an overlay of ~ on empty lines."
        :evil-leader "t~")
      ;; don't enable it on spacemacs home buffer
      (with-current-buffer  "*spacemacs*"
        (vim-empty-lines-mode -1))
      ;; after a major mode is loaded, check if the buffer is read only
      ;; if so, disable vim-empty-lines-mode
      (add-hook 'after-change-major-mode-hook (lambda ()
                                                (when buffer-read-only
                                                  (vim-empty-lines-mode -1)))))))

(setq vim-empty-lines-packages
      '(
        (vim-empty-lines-mode :location local)
        (vi-tilde-fringe :excluded t)
        ))

(defun vim-empty-lines/init-vim-empty-lines-mode ()
  (use-package vim-empty-lines-mode
    :diminish vim-empty-lines-mode
    :init
    (spacemacs/add-to-hooks (lambda () (vim-empty-lines-mode -1))
                            '(comint-mode-hook
                              eshell-mode-hook
                              eww-mode-hook
                              shell-mode-hook
                              term-mode-hook))
    :config
    (progn
      (global-vim-empty-lines-mode)
      (spacemacs|add-toggle vim-empty-lines-mode
        :mode global-vim-empty-lines-mode
        :documentation
        "Display an overlay of ~ on empty lines."
        :evil-leader "t~")
      ;; Don't enable it where it is detrimental.
      (with-current-buffer "*spacemacs*" (vim-empty-lines-mode -1))
      (with-current-buffer "*Messages*" (vim-empty-lines-mode -1))
      (with-current-buffer which-key--buffer (vim-empty-lines-mode -1))
      ;; after a major mode is loaded, check if the buffer is read only
      ;; if so, disable vim-empty-lines-mode
      (add-hook 'after-change-major-mode-hook (lambda ()
                                                (when buffer-read-only
                                                  (vim-empty-lines-mode -1)))))))

Disable vim-empty-lines in unnecessary buffers

*Messages* and which-key--buffer do not need empty line indicators.

Also break up an unnecessarily long line.


(require 'init-frame-hooks)

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

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

(provide 'init-xterm)

(require 'init-frame-hooks)

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

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

(provide 'init-xterm)

Handle console-only Emacs builds, which lack mwheel-install

Closes #85


(defconst mfa-ruby-packages '(rubocop ruby-mode))

(defun mfa-ruby/post-init-rubocop ()
  (spacemacs|hide-lighter rubocop-mode))

(defun mfa-ruby/post-init-ruby-mode ()
  ;; Ruby mode customizations
  (with-eval-after-load 'ruby-mode
    (add-hook 'ruby-mode-hook (lambda ()
                                (setq evil-shift-width ruby-indent-level))))

  ;; Additional file mode associations.
  (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))

  ;; Additional interpreter associations.
  (add-to-list 'interpreter-mode-alist '("rake" . ruby-mode))

  ;; It is unnecessary for rbenv to show the Ruby version in the modeline.
  (setq rbenv-show-active-ruby-in-modeline nil))

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

(defconst mfa-ruby-packages '(rbenv rubocop ruby-mode))

(defun mfa-ruby/post-init-rbenv ()
  ;; It is unnecessary for rbenv to show the Ruby version in the modeline.
  (setq rbenv-show-active-ruby-in-modeline nil))

(defun mfa-ruby/post-init-rubocop ()
  (spacemacs|hide-lighter rubocop-mode))

(defun mfa-ruby/post-init-ruby-mode ()
  ;; Ruby mode customizations
  (with-eval-after-load 'ruby-mode
    (add-hook 'ruby-mode-hook (lambda ()
                                (setq evil-shift-width ruby-indent-level))))

  ;; Additional file mode associations.
  (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))

  ;; Additional interpreter associations.
  (add-to-list 'interpreter-mode-alist '("rake" . ruby-mode)))

Move customization of rbenv to the proper use-package init block


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

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

(after-load 'flycheck
  (flycheck-define-checker ruby
    "A Ruby syntax checker using the standard (MRI) Ruby interpreter.

 See URL `http://www.ruby-lang.org/'."
    :command ("ruby" "-w" "-c" source)
    :error-patterns
    ;; These patterns support output from JRuby, too, to deal with RVM or Rbenv
    ((error line-start
            "SyntaxError in " (file-name) ":" line ": " (message)
            line-end)
     (warning line-start
              (file-name) ":" line ":" (optional column ":")
              " warning: " (message) line-end)
     (error line-start (file-name) ":" line ": " (message) line-end))
    :modes (enh-ruby-mode ruby-mode))
  (add-to-list 'flycheck-checkers 'ruby t))

(provide 'init-flycheck)

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

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

Revert "Add ruby flycheck checker locally until it is restored upstream"

This reverts commit 4c387b5e3426f5bbddbbf3054961a2b45a3a27bc.


;;; init.el
;;
;; This is the first thing emacs loads
;; so we can specify all our customisations here
;; however, it makes sens to use emacs' own customisations functionality
;; (which you can access with M-x customize) for stylistic customisations
;; and use init.el for more complex stuff such as keybindings
;;
;; Define a custom location for the file emacs uses to store customisations:
(setq custom-file "~/.emacs.d/lisp/custom.el")

;;
;; perform any other configuration we require
;;

;; org-mode configuration
(require 'org)
;; automatically use org mode for .org, .org_archive and .txt files
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
;; standard key bindings
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
;; see the custom-file for the agenda files configuration
;; I'm setting it to use all files in a specified directory

;; don't forget to load our custom file
(load custom-file)

;;; init.el
;;
;; This is the first thing emacs loads
;; so we can specify all our customisations here
;; however, it makes sens to use emacs' own customisations functionality
;; (which you can access with M-x customize) for stylistic customisations
;; and use init.el for more complex stuff such as keybindings
;;
;; Define a custom location for the file emacs uses to store customisations:
(setq custom-file "~/.emacs.d/lisp/custom.el")

;;
;; perform any other configuration we require
;;

;;
;; org-mode configuration
;;
;; load org-mode from source
;; You first need to check it out from git (git://orgmode.org/org-mode.git)
;; and build it with "make uncompiled"
(add-to-list 'load-path (expand-file-name "~/.emacs.d/org-mode/lisp"))
;; automatically use org mode for .org, .org_archive and .txt files
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org)
;; standard key bindings
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
;; see the custom-file for the agenda files configuration
;; I'm setting it to use all files in a specified directory

;; don't forget to load our custom file
(load custom-file)

Use latest org-mode from git

Use latest org-mode from git


;; packages
(require 'package)
(add-to-list 'package-archives
	     '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)

;; visual.
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(add-to-list 'default-frame-alist '(fullscreen . maximized))

;; magit conf
(global-set-key (kbd "<f8>") 'magit-status)
(global-set-key (kbd "C-x g") 'magit-status)  ;; Legacy

Add visual y keybinds para magit

Add visual y keybinds para magit


(use-package flycheck
  :defer t
  :init
  (use-package flycheck-color-mode-line
    :defer t
    :init
    (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
  :config
  (progn
    (dolist (mode '(c
                    elixir
                    json
                    python
                    ruby))
      (add-hook (intern (concat (symbol-name mode) "-mode-hook"))
                'flycheck-mode))

    (setq flycheck-check-syntax-automatically '(save mode-enabled))
    (setq flycheck-standard-error-navigation nil)))

(use-package flycheck
  :defer t
  :init
  (progn
    (dolist (mode '(c
                    elixir
                    json
                    python
                    ruby))
      (add-hook (intern (concat (symbol-name mode) "-mode-hook"))
                'flycheck-mode))
    (use-package flycheck-color-mode-line
      :defer t
      :init
      (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)))
  :config
  (progn

    (setq flycheck-check-syntax-automatically '(save mode-enabled))
    (setq flycheck-standard-error-navigation nil)))

Fix lazy loading of flycheck

Fix lazy loading of flycheck