;; Time-stamp: <2016-07-28 23:19:02 kmodi>

;; Standard ML

(use-package sml-mode
  :ensure t
  :mode (("\\.sml\\'" . sml-mode))
  :config
  (progn
    (defun modi/sml-mode-hook-fn ()
      "Disable `electric-indent-mode' only locally."
      ;; In SML, it is perfectly fine to have the statements not ending in
      ;; semicolons as below (in files, *not* in REPL!):
      ;;   val x = 34
      ;; But when doing so, newline with auto-indentation does not work
      ;; correctly. Newline + auto-indentation works fine only if the statements
      ;; are ended in semi-colons. So `electric-indent-mode will have to be
      ;; disabled for this major mode.
      (electric-indent-local-mode -1))
    (add-hook 'sml-mode-hook #'modi/sml-mode-hook-fn)))

(provide 'setup-sml)

;; Time-stamp: <2016-08-04 23:30:42 kmodi>

;; Standard ML

(use-package sml-mode
  :ensure t
  :mode (("\\.sml\\'" . sml-mode))
  :config
  (progn
    ;; Undefine all the default abbrevs defined in `sml-mode.el'.
    ;; I cannot use `clear-abbrev-table' because that will clear out my
    ;; personally defined abbrevs too!
    (dolist (abbrev '("let"
                      "if"
                      "local"
                      "case"
                      "signature"
                      "structure"
                      "functor"
                      "datatype"
                      "abstype"
                      "struct"
                      "sig"
                      "val"
                      "fn"
                      "fun"))
      (define-abbrev sml-mode-abbrev-table abbrev nil))

    (defun modi/sml-mode-hook-fn ()
      "My customizations for `sml-mode'."
      ;; ;; In SML, it is perfectly fine to have the statements not ending in
      ;; ;; semicolons as below (in files, *not* in REPL!):
      ;; ;;   val x = 34
      ;; ;; But when doing so, newline with auto-indentation does not work
      ;; ;; correctly. Newline + auto-indentation works fine only if the statements
      ;; ;; are ended in semi-colons. So `electric-indent-mode will have to be
      ;; ;; disabled for this major mode.
      ;; (electric-indent-local-mode -1)
      (auto-fill-mode))
    (add-hook 'sml-mode-hook #'modi/sml-mode-hook-fn)))

(provide 'setup-sml)

Remove default abbrevs for sml (buggy)

Remove default abbrevs for sml (buggy)


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

(package! treemacs)
(when (featurep! :feature evil)
  (package! treemacs-evil))
(package! treemacs-projectile)

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

(package! treemacs)
(when (featurep! :feature evil +everywhere)
  (package! treemacs-evil))
(package! treemacs-projectile)

Add +everywhere flag to treemacs-evil

Add +everywhere flag to treemacs-evil


(define-key osx-key-mode-map [(alt m)] nil)
(use-package magit
  :ensure t
  :demand
  :init
  (setq magit-auto-revert-mode nil)
  :config
  (defhydra hydra-magit (:color teal :hint nil)
"
                   Magit

  Status        Changes           Rebase            Cherry Pick       Merge
--------------------------------------------------------------------------------------
_s_: status      _c_: commit        _r_: rebase          _p_: cherry pick    _m_: merge
_d_: diff        _C_: amend         _A-r_: continue      _A-p_: continue
_l_: log         _h_: reset
_f_: reflog      _H_: reset hard

"
    ("s" magit-status)
    ("d" magit-diff)
    ("l" magit-log-current)
    ("f" magit-reflog)
    ("c" magit-commit)
    ("C" magit-commit-amend)
    ("h" magit-reset-head)
    ("H" magit-reset-hard)
    ("r" magit-rebase-interactive)
    ("A-r" magit-rebase-continue)
    ("p" magit-cherry-pick-popup)
    ("A-p" magit-sequencer-continue)
    ("m" magit-merge)
    ("q" nil "cancel" :color blue)
    ("RET" magit-visit-thing)
    )
  (global-set-key (kbd "A-m") 'hydra-magit/body)
  )

(provide 'setup-magit)

(define-key osx-key-mode-map [(alt m)] nil)
(use-package magit
  :ensure t
  :demand
  :init
  (setq magit-auto-revert-mode nil)
  :config
  (defhydra hydra-magit (:color teal :hint nil)
"
                   Magit

  Status        Changes           Rebase            Cherry Pick       Merge
--------------------------------------------------------------------------------------
_s_: status      _c_: commit        _r_: rebase          _p_: cherry pick    _m_: merge
_d_: diff        _C_: amend         _A-r_: continue      _A-p_: continue
_l_: log         _h_: reset
_f_: reflog      _H_: reset hard

"
    ("s" magit-status)
    ("d" magit-diff)
    ("l" magit-log-current)
    ("f" magit-reflog)
    ("c" magit-commit)
    ("C" magit-commit-amend)
    ("h" magit-reset-head)
    ("H" magit-reset-hard)
    ("r" magit-rebase-interactive)
    ("A-r" magit-rebase-continue)
    ("p" magit-cherry-pick)
    ("A-p" magit-sequencer-continue)
    ("m" magit-merge)
    ("q" nil "cancel" :color blue)
    ("RET" magit-visit-thing)
    )
  (global-set-key (kbd "A-m") 'hydra-magit/body)
  )

(provide 'setup-magit)

Update Magit cherry-pick command in hydra


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

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

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

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

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

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

Remove wrap, additional-wrap, & escape key themes

+ Escape was redundant with Doom's own escape handler
+ Disabled wrap/addition-wrap, as it isn't enabled by default, is
  potentially redundant with evil-{surround,embrace}, and prone to issues
  in tty emacs (see #2573).

Fixes #2573


(setf inhibit-startup-screen t) ; disable welcome screen

(setf ring-bell-function 'ignore) ; disable alarm bell

(when (not (display-graphic-p))
  (menu-bar-mode -1)) ; disable menu bar in CLI

;; improve scrolling
(setf scroll-margin 5
      scroll-step 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01)

(show-paren-mode 1) ; highlight matching parens

(global-hl-line-mode 1) ; highlight current line

(setq-default indent-tabs-mode nil) ; use spaces instead of tabs

(xterm-mouse-mode 1) ; enable mouse support in terminal

(setq tab-always-indent 'complete) ; make tab complete as well as indent

(setq ns-pop-up-frames nil) ; open files in existing frame

Make Emacs open files in already-open frame


(when *is-a-mac*
  (setq mac-command-modifier 'meta)
  (setq mac-option-modifier 'none)
  (setq default-input-method "MacOSX")
  ;; Make mouse wheel / trackpad scrolling less jerky
  (setq mouse-wheel-scroll-amount '(0.001))
  (when *is-cocoa-emacs*
    ;; Woohoo!!
    (global-set-key (kbd "M-`") 'ns-next-frame)
    (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
    (eval-after-load 'nxml-mode
      '(define-key nxml-mode-map (kbd "M-h") nil))
    (global-set-key (kbd "M-ˍ") 'ns-do-hide-others) ;; what describe-key reports
    (global-set-key (kbd "M-c") 'ns-copy-including-secondary)
    (global-set-key (kbd "M-v") 'ns-paste-secondary)))

(provide 'init-osx-keys)

(when *is-a-mac*
  (setq mac-command-modifier 'meta)
  (setq mac-option-modifier 'none)
  (setq default-input-method "MacOSX")
  ;; Make mouse wheel / trackpad scrolling less jerky
  (setq mouse-wheel-scroll-amount '(0.001))
  (when *is-cocoa-emacs*
    ;; Woohoo!!
    (global-set-key (kbd "M-`") 'ns-next-frame)
    (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
    (eval-after-load 'nxml-mode
      '(define-key nxml-mode-map (kbd "M-h") nil))
    (global-set-key (kbd "M-ˍ") 'ns-do-hide-others) ;; what describe-key reports for cmd-option-h
    (global-set-key (kbd "M-c") 'ns-copy-including-secondary)
    (global-set-key (kbd "M-v") 'ns-paste-secondary)))

(provide 'init-osx-keys)

Clarify meaning of obscure key binding

Clarify meaning of obscure key binding


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

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

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

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

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

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

Use erlang mode for .spec

Use erlang mode for .spec


(load-theme 'solarized-light 't)
;; set font size
(when (display-graphic-p)
  (set-face-attribute 'default nil :height 120))

(provide 'lk/theme)

;; set font size
(when (display-graphic-p)
  (set-face-attribute 'default nil :height 120))

(defun on-after-init ()
  (unless (display-graphic-p (selected-frame))
    (set-face-background 'default "unspecified-bg" (selected-frame))))

(add-hook 'window-setup-hook 'on-after-init)

(load-theme 'solarized-dark 't)

(provide 'lk/theme)

Clean up colors in terminal

Clean up colors in terminal


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

((nil . ((fill-column . 80))))

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

((nil . ((fill-column . 80)))
 (c++-mode . ((mode . subword)))
 (c-mode . ((mode . subword))))

Enable subword-mode in C/C++ files.

Enable subword-mode in C/C++ files.

This matches the CamelCase style.


(use-package rcirc
  :config
  (setq rcirc-default-nick "wilfredh")
  (setq rcirc-server-alist
        '(("irc.freenode.net" :channels ("#emacs" "#guile"))
          ("irc.mozilla.org" :channels ("#rust"))))
  (setq rcirc-log-flag t)
  (setq rcirc-log-directory "~/irc_logs"))

(provide 'irc-customisations)

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

(provide 'irc-customisations)

Hide status updates from lurkers

Hide status updates from lurkers


(use-package evil-leader
  :ensure t

  :config
  (require 'evil-leader)
  (global-evil-leader-mode)

  (evil-leader/set-leader "<SPC>")
  (evil-leader/set-key
    "<SPC>" 'execute-extended-command
    "e" 'find-file)
  )

(use-package evil-nerd-commenter
  :ensure t

  :config
  (global-set-key (kbd "C-\\") 'evilnc-comment-or-uncomment-lines)
  )

(use-package evil
  :ensure t

  :bind (
    ;; bind ctrl-j/k to just move
    ("C-j" . evil-next-line)
    ("C-k" . evil-previous-line)
    )

  :config
  (require 'evil)
  (evil-mode 1)

  ;; command alias
  (evil-ex-define-cmd "W" "w")
  (evil-ex-define-cmd "Wq" "wq")
  (evil-ex-define-cmd "WQ" "wq")
  (evil-ex-define-cmd "Q" "q")
  )

(provide 'pkg-evil)

(use-package evil-leader
  :ensure t

  :config
  (global-evil-leader-mode)

  (evil-leader/set-leader "<SPC>")
  (evil-leader/set-key
    "<SPC>" 'execute-extended-command
    "e" 'find-file)
  )

(use-package evil-nerd-commenter
  :ensure t

  :config
  (global-set-key (kbd "C-\\") 'evilnc-comment-or-uncomment-lines)
  )

(use-package evil
  :ensure t

  :bind (
    ;; bind ctrl-j/k to just move
    ("C-j" . evil-next-line)
    ("C-k" . evil-previous-line)
    )

  :config
  (evil-mode 1)

  ;; command alias
  (evil-ex-define-cmd "W" "w")
  (evil-ex-define-cmd "Wq" "wq")
  (evil-ex-define-cmd "WQ" "wq")
  (evil-ex-define-cmd "Q" "q")
  )

(provide 'pkg-evil)

Remove require's from use-package config

It's automatically done.


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

  (setq projectile-keymap-prefix (kbd "C-c C-p"))

  ;; Shorter modeline
  (after-load 'projectile
    (setq-default
     projectile-mode-line
     '(:eval
       (if (file-remote-p default-directory)
           " Proj"
         (format " Proj[%s]" (projectile-project-name)))))))

(provide 'init-projectile)

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

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

    ;; Shorter modeline
    (setq-default
     projectile-mode-line
     '(:eval
       (if (file-remote-p default-directory)
           " Proj"
         (format " Proj[%s]" (projectile-project-name)))))))

(provide 'init-projectile)

Use define-key instead of outdated projectile-keymap-prefix


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

(custom-set-variables
  `(deft-directory ,(expand-file-name "~/notes/"))
  '(deft-recursive t)
  '(deft-extensions ("md" "txt" "org"))
  '(deft-auto-save-interval 0))

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

(custom-set-variables
  `(deft-directory ,(expand-file-name "~/notes/"))
  '(deft-recursive t)
  '(deft-extensions (quote ("md" "txt" "org")))
  '(deft-auto-save-interval 0))

Update to force deft to use the .md extension for new files


;; Load theme and set font
(set-frame-font "Droid Sans Mono-10" nil t)
(load-theme 'yoshi :no-confirm)

;; Set font
;; (set-frame-font "Droid Sans Mono-10" nil t)

;; Load Theme
;; Install base16-theme & jazz-theme through package manager

(load-theme 'jazz t) ;; Best looking theme, just needs black bg to be perfect

;; (load-theme 'base16-isotope t) ;; black bg, high contrast, great bright text
;; (load-theme 'base16-pop t) ;; black bg, high contrast, nice
;; (load-theme 'base16-pico t) ;; black bg, interesting, high contrast
;; (load-theme 'base16-bright t) ;; black bg, high contrast
;; (load-theme 'base16-ir-black t) ;; black bg, high contrast

;; (load-theme 'base16-seti-ui t) ;; not black bg but dark, good colours
;; (load-theme 'base16-solar-flare t) ;; not black bg but dark, good colours
;; (load-theme 'base16-google-dark t) ;; not black bg but dark, good colours

;; (load-theme 'base16-solarized-dark t);; not black bg but good colours
;; (load-theme 'base16-spacemacs t) ;; not black bg but good colours

;; (load-theme 'base16-phd t) ;; not black bg, colours not very high contrast
;; (load-theme 'base16-tomorrow-night t) ;; not black bg
;; (load-theme 'base16-twilight t) ;; not black bg

;; (load-theme 'base16-summerfruit-dark t) ;; not great i think
;; (load-theme 'base16-railscasts t) ;; not great i think
;; (load-theme 'base16-macintosh t) ;; not great i think

;;OTHER THEMES
;;Danneskjold Theme
;;https://github.com/emacs-jp/replace-colorthemes

Add theme options w/ comments

Add theme options w/ comments


(setq inhibit-startup-message t)
(setq initial-scratch-message ";;;   S C R A T C H   B U F F E R   ;;;
")

(if window-system
   (progn
      (menu-bar-mode 1)
      (tool-bar-mode 0))
   (menu-bar-mode 0))

(setq inhibit-startup-message t)
(setq initial-scratch-message ";;;   S C R A T C H   B U F F E R   ;;;
")

(if window-system
    (progn
        (global-set-key [kp-delete] 'delete-char)
        (global-set-key [M-kp-delete] 'kill-word)
        (menu-bar-mode 1)
        (tool-bar-mode 0))
   (menu-bar-mode 0))

Fix delete in windowed mode

Fix delete in windowed mode


(require-package 'haskell-mode)

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

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

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

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

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

;; Make compilation-mode understand "at blah.hs:11:34-50" lines output by GHC
(add-to-list
 'compilation-error-regexp-alist-alist
 '(ghc-at-regexp " at \\(.*l?hs\\):\\([0-9]+\\):\\([0-9]+\\)-[0-9]+$" 1 2 3 0 1))

(provide 'init-haskell)

(require-package 'haskell-mode)

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

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

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

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

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

;; Make compilation-mode understand "at blah.hs:11:34-50" lines output by GHC
(eval-after-load 'compile
  '(progn
     (let ((alias 'ghc-at-regexp))
       (add-to-list
        'compilation-error-regexp-alist-alist
        (list alias " at \\(.*l?hs\\):\\([0-9]+\\):\\([0-9]+\\)-[0-9]+$" 1 2 3 0 1))
       (add-to-list
        'compilation-error-regexp-alist alias))))

(provide 'init-haskell)

Fix additional haskell compilation regexp entries


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

Use less bright colors in neotree

Use less bright colors in neotree


;;; luhn.el --- luhn (exercism)

;;; Commentary:

;;; Code:

(require 'cl-lib)

(defun luhn-p (str)
  "Check if STR is valid using the Luhn algorithm."
  (let ((str (replace-regexp-in-string " " "" str)))
    (if (string-match-p "[^0-9 ]" str)
        (error "String contains invalid character")
      (unless (<= (length str) 1)
        (let* ((digit-list (reverse (mapcar (lambda (x) (- x 48))
                                            (string-to-list str))))
               (digit-list-with-index (cl-pairlis (number-sequence 0 (1- (length digit-list)))
                                                  digit-list)))
          (zerop (mod (apply #'+
                             (mapcar (lambda (x)
                                       (if (= 1 (mod (car x) 2))
                                           (if (> (* 2 (cdr x)) 9)
                                               (- (* 2 (cdr x)) 9)
                                             (* 2 (cdr x)))
                                         (cdr x)))
                                     digit-list-with-index))
                      10)))))))

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

;;; luhn.el --- luhn (exercism)

;;; Commentary:

;;; Code:

(require 'cl-lib)

(defun char-to-number (char)
  "Return the integer (0-9) represented by CHAR."
  (- char 48))

(defun luhn-mangle (index number)
  "Using Luhn, mangle INDEX and NUMBER."
  (let ((twice (* 2 number)))
    (cond
     ((cl-evenp index) number)
     ((> twice 9) (- twice 9))
     (t twice))))

(defun luhn-p (str)
  "Check if STR is valid using the Luhn algorithm."
  (setq str (replace-regexp-in-string " " "" str))
  (when (string-match-p "[^0-9 ]" str)
    (error "String contains invalid character"))
  (when (< 1 (length str))
    (let ((mangled (cl-mapcar #'luhn-mangle
                              (number-sequence 0 (length str))
                              (reverse (mapcar #'char-to-number str)))))
      (= 0 (mod (apply #'+ mangled) 10)))))

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

Simplify Luhn implementation for readability


(use-package pylookup
  :defer t
  :config
  (progn
    (setq pylookup-dir (concat user-extensions-directory "/pylookup"))
    ;; set executable file and db file
    (setq pylookup-program (concat pylookup-dir "/pylookup.py"))
    (setq pylookup-db-file (concat pylookup-dir "/pylookup.db"))
))

(use-package pylookup
  :commands pylookup-lookup
  :config
  (progn
    (setq pylookup-dir (concat user-extensions-directory "/pylookup"))
    ;; set executable file and db file
    (setq pylookup-program (concat pylookup-dir "/pylookup.py"))
    (setq pylookup-db-file (concat pylookup-dir "/pylookup.db"))))

Fix lazy loading of pylookup

Fix lazy loading of pylookup


(setq js2-basic-offset 2)

(hs-minor-mode)

(when (and (stringp buffer-file-name)
           (string-match "\\.jsx\\'" buffer-file-name))
  (aggressive-indent-mode -1))

;; show wrap guide
(require 'fill-column-indicator)
(setq fci-rule-column personal-wrap-limit)
(fci-mode)

(local-set-key (kbd "C-l b w") 'fci-mode)

;; show junk whitespace
(whitespace-mode)

;; activate character pairing
(smartparens-mode)

;; do some spell checking (requires:  brew install aspell --lang=en)
(flyspell-prog-mode)

(local-set-key (kbd "C-l b s") 'personal/toggle-program-spelling)

;; command shortcuts
(local-set-key (kbd "C-l =") 'personal/align=)
(local-set-key (kbd "C-l ;") 'personal/close-statement)

(local-set-key (kbd "C-l t s") 'toggle-quotes)

;; Include node globals to prevent warnings about undeclared functions/variables
;; (e.g. require/module)
(setq js2-include-node-externs t)

;; js2-refactor
(require 'js2-refactor)
(js2r-add-keybindings-with-prefix "C-l C-l r")

(setq js2-basic-offset 2)

(hs-minor-mode)

(when (and (stringp buffer-file-name)
           (string-match "\\.jsx\\'" buffer-file-name))
  (aggressive-indent-mode -1))

;; show wrap guide
(require 'fill-column-indicator)
(setq fci-rule-column personal-wrap-limit)
(fci-mode)

(local-set-key (kbd "C-l b w") 'fci-mode)

;; show junk whitespace
(whitespace-mode)

;; activate character pairing
(smartparens-mode)

;; do some spell checking (requires:  brew install aspell --lang=en)
(flyspell-prog-mode)

(local-set-key (kbd "C-l b s") 'personal/toggle-program-spelling)

;; command shortcuts
(local-set-key (kbd "C-l =") 'personal/align=)
(local-set-key (kbd "C-l ;") 'personal/close-statement)

(local-set-key (kbd "C-l t s") 'toggle-quotes)

;; Include node globals to prevent warnings about undeclared functions/variables
;; (e.g. require/module)
(setq js2-include-node-externs t)

;; js2-refactor
(require 'js2-refactor)
(js2r-add-keybindings-with-prefix "C-l C-r r")

Move js2 refactoring from C-l C-l to C-l C-r


(add-to-list 'el-get-sources
	     '(:name js3-mode
		     :after (setq js3-highlight-external-variables nil)))

(add-to-list 'el-get-sources
	     '(:name js2-mode))

(add-to-list 'el-get-sources
             '(:name ecmascript-mode
                     :after (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))))

Change JS mode for better ECMAScript support.


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

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

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

(require 'yasnippet)

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

(yas-global-mode 1)

(diminish 'yas-minor-mode)

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

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

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

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

(require 'yasnippet)

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

;; Add yasnippet support for all company backends
;; https://github.com/syl20bnr/spacemacs/pull/179
(defvar company-mode/enable-yas t
  "Enable yasnippet for all backends.")

(defun company-mode/backend-with-yas (backend)
  (if (or
       (not company-mode/enable-yas)
       (and (listp backend) (member 'company-yasnippet backend)))
      backend
    (append (if (consp backend) backend (list backend))
            '(:with company-yasnippet))))

(setq company-backends
      (mapcar #'company-mode/backend-with-yas company-backends))

(defun check-expansion ()
  (save-excursion
    (if (looking-at "\\_>") t
      (backward-char 1)
      (if (looking-at "\\.") t
        (backward-char 1)
        (if (looking-at "->") t nil)))))

(defun do-yas-expand ()
  "Expand a YAS snippet."
  (let ((yas-fallback-behavior 'return-nil))
    (yas-expand)))

(defun tab-indent-or-complete ()
  (interactive)
  (if (minibufferp)
      (minibuffer-complete)
    (if (or (not yas/minor-mode)
            (null (do-yas-expand)))
        (if (check-expansion)
            (company-complete-common)
          (indent-for-tab-command)))))

(global-set-key (kbd "<tab>") 'tab-indent-or-complete)
(define-key company-active-map [tab] 'company-select-next)
(define-key company-active-map [backtab] 'company-select-previous)
(define-key company-active-map (kbd "<tab>") 'company-select-next)
(define-key company-active-map (kbd "<backtab>") 'company-select-previous)

(yas-global-mode 1)

(diminish 'yas-minor-mode)

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

Complete snippets with company mode

Complete snippets with company mode


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

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

(provide 'dependencies)

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

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

(provide 'dependencies)

Add gitignore-mode, gitattributes-mode, and gitconfig-mode as deps


;; Conventional max line length in Racket is 102 columns
(add-hook 'racket-mode-hook (lambda () (column-marker-1 102)))
(add-hook 'racket-mode-hook (lambda () (setq fill-column 102)))

;; Show a column marker in markdown mode
(add-hook 'markdown-mode-hook (lambda () (column-marker-1 80)))

;; Paredit for all S-expression-based programming modes
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(add-hook 'scheme-mode-hook 'paredit-mode)
(add-hook 'racket-mode-hook 'paredit-mode)

;; Fix magit commit message editor, as seen here: http://stackoverflow.com/a/19265280/21957
(if (equal 'darwin system-type)
    (set-variable 'magit-emacsclient-executable "/usr/local/bin/emacsclient"))

;; Conventional max line length in Racket is 102 columns
(add-hook 'racket-mode-hook (lambda () (column-marker-1 102)))
(add-hook 'racket-mode-hook (lambda () (setq fill-column 102)))

;; Conventional max line length in Rust is 102 columns
(add-hook 'rust-mode-hook (lambda () (column-marker-1 99)))
(add-hook 'rust-mode-hook (lambda () (setq fill-column 99)))

;; Show a column marker in markdown mode
(add-hook 'markdown-mode-hook (lambda () (column-marker-1 80)))

;; Paredit for all S-expression-based programming modes
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(add-hook 'scheme-mode-hook 'paredit-mode)
(add-hook 'racket-mode-hook 'paredit-mode)

;; Fix magit commit message editor, as seen here: http://stackoverflow.com/a/19265280/21957
(if (equal 'darwin system-type)
    (set-variable 'magit-emacsclient-executable "/usr/local/bin/emacsclient"))

Add line length check for Rust

Add line length check for Rust


;;; init-company.el -- Company mode setup

;;; Commentary:
;;; company setup

;;; Code:
(require-package 'company)
(require-package 'company-quickhelp)

(company-quickhelp-mode 1)
(global-company-mode 1)

(define-key company-active-map (kbd "\C-n") 'company-select-next)
(define-key company-active-map (kbd "\C-p") 'company-select-previous)
(global-set-key (kbd "M-/") 'hippie-expand)
(add-hook 'company-completion-started-hook (lambda (arg) (fci-mode 0)))
(add-hook 'company-completion-finished-hook (lambda (arg) (fci-mode 1)))

(setq company-dabbrev-downcase nil)
(setq company-dabbrev-ignore-case t)
(setq company-idle-delay 0.25)
(setq company-minimum-prefix-length 0)

(diminish 'company-mode)

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

;;; init-company.el -- Company mode setup

;;; Commentary:
;;; company setup

;;; Code:
(require-package 'company)
(require-package 'company-quickhelp)

(company-quickhelp-mode 1)
(global-company-mode 1)

(define-key company-active-map (kbd "\C-n") 'company-select-next)
(define-key company-active-map (kbd "\C-p") 'company-select-previous)
(global-set-key (kbd "M-/") 'hippie-expand)
(add-hook 'company-completion-cancelled-hook (lambda (arg) (fci-mode 1)))
(add-hook 'company-completion-finished-hook (lambda (arg) (fci-mode 1)))
(add-hook 'company-completion-started-hook (lambda (arg) (fci-mode 0)))

(setq company-dabbrev-downcase nil)
(setq company-dabbrev-ignore-case t)
(setq company-idle-delay 0.25)
(setq company-minimum-prefix-length 0)

(diminish 'company-mode)

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

Fix company mode and fci integration

Fix company mode and fci integration

* When the completion was cancelled fci mode was not being reactivated


(require 'isearch)

;; TODO: handle for isearch-backward and wrap around
(defun my-isearch-goto-next-non-visible-match ()
  "Go to the next match that is beyond this window."
  (interactive)
  ;; See search-forward-lax-whitespace & friends for this pattern:
  (let* ((search-spaces-regexp search-whitespace-regexp)
         (next-non-visible-match
          (save-excursion
            (goto-char (window-end))
            (re-search-forward (regexp-quote isearch-string) nil t))))
    (if (null next-non-visible-match)
        (message "No matches found beyond this window")
      (goto-char next-non-visible-match)
      (goto-char (point-at-bol))
      (recenter 4)
      (isearch-search)
      (isearch-update))))

(define-key isearch-mode-map (kbd "C-v")
  'my-isearch-goto-next-non-visible-match)

(require 'isearch)

;; TODO: handle wrap around
(defun my-isearch-goto-next-non-visible-match ()
  "Go to the next (or previous) match that is beyond this window."
  (interactive)
  (let ((next-non-visible-match
         (let ((search-spaces-regexp search-whitespace-regexp))
           (save-excursion
             (cond (isearch-forward
                    (goto-char (window-end))
                    (re-search-forward (regexp-quote isearch-string) nil t))
                   (t
                    (goto-char (window-start))
                    (re-search-backward (regexp-quote isearch-string) nil t)))))))
    (if (null next-non-visible-match)
        (message "No matches found beyond this window")
      (goto-char next-non-visible-match)
      (cond (isearch-forward
             (goto-char (point-at-bol))
             (recenter 4))
            (t
             (goto-char (point-at-eol))
             (recenter -4)))
      (isearch-search)
      (isearch-update))))

Handle isearch-backward to show previous non visible match


(require 'rcodetools)
(require 'ruby-compilation)
(require 'inf-ruby)

(add-hook 'ruby-mode-hook
          'lambda()
          (local-set-key (kbd "RET") 'reindent-then-newline-and-indent))

(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("[Rr]akefile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))

(global-set-key "\C-ck" 'ruby-compilation-rake)

(require 'rcodetools)
(require 'ruby-compilation)
(require 'inf-ruby)

(add-hook 'ruby-mode-hook
          '(lambda()
	     (local-set-key (kbd "RET") 'reindent-then-newline-and-indent)
	     (local-set-key (kbd "C-c C-c") 'xmp)))

(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("[Rr]akefile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))

(global-set-key "\C-ck" 'ruby-compilation-rake)

Define a shortcut for xmp in Ruby

Define a shortcut for xmp in Ruby


;; Time-stamp: <2014-07-27 15:35:51 kmodi>

;; Hungry Delete

(require 'hungry-delete)

;; (setq my-global-hungry-delete-mode t)

;; `turn-on-hungry-delete-mode' is defined in the hungry-mode package
(defun turn-off-hungry-delete-mode()
  (interactive)
  (hungry-delete-mode -1))

(global-hungry-delete-mode nil)
(add-hook 'activate-mark-hook   'turn-off-hungry-delete-mode)
(add-hook 'deactivate-mark-hook 'turn-on-hungry-delete-mode)

;; Doesn't work as expected
;; (if my-global-hungry-delete-mode
;;     (if delete-selection-mode
;;         (progn
;;           (global-hungry-delete-mode nil)
;;           (add-hook 'activate-mark-hook   'turn-off-hungry-delete-mode)
;;           (add-hook 'deactivate-mark-hook 'turn-on-hungry-delete-mode))
;;       (progn
;;         (global-hungry-delete-mode t)
;;         (remove-hook 'activate-mark-hook   'turn-off-hungry-delete-mode)
;;         (remove-hook 'deactivate-mark-hook 'turn-on-hungry-delet-mode)))
;;   (global-hungry-delete-mode nil))

(setq setup-hungry-delete-loaded t)
(provide 'setup-hungry-delete)

;; Time-stamp: <2014-07-28 00:44:25 kmodi>

;; Hungry Delete

(require 'hungry-delete)

(setq my-global-hungry-delete-mode t)

;; `turn-on-hungry-delete-mode' is defined in the hungry-mode package
(defun turn-off-hungry-delete-mode()
  (interactive)
  (hungry-delete-mode -1))

;; (global-hungry-delete-mode nil)
;; (add-hook 'activate-mark-hook   'turn-off-hungry-delete-mode)
;; (add-hook 'deactivate-mark-hook 'turn-on-hungry-delete-mode)

(if my-global-hungry-delete-mode
    (if delete-selection-mode
        (progn
          (global-hungry-delete-mode nil)
          (add-hook 'activate-mark-hook   'turn-off-hungry-delete-mode)
          (add-hook 'deactivate-mark-hook 'turn-on-hungry-delete-mode))
      (progn
        (global-hungry-delete-mode t)
        (remove-hook 'activate-mark-hook   'turn-off-hungry-delete-mode)
        (remove-hook 'deactivate-mark-hook 'turn-on-hungry-delet-mode)))
  (global-hungry-delete-mode nil))

(setq setup-hungry-delete-loaded t)
(provide 'setup-hungry-delete)

Update the code to add/remove hooks. It works but it uses the delete-selection-mode value at emacs startup. If that mode is deactivated in an emacs session, this file has to be loaded again manually.


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

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

    ;; Shorter modeline
    (setq-default
     projectile-mode-line
     '(:eval
       (if (file-remote-p default-directory)
           " Proj"
         (format " Proj[%s]" (projectile-project-name))))))

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

(provide 'init-projectile)

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

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

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

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

(provide 'init-projectile)

Set shorter projectile mode lighter more idiomatically

Closes #620


;; Time-stamp: <2015-05-06 11:50:36 kmodi>

;; Show actual lines instead of the page break char ^L
;; https://github.com/purcell/page-break-lines

(use-package page-break-lines
  :config
  (progn
    (setq page-break-lines-modes
          '(emacs-lisp-mode
            lisp-mode
            scheme-mode
            compilation-mode
            outline-mode
            help-mode
            text-mode
            fundamental-mode
            special-mode))
    ;; Calling `global-page-break-lines-mode' will enable `page-break-mode'
    ;; automatically in all the modes listed in `page-break-lines-modes' var
    (global-page-break-lines-mode)))

(provide 'setup-page-break-lines)

;; Time-stamp: <2015-06-09 14:55:27 kmodi>

;; Show actual lines instead of the page break char ^L
;; https://github.com/purcell/page-break-lines

(use-package page-break-lines
  :config
  (progn
    (setq page-break-lines-modes '(emacs-lisp-mode
                                   lisp-mode
                                   scheme-mode
                                   compilation-mode
                                   outline-mode
                                   help-mode
                                   text-mode
                                   fundamental-mode
                                   special-mode))

    ;; Fix the issue of page break rule wrapping across multiple lines
    ;; - Above fix doesn't work -- Tue Jun 09 14:03:38 EDT 2015 - kmodi
    ;; (set-fontset-font "fontset-default"
    ;;                   (cons page-break-lines-char page-break-lines-char)
    ;;                   (face-attribute 'default :family))

    ;; Calling `global-page-break-lines-mode' will enable `page-break-mode'
    ;; automatically in all the modes listed in `page-break-lines-modes' var
    (global-page-break-lines-mode)))

(provide 'setup-page-break-lines)

Make a note on the issue of wrapping page ln rule

- Using the fix suggested by the package author did not work for me


;; avy -- quickly jump to an arbitrary word or line
(require 'avy)
(setq avy-case-fold-search 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)
(define-key global-map (kbd "C-c <f11>") #'avy-goto-line)

;; I use next/previous-line and forward/backward-char an awful lot
;; according to `keyfreq-show'. Allow these commands to be repeated,
;; so 'C-n n' is equivalent to 'C-n C-n' and so on.
(global-set-key
 (kbd "C-n")
 (defhydra hydra-move
   (:body-pre (next-line))
   "move"
   ("n" next-line)
   ("p" previous-line)
   ("f" forward-char)
   ("b" backward-char)
   ("a" beginning-of-line-dwim)
   ("e" move-end-of-line)
   ("v" scroll-up-command)
   ;; Converting M-v to V here by analogy.
   ("V" scroll-down-command)))

(provide 'movement-customisations)

;; avy -- quickly jump to an arbitrary word or line
(require 'avy)
(setq avy-case-fold-search 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)
(define-key global-map (kbd "C-c <f11>") #'avy-goto-line)

;; I use next/previous-line and forward/backward-char an awful lot
;; according to `keyfreq-show'. Allow these commands to be repeated,
;; so 'C-n n' is equivalent to 'C-n C-n' and so on.
;;
;; Similar to god-mode, but specialised to just a whitelist of
;; movement commands.
(global-set-key
 (kbd "C-n")
 (defhydra hydra-move
   (:body-pre (next-line))
   "move"
   ("n" next-line)
   ("p" previous-line)
   ("f" forward-char)
   ("b" backward-char)
   ("a" beginning-of-line-dwim)
   ("e" move-end-of-line)
   ("v" scroll-up-command)
   ;; Converting M-v to V here by analogy.
   ("V" scroll-down-command)
   ("l" recenter-top-bottom)))

(provide 'movement-customisations)

Use C-l mapping in our hydra movement cluster.


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

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

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

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

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

(provide 'setup-nim)

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

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

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

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

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

(provide 'setup-nim)

Fix the binding of devdocs-lookup in nim-mode


;;;###autoload
(defun personal/bind-key (prefix keys binding)
  "Binds a command with a prefix to a non-controlled and controlled version this helps with god-mode"
  (let* ((lst (split-string keys " "))
         (ctrl-keys (mapconcat (lambda (key) (if (= (length key) 1)
                                                 (concat "C-" key)
                                               key)) lst " "))
         (capital-meta-keys (mapconcat (lambda (key) (cond ((and (= (length key) 1)
                                                                 (equal (upcase key) key))
                                                            (concat "M-" (downcase key)))
                                                           ((= (length key) 1)
                                                            (concat "C-" key))
                                                           (t key))) lst " ")))
    (global-set-key (kbd (concat prefix " " keys)) binding)
    (global-set-key (kbd (concat prefix " " ctrl-keys)) binding)
    (global-set-key (kbd (concat prefix " " capital-meta-keys)) binding)))

;;;###autoload
(defun personal/bind-key (prefix keys binding)
  "Binds a command with a prefix to a non-controlled and controlled version this helps with god-mode"
  (let* ((lst (split-string keys " ")))
    (global-set-key (kbd (concat prefix " " keys)) binding)))

Remove god mode keybinding helpers

Remove god mode keybinding helpers


(setq inhibit-startup-message t)

;; theme
(if (file-exists-p "~/.light")
    (setq-default frame-background-mode 'light)
  (setq-default frame-background-mode 'dark))
(if (file-exists-p "~/.light")
    (load-theme 'solarized-light t)
  (load-theme 'solarized-dark t))

;; display
(setq display-time-24hr-format t)
(unless window-system
  (menu-bar-mode -1)
  (if (functionp 'scroll-bar-mode)
      (scroll-bar-mode 0)))
(if (functionp 'tool-bar-mode)
    (tool-bar-mode 0))

;; backup
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))

;; tab-complete
(setq ac-auto-start 3)

;; whitespace
(setq-default show-trailing-whitespace t)
(setq require-final-newline t)

(setq inhibit-startup-message t)

;; theme
(if (file-exists-p "~/.light")
    (setq-default frame-background-mode 'light)
  (setq-default frame-background-mode 'dark))
(if (file-exists-p "~/.light")
    (load-theme 'solarized-light t)
  (load-theme 'solarized-dark t))

;; display
(setq display-time-24hr-format t)
(unless window-system
  (menu-bar-mode -1)
  (if (functionp 'scroll-bar-mode)
      (scroll-bar-mode 0)))
(if (functionp 'tool-bar-mode)
    (tool-bar-mode 0))

;; backup
(setq backup-directory-alist
    `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
    `((".*" ,temporary-file-directory t)))

;; tab-complete
(setq ac-auto-start 3)

;; whitespace
(setq-default show-trailing-whitespace t)
(setq require-final-newline t)

Move all emacs temp files to /tmp

Move all emacs temp files to /tmp


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

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

(provide 'dependencies)

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

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

(provide 'dependencies)

Add yaml-mode to the dependency list

Add yaml-mode to the dependency list


;;; ui/pretty-code/autoload/hasklig.el -*- lexical-binding: t; -*-

(defvar +pretty-code--hasklig-font-names
  '(
    "Hasklig-Black.otf"
    "Hasklig-BlackIt.otf"
    "Hasklig-Bold.otf"
    "Hasklig-BoldIt.otf"
    "Hasklig-ExtraLight.otf"
    "Hasklig-ExtraLightIt.otf"
    "Hasklig-It.otf"
    "Hasklig-Light.otf"
    "Hasklig-LightIt.otf"
    "Hasklig-Medium.otf"
    "Hasklig-MediumIt.otf"
    "Hasklig-Regular.otf"
    "Hasklig-Semibold.otf"
    "Hasklig-SemiboldIt.otf"))

;;;###autoload
(defun +pretty-code/install-hasklig-font (&optional prefix)
  "Download and install Hasklig font based on OS.
When prefix is non-nil, ignore the prompt and just install."
  (interactive "P")
  (+pretty-code--install-font
   prefix
   "FiraCode"
   "https://github.com/jsravn/hasklig-emacs/raw/33354a3/%s"
   +pretty-code--hasklig-font-names))

;;; ui/pretty-code/autoload/hasklig.el -*- lexical-binding: t; -*-

(defvar +pretty-code--hasklig-font-names
  '(
    "Hasklig-Black.otf"
    "Hasklig-BlackIt.otf"
    "Hasklig-Bold.otf"
    "Hasklig-BoldIt.otf"
    "Hasklig-ExtraLight.otf"
    "Hasklig-ExtraLightIt.otf"
    "Hasklig-It.otf"
    "Hasklig-Light.otf"
    "Hasklig-LightIt.otf"
    "Hasklig-Medium.otf"
    "Hasklig-MediumIt.otf"
    "Hasklig-Regular.otf"
    "Hasklig-Semibold.otf"
    "Hasklig-SemiboldIt.otf"))

;;;###autoload
(defun +pretty-code/install-hasklig-font (&optional prefix)
  "Download and install Hasklig font based on OS.
When prefix is non-nil, ignore the prompt and just install."
  (interactive "P")
  (+pretty-code--install-font
   prefix
   "Hasklig"
   "https://github.com/jsravn/hasklig-emacs/raw/33354a3/%s"
   +pretty-code--hasklig-font-names))

Fix type in Hasklig install messages

Fix type in Hasklig install messages


;; magit - It's Magit! A Git porcelain inside Emacs
;; https://github.com/magit/magit
(use-package magit
  :ensure magit
  :config
  (progn
    (evil-set-initial-state 'magit-mode 'normal)
    (evil-set-initial-state 'magit-status-mode 'normal)
    (evil-set-initial-state 'magit-diff-mode 'normal)
    (evil-set-initial-state 'magit-log-mode 'normal)
    (evil-define-key 'normal magit-mode-map
        "j" 'magit-goto-next-section
        "k" 'magit-goto-previous-section)
    (evil-define-key 'normal magit-log-mode-map
        "j" 'magit-goto-next-section
        "k" 'magit-goto-previous-section)
    (evil-define-key 'normal magit-diff-mode-map
        "j" 'magit-goto-next-section
        "k" 'magit-goto-previous-section)))

(provide 'my-magit)

;; magit - It's Magit! A Git porcelain inside Emacs
;; https://github.com/magit/magit
(use-package magit
  :ensure magit
  :config
  (progn
    (evil-set-initial-state 'magit-mode 'normal)
    (evil-set-initial-state 'magit-status-mode 'normal)
    (evil-set-initial-state 'magit-diff-mode 'normal)
    (evil-set-initial-state 'magit-log-mode 'normal)
    (evil-define-key 'normal magit-mode-map
        "j" 'magit-section-forward
        "k" 'magit-section-backward)
    (evil-define-key 'normal magit-log-mode-map
        "j" 'magit-section-forward
        "k" 'magit-section-backward)
    (evil-define-key 'normal magit-diff-mode-map
        "j" 'magit-section-forward
        "k" 'magit-section-backward)))

(provide 'my-magit)

Change magit bindings to call proper functions


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

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

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

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

(provide 'init-projectile)

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

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

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

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

(provide 'init-projectile)

Use projectile-mode-line-prefix to set projectile mode line

projectile-mode-line-lighter is obsolete


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

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

;; remove clutter from the UI
(menu-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(scroll-bar-mode -1)
(set-fringe-style -1)

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

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

;; disable alarm bell beep
(setq visible-bell nil)

;; use Monaco font in Mac OS X
(when (eq system-type 'darwin)
  (set-default-font "Monaco"))

;; my theme of choice
(load-theme 'zenburn t)

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

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

;; remove clutter from the UI
(menu-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(scroll-bar-mode -1)
(set-fringe-style -1)

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

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

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

;; use Monaco font in Mac OS X
(when (eq system-type 'darwin)
  (set-default-font "Monaco"))

;; my theme of choice
(load-theme 'zenburn t)

Disable the alarm bell completely

Disable the alarm bell completely


(require-package 'haskell-mode)

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

(add-auto-mode 'haskell-mode "\\.ghci\\'")

(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook (lambda () (subword-mode +1)))

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

(when (eval-when-compile (>= emacs-major-version 24))
  (require-package 'ghci-completion)
  (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion))

;; Make compilation-mode understand "at blah.hs:11:34-50" lines output by GHC
(after-load 'compile
  (let ((alias 'ghc-at-regexp))
    (add-to-list
     'compilation-error-regexp-alist-alist
     (list alias " at \\(.*\\.\\(?:l?[gh]hs\\|hi\\)\\):\\([0-9]+\\):\\([0-9]+\\)-[0-9]+$" 1 2 3 0 1))
    (add-to-list
     'compilation-error-regexp-alist alias)))

(provide 'init-haskell)

(require-package 'haskell-mode)

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

(add-auto-mode 'haskell-mode "\\.ghci\\'")

(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook (lambda () (subword-mode +1)))

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

(when (eval-when-compile (>= emacs-major-version 24))
  (require-package 'ghci-completion)
  (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion))

(eval-after-load 'page-break-lines
  '(push 'haskell-mode page-break-lines-modes))

;; Make compilation-mode understand "at blah.hs:11:34-50" lines output by GHC
(after-load 'compile
  (let ((alias 'ghc-at-regexp))
    (add-to-list
     'compilation-error-regexp-alist-alist
     (list alias " at \\(.*\\.\\(?:l?[gh]hs\\|hi\\)\\):\\([0-9]+\\):\\([0-9]+\\)-[0-9]+$" 1 2 3 0 1))
    (add-to-list
     'compilation-error-regexp-alist alias)))

(provide 'init-haskell)

Enable page-break-lines-mode in haskell buffers


(defun turn-on-rainbow-delimiters-mode ()
  (interactive)
  (rainbow-delimiters-mode 1))

(setq-default frame-background-mode 'dark)
(let ((supported-modes '(emacs-lisp-mode-hook
                         clojure-mode-hook
                         javascript-mode-hook
                         lisp-mode-hook
                         python-mode-hook
                         erlang-mode-hook)))
  (dolist (hook supported-modes)
    (add-hook hook 'turn-on-rainbow-delimiters-mode)))

(defun turn-on-rainbow-delimiters-mode ()
  (interactive)
  (rainbow-delimiters-mode 1))

(setq-default frame-background-mode 'dark)
(let ((supported-modes '(c-mode-common-hook
                         emacs-lisp-mode-hook
                         clojure-mode-hook
                         javascript-mode-hook
                         lisp-mode-hook
                         python-mode-hook
                         erlang-mode-hook)))
  (dolist (hook supported-modes)
    (add-hook hook 'turn-on-rainbow-delimiters-mode)))

Add c modes to rainbow delimiters mode

Add c modes to rainbow delimiters mode


;;; radian-python.el --- Support for Python

(require 'radian-autocomplete)
(require 'radian-package)

;; Integrated development environment for Python.
(use-package anaconda-mode
  :defer-install t
  :commands (anaconda-mode)
  :init

  ;; Enable the functionality of anaconda-mode in Python buffers, as
  ;; suggested in the README [1].
  ;;
  ;; [1]: https://github.com/proofit404/anaconda-mode
  (add-hook 'python-mode-hook #'anaconda-mode)

  :diminish anaconda-mode)

;; Company integration for anaconda-mode.
(use-package company-anaconda
  :recipe (:fetcher github
           :repo "raxod502/company-anaconda"
           :branch "radian-1")
  :defer-install t
  :commands (company-anaconda)
  :init

  (with-eval-after-load 'company
    ;; Enable the functionality of company-anaconda in Python buffers,
    ;; as suggested in the README [1].
    ;;
    ;; [1]: https://github.com/proofit404/company-anaconda

    (defun radian--enable-company-anaconda ()
      (add-to-list 'company-backends #'company-anaconda))

    (add-hook 'python-mode-hook #'radian--enable-company-anaconda)))

(provide 'radian-python)

;;; radian-python.el ends here

;;; radian-python.el --- Support for Python

(require 'radian-autocomplete)
(require 'radian-package)

;; Integrated development environment for Python.
(use-package anaconda-mode
  :defer-install t
  :commands (anaconda-mode)
  :init

  ;; Enable the functionality of anaconda-mode in Python buffers, as
  ;; suggested in the README [1].
  ;;
  ;; [1]: https://github.com/proofit404/anaconda-mode
  (add-hook 'python-mode-hook #'anaconda-mode)

  :diminish anaconda-mode)

;; Company integration for anaconda-mode.
(use-package company-anaconda
  :defer-install t
  :commands (company-anaconda)
  :init

  (with-eval-after-load 'company
    ;; Enable the functionality of company-anaconda in Python buffers,
    ;; as suggested in the README [1].
    ;;
    ;; [1]: https://github.com/proofit404/company-anaconda

    (defun radian--enable-company-anaconda ()
      (add-to-list 'company-backends #'company-anaconda))

    (add-hook 'python-mode-hook #'radian--enable-company-anaconda)))

(provide 'radian-python)

;;; radian-python.el ends here

Stop using my fork of company-anaconda

Stop using my fork of company-anaconda


(put 'erase-buffer 'disabled nil)

(global-set-key (kbd "C-x f") 'find-file-at-point)
(global-set-key (kbd "C-x m") 'magit-status)
(global-set-key (kbd "M-s")   'fixup-whitespace)

(add-hook 'ruby-mode-hook 'ruby-electric-mode)

(setenv "PAGER" "/bin/cat")
(server-start)

(put 'erase-buffer 'disabled nil)

(global-set-key (kbd "C-x f") 'find-file-at-point)
(global-set-key (kbd "C-x m") 'magit-status)
(global-set-key (kbd "M-s")   'fixup-whitespace)

(add-hook 'ruby-mode-hook 'ruby-electric-mode)

(defun copy-from-osx ()
  (shell-command-to-string "pbpaste"))

(defun paste-to-osx (text &optional push)
  (let ((process-connection-type nil))
    (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
      (process-send-string proc text)
      (process-send-eof proc))))

(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx)

(setenv "PAGER" "/bin/cat")
(server-start)

Integrate cut/copy/paste with the OS.

Integrate cut/copy/paste with the OS.


(defun pmade-server-start ()
  (when window-system
    (add-hook 'server-visit-hook 'save-place-find-file-hook)
    (server-start)))

(setq server-use-tcp t
      server-host (if (string= "hawkins.pmade.com" system-name)
                      "10.0.1.10" system-name))

(add-hook 'after-init-hook 'pmade-server-start)

(defun pmade-server-start ()
  (when window-system
    (add-hook 'server-visit-hook 'save-place-find-file-hook)
    (server-start)))

(setq server-use-tcp t
      server-host (if (string= "hawkins" system-name)
                      "10.0.1.10" system-name))

(add-hook 'after-init-hook 'pmade-server-start)

Make up your mind emacs, what does system-name return?


;;; macros-auto-insert.el
;; for ../core-auto-insert.el

;;;###autoload
(defmacro add-template! (regexp-or-major-mode uuid yas-mode &optional project-only)
  `(define-auto-insert ,regexp-or-major-mode
     (lambda ()
       (unless (or (and ,project-only (not (narf/project-p)))
                   (not (or (eq major-mode ,yas-mode)
                            (symbol-value ,yas-mode))))
         (insert ,uuid)
         (yas-expand-from-trigger-key)
         (if (string-equal ,uuid (s-trim (buffer-string)))
             (erase-buffer)
           (evil-insert-state 1))))))

(provide 'macros-auto-insert)
;;; macros-auto-insert.el ends here

;;; macros-auto-insert.el
;; for ../core-auto-insert.el

;;;###autoload
(defmacro add-template! (regexp-or-major-mode uuid yas-mode &optional project-only)
  `(define-auto-insert ,regexp-or-major-mode
     (lambda ()
       (unless (or (and ,project-only (not (narf/project-p)))
                   (not (or (eq major-mode ,yas-mode)
                            (and (boundp ,yas-mode)
                                 (symbol-value ,yas-mode)))))
         (insert ,uuid)
         (yas-expand-from-trigger-key)
         (if (string-equal ,uuid (s-trim (buffer-string)))
             (erase-buffer)
           (evil-insert-state 1))))))

(provide 'macros-auto-insert)
;;; macros-auto-insert.el ends here

Fix error checking minor-mode for file templates


(use-package elpy
  :config
  (elpy-enable))

(provide 'elpy-settings)

(use-package elpy
  :config
  (delete `elpy-module-highlight-indentation elpy-modules)
  (elpy-enable))

(provide 'elpy-settings)

Remove python indent highlight module

Remove python indent highlight module


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

(defconst my-lsp-packages '(company-lsp
                            lsp-mode
                            lsp-treemacs))

(defun my-lsp/post-init-company-lsp ()
  (setq company-lsp-cache-candidates 'auto))

(defun my-lsp/post-init-lsp-mode ()
  (setq lsp-restart 'ignore))

(defun my-lsp/post-init-lsp-treemacs ()
  (with-eval-after-load 'treemacs
    (with-eval-after-load 'lsp-mode
      (lsp-treemacs-sync-mode))))

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

(defconst my-lsp-packages '(company-lsp
                            lsp-mode
                            lsp-treemacs))

(defun my-lsp/post-init-company-lsp ()
  (setq company-lsp-cache-candidates 'auto))

(defun my-lsp/post-init-lsp-mode ()
  (setq lsp-restart 'ignore)
  (with-eval-after-load 'lsp-mode
    (spacemacs/set-leader-keys-for-minor-mode 'lsp-mode
      "hd" #'lsp-ui-doc-glance)))

(defun my-lsp/post-init-lsp-treemacs ()
  (with-eval-after-load 'treemacs
    (with-eval-after-load 'lsp-mode
      (lsp-treemacs-sync-mode))))

Add a key binding to show thing-at-point documentation via lsp


(require-package 'sql-indent)
(eval-after-load 'sql
  '(load-library "sql-indent"))

(eval-after-load 'sql
  '(when (featurep 'dash-at-point)
     (defun sanityinc/maybe-set-dash-db-docset ()
       (when (eq sql-product 'postgres)
         (setq dash-at-point-docset "psql")))

     (add-hook 'sql-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (add-hook 'sql-interactive-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (defadvice sql-set-product (after set-dash-docset activate)
       (sanityinc/maybe-set-dash-db-docset))))

(provide 'init-sql)

(require-package 'sql-indent)
(eval-after-load 'sql
  '(load-library "sql-indent"))

(eval-after-load 'sql
  '(when (package-installed-p 'dash-at-point)
     (defun sanityinc/maybe-set-dash-db-docset ()
        (when (eq sql-product 'postgres)
          (setq dash-at-point-docset "psql")))

     (add-hook 'sql-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (add-hook 'sql-interactive-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (defadvice sql-set-product (after set-dash-docset activate)
       (sanityinc/maybe-set-dash-db-docset))))

(provide 'init-sql)

Use package-installed-p to detect dash-at-point


(defhydra hydra-file-shortcuts (:color teal
                                :columns 4)
  "files"
  ("s" (switch-to-buffer "*scratch*") "scratch" :exit t)
  ("e" (find-file "~/Library/Preferences/Aquamacs Emacs/Preferences.el") ".emacs" :exit t)
  ("b" (find-file "~/.bashrc") "bashrc" :exit t)
  ("n" (find-file "~/workspace/org/notes.org") "notes" :exit t)
  ("c" (find-file "~/.ssh/config") "SSH Config" :exit t)
  ("D" (find-file "/d") "/d" :exit t)
  ("q" nil "quit" :color blue))
(global-set-key (kbd "s-/") 'hydra-file-shortcuts/body)

(provide 'shortcut-file)

(defhydra hydra-file-shortcuts (:color teal
                                :columns 4)
  "files"
  ("s" (switch-to-buffer "*scratch*") "scratch" :exit t)
  ("e" (find-file "~/Library/Preferences/Aquamacs Emacs/Preferences.el") ".emacs" :exit t)
  ("b" (find-file "~/.bash/interactive") "bashrc" :exit t)
  ("n" (find-file "~/workspace/org/notes.org") "notes" :exit t)
  ("c" (find-file "~/.ssh/config") "SSH Config" :exit t)
  ("D" (find-file "/d") "/d" :exit t)
  ("q" nil "quit" :color blue))
(global-set-key (kbd "s-/") 'hydra-file-shortcuts/body)

(provide 'shortcut-file)

Set bashrc shortcut to ~/.bash/interactive


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

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

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

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

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

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

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

(provide 'init-misc)

Use conf-mode for foreman's Procfile

Use conf-mode for foreman's Procfile


;;; company: Modular in-buffer completion framework for Emacs
;;; http://company-mode.github.io/
(use-package company
  :ensure t
  :config
  (progn
    (add-hook 'after-init-hook 'global-company-mode)))

;;; yasnippet: A template system for Emacs
;;; https://github.com/joaotavora/yasnippet
(use-package yasnippet
  :ensure t
  :config
  (progn
    (yas-global-mode 1)))

;;; yasnippet-snippets: a collection of yasnippet snippets for many languages
;;; https://github.com/AndreaCrotti/yasnippet-snippets
(use-package yasnippet-snippets
  :ensure t)

(provide 'my-autocomplete)

;;; company: Modular in-buffer completion framework for Emacs
;;; http://company-mode.github.io/
(use-package company
  :ensure t
  :config
  (progn
    (add-hook 'after-init-hook 'global-company-mode)
    (evil-define-key 'insert 'company-active-map
      (kbd "C-j") 'company-select-next
      (kbd "C-k") 'company-select-previous)))

;;; yasnippet: A template system for Emacs
;;; https://github.com/joaotavora/yasnippet
(use-package yasnippet
  :ensure t
  :config
  (progn
    (yas-global-mode 1)))

;;; yasnippet-snippets: a collection of yasnippet snippets for many languages
;;; https://github.com/AndreaCrotti/yasnippet-snippets
(use-package yasnippet-snippets
  :ensure t)

(provide 'my-autocomplete)

Change company keybindings to be more vim-like


;; pretty lambda (see also slime) ->  "λ"
;;  'greek small letter lambda' / utf8 cebb / unicode 03bb -> \u03BB / mule?!
;; in greek-iso8859-7 -> 107  >  86 ec
(defun pretty-lambdas ()
  (font-lock-add-keywords
   nil `(("(\\(lambda\\>\\)"
          (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                    ,(make-char 'greek-iso8859-7 107))
                    'font-lock-keyword-face))))))

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

(defun enable-paredit (keymap)
  (paredit-mode +1)
  (define-key keymap (kbd "RET") 'paredit-newline))

(add-hook 'emacs-lisp-mode-hook 'pretty-lambdas)
(add-hook 'emacs-lisp-mode-hook (lambda () (enable-paredit emacs-lisp-mode-map)))

(provide 'init-lisp)

;; pretty lambda (see also slime) ->  "λ"
;;  'greek small letter lambda' / utf8 cebb / unicode 03bb -> \u03BB / mule?!
;; in greek-iso8859-7 -> 107  >  86 ec
(defun pretty-lambdas ()
  (font-lock-add-keywords
   nil `(("(\\(lambda\\>\\)"
          (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                    ,(make-char 'greek-iso8859-7 107))
                    'font-lock-keyword-face))))))

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

(defun enable-paredit (keymap)
  (paredit-mode +1)
  (define-key keymap (kbd "RET") 'paredit-newline))

(add-hook 'emacs-lisp-mode-hook 'pretty-lambdas)
(add-hook 'emacs-lisp-mode-hook (lambda () (enable-paredit emacs-lisp-mode-map)))

(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)

(provide 'init-lisp)

Use eldoc mode to provide inline help in emacs-lisp-mode


;;----------------------------------------------------------------------------
;; Misc config - yet to be placed in separate files
;;----------------------------------------------------------------------------
(add-auto-mode 'tcl-mode "Portfile$")
(fset 'yes-or-no-p 'y-or-n-p)
(add-hook 'find-file-hooks 'goto-address-prog-mode)
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
(setq goto-address-mail-face 'link)

(autoload 'mwe:log-keyboard-commands "mwe-log-commands"
  "Log commands executed in the current buffer" t)

(show-paren-mode 1)
(setq show-paren-style 'parenthesis)
(setq show-paren-delay 0)
(column-number-mode 1)

(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 'find-file-hooks 'goto-address-prog-mode)
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
(setq goto-address-mail-face 'link)

(autoload 'mwe:log-keyboard-commands "mwe-log-commands"
  "Log commands executed in the current buffer" t)

(column-number-mode 1)

(provide 'init-misc)

Remove show-paren settings that sometimes made editing unresponsive


;;
;; cust-java-mode.el
;;

;; Java keywords:
(setq cust-java-font-lock-keywords
      (list
       '("^class \\([a-zA-Z0-9]*\\)" 1 'bold-italic t)
       '("\\(public\\|private\\|protected\\|package\\)" 1 'bold-LightSteelBlue2-face t)
       '("::" . 'Thistle2-face)
       '("\\<\\(catch\\|try\\|throw\\)" 1 'Plum2-face t)
       ))

(font-lock-add-keywords 'java-mode cust-java-font-lock-keywords)

;; Function to generate header:
(defun java-insert-file-header ()
  (interactive)
  "Inserts some lines for a header, including VCS info, author, date and copyright."
  (insert
   "//____________________________________________________________________
// File: " (buffer-name) "
//____________________________________________________________________
//
// Author: " (user-full-name)  " <" user-mail-address ">
// Update: " (format-time-string "%Y-%m-%d %T%z") "
// Revision: $Id" "$
//
// Copyright: " (format-time-string "%Y") " (C) " (user-full-name) "
//
//--------------------------------------------------------------------
"))

;;
(add-hook 'java-mode-hook
	  (function (lambda ()
		      (require 'easymenu)
		      (easy-menu-define java-menu java-mode-map "Java Menu"
			'("Insert"
			  ["Insert File Header" java-insert-file-header t]
			  ))
		      ;;
		      (define-key java-mode-map "\C-m" 'newline-and-indent))))
;;
(setq auto-mode-alist (append '(("\\.java\\'" . java-mode))
			      auto-mode-alist))

;;
;; End of cust-java-mode.el
;;

;;
;; cust-java-mode.el
;;

;; Java keywords:
(setq cust-java-font-lock-keywords
      (list
       '("^class \\([a-zA-Z0-9]*\\)" 1 'bold-italic t)
       '("\\(public\\|private\\|protected\\|package\\)" 1 'bold-LightSteelBlue2-face t)
       '("::" . 'Thistle2-face)
       '("\\<\\(catch\\|try\\|throw\\)" 1 'Plum2-face t)
       ))

(font-lock-add-keywords 'java-mode cust-java-font-lock-keywords)
;;
(add-hook 'java-mode-hook
	  (function (lambda ()
		      ;;
		      (define-key java-mode-map "\C-m" 'newline-and-indent))))
;;
;; End of cust-java-mode.el
;;

Remove Java insert-file-header function - moved to auto-insert customizations.


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

(use-package! ansible
  :commands ansible-auto-decrypt-encrypt
  :init
  (put 'ansible-vault-password-file 'safe-local-variable #'stringp)
  :config
  (setq ansible-section-face 'font-lock-variable-name-face
        ansible-task-label-face 'font-lock-doc-face)
  (map! :map ansible-key-map
        :localleader
        :desc "Decrypt buffer"          "d" #'ansible-decrypt-buffer
        :desc "Encrypt buffer"          "e" #'ansible-encrypt-buffer
        :desc "Look up in Ansible docs" "h" #'ansible-doc))

(after! ansible-doc
  (set-evil-initial-state! '(ansible-doc-module-mode) 'emacs))

(use-package! jinja2-mode
  :mode "\\.j2$"
  :config
  ;; The default behavior is to reindent the whole buffer on save. This is
  ;; disruptive and imposing. There are indentation commands available; the user
  ;; can decide when they want their code reindented.
  (setq jinja2-enable-indent-on-save nil))

(def-project-mode! +ansible-yaml-mode
  :modes '(yaml-mode)
  :add-hooks '(ansible ansible-auto-decrypt-encrypt ansible-doc-mode)
  :files ("roles/"))

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

(use-package! ansible
  :commands ansible-auto-decrypt-encrypt
  :init
  (put 'ansible-vault-password-file 'safe-local-variable #'stringp)
  :config
  (setq ansible-section-face 'font-lock-variable-name-face
        ansible-task-label-face 'font-lock-doc-face)
  (map! :map ansible-key-map
        :localleader
        :desc "Decrypt buffer"          "d" #'ansible-decrypt-buffer
        :desc "Encrypt buffer"          "e" #'ansible-encrypt-buffer
        :desc "Look up in Ansible docs" "h" #'ansible-doc))

(after! ansible-doc
  (set-evil-initial-state! '(ansible-doc-module-mode) 'emacs))

(use-package! jinja2-mode
  :mode "\\.j2$"
  :config
  ;; The default behavior is to reindent the whole buffer on save. This is
  ;; disruptive and imposing. There are indentation commands available; the user
  ;; can decide when they want their code reindented.
  (setq jinja2-enable-indent-on-save nil))

(def-project-mode! +ansible-yaml-mode
  :modes '(yaml-mode)
  :add-hooks '(ansible ansible-auto-decrypt-encrypt ansible-doc-mode)
  :files (or "roles/" "tasks/main.yml"))

Add detection for projects that are ansible roles

Ansible roles _often_ have a `tasks/main.yml` file in them, and benefit
from some of the nice ansible syntax highlighting.


((cperl-mode . ((cperl-indent-level . 3)
                )))

((cperl-mode . ((cperl-indent-level . 3)
                ))
 (perl-mode . ((perl-indent-level . 3)
               )))

Add emacs config for perl-mode

Add emacs config for perl-mode

... because people might use perl-mode instead of cperl-mode


(require 'org)

(setq org-return-follows-link t)

;; Syntax highlight org code snippets.
(setq org-src-fontify-natively t)

(provide 'org-customisations)

(require 'org)

(setq org-return-follows-link t)

;; Syntax highlight org code snippets.
(setq org-src-fontify-natively t)

;; Allow running code in sh and python
(require 'ob-sh)
(require 'ob-python)

(provide 'org-customisations)

Allow sh and python code snippets in org-mode.


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

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

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

(custom-set-variables
 ;; score apropos results by relavance.
 '(apropos-sort-by-scores t)
 ;; show line numbers.
 '(global-display-line-numbers-mode t)
 ;; save back up files to temporary directories.
 '(backup-directory-alist `((".*" . ,temporary-file-directory))))

;; remap keys for iTerm 2
;; use cat -v or ctrl-v to show the sequence in iTerm 2.
;; replace ^[ with \e
(define-key input-decode-map "\e[1;9A" [M-up])
(define-key input-decode-map "\e[1;9B" [M-down])
(define-key input-decode-map "\e[1;9C" [M-right])
(define-key input-decode-map "\e[1;9D" [M-left])

Add keymappings for iTerm 2

Add keymappings for iTerm 2


(load "~/.emacs.d/fira_init.el")

;; (set-frame-font "Fira Code:size=10")
(setq default-frame-alist '((font . "Fira Code:size=12")))
(scroll-bar-mode 0)
(menu-bar-mode 0)
(tool-bar-mode 0)

(global-linum-mode 1)
(show-paren-mode 1)
(global-hl-line-mode 1)

(setq-default fill-column 80)

(setq initial-scratch-message "")
(setq inhibit-startup-message t)

(setq scroll-conservatively 101)
(setq scroll-margin 5)

(setq visible-bell t)

(setq default-frame-alist '((font . "Fira Code:size=12")))
(defun my-correct-symbol-bounds (pretty-alist)
  (mapcar (lambda (el)
            (setcdr el (string ?\t (cdr el)))
            el)
          pretty-alist))
(defun my-ligature-list (ligatures codepoint-start)
  (let ((codepoints (-iterate '1+ codepoint-start (length ligatures))))
    (-zip-pair ligatures codepoints)))
(setq my-hasklig-ligatures
      (let* ((ligs '("&&" "***" "*>" "\\\\" "||" "|>" "::"
                     "==" "===" "==>" "=>" "=<<" "!!" ">>"
                     ">>=" ">>>" ">>-" ">-" "->" "-<" "-<<"
                     "<*" "<*>" "<|" "<|>" "<$>" "<>" "<-"
                     "<<" "<<<" "<+>" ".." "..." "++" "+++"
                     "/=" ":::" ">=>" "->>" "<=>" "<=<" "<->")))
        (my-correct-symbol-bounds (my-ligature-list ligs #Xe100))))

(defun my-set-hasklig-ligatures ()
  (setq prettify-symbols-alist
        (append my-hasklig-ligatures prettify-symbols-alist))
  (prettify-symbols-mode))

(add-hook 'prog-mode-hook 'my-set-hasklig-ligatures)

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

(global-linum-mode 1)
(show-paren-mode 1)
(global-hl-line-mode 1)

(setq-default fill-column 80)

(setq initial-scratch-message "")
(setq inhibit-startup-message t)

(setq scroll-conservatively 101)
(setq scroll-margin 5)

(setq visible-bell t)

emacs: Add hasklig font mappings to emacs; switch font to hasklig


(setq evil-leader/in-all-states t
      evil-leader/leader "SPC"
      evil-leader/non-normal-prefix "s-")
(require 'evil-leader)
;; make leader available in visual mode
(define-key evil-visual-state-map (kbd "SPC") evil-leader/map)
;; Unset shortcuts which shadow evil leader
(eval-after-load "compile"
  (define-key compilation-mode-map (kbd "SPC") nil))

(setq evil-leader/in-all-states t
      evil-leader/leader "SPC"
      evil-leader/non-normal-prefix "s-")
(require 'evil-leader)
;; Unset shortcuts which shadow evil leader
(eval-after-load "compile"
  (define-key compilation-mode-map (kbd "SPC") nil))
;; make leader available in visual mode
(define-key evil-visual-state-map (kbd "SPC") evil-leader/map)
(define-key evil-motion-state-map (kbd "SPC") evil-leader/map)
(define-key evil-emacs-state-map  (kbd "SPC") evil-leader/map)

Add evil leader to emacs and motion states.


;; Time-stamp: <2015-05-22 13:01:06 kmodi>

;; Pcache

(use-package pcache
  :init
  (progn
    (setq pcache-directory (let ((dir (concat user-emacs-directory
                                              "var_" emacs-version-short "/pcache/")))
                             (make-directory dir :parents)
                             dir))))

(provide 'setup-pcache)

;; Time-stamp: <2015-12-10 14:58:51 kmodi>

;; Pcache

(use-package pcache
  :preface
  (progn
    (setq pcache-directory (let ((dir (concat user-emacs-directory
                                              "var_" emacs-version-short "/pcache/")))
                             (make-directory dir :parents)
                             dir))))

(provide 'setup-pcache)

Use :preface instead of :init

Minor: Use :preface instead of :init


;; Time-stamp: <2014-11-19 10:19:17 kmodi>

;; gtags, GNU global

(req-package ggtags
  :require (verilog-mode key-chord)
  :init
  (progn
    (setq ggtags-navigation-mode-lighter nil)
    (dolist (hook '(verilog-mode-hook
                    matlab-mode-hook
                    c-mode-hook))
      (add-hook hook 'ggtags-mode))
    (key-chord-define-global "??" 'ggtags-show-definition)))

(provide 'setup-gtags)

;; Time-stamp: <2014-12-11 14:03:10 kmodi>

;; gtags, GNU global

(req-package ggtags
  :require (verilog-mode key-chord)
  :init
  (progn
    (setq ggtags-navigation-mode-lighter nil)
    (setq ggtags-oversize-limit (* 30 1024 1024))

    (dolist (hook '(verilog-mode-hook
                    matlab-mode-hook
                    c-mode-hook))
      (add-hook hook 'ggtags-mode))

    (key-chord-define-global "??" 'ggtags-show-definition)))

(provide 'setup-gtags)

Set ggtags oversize limit to 30 MB

Set ggtags oversize limit to 30 MB


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

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

Enable fido mode by default in Emacs

Enable fido mode by default in Emacs


; Calendar

	(require 'calfw)
	(require 'calfw-ical)
	(require 'calfw-org)

; Settings

	(define-key evil-normal-state-map (kbd ",cal") (lambda () (interactive) (cfw:open-ical-calendar "/home/musicnate/.emacs.d/calendar/emacs-cal.ics")))

	; TODO intergrate org mode

(provide 'init-calendar)

; Calendar

	(require 'calfw)
	(require 'calfw-ical)
	(require 'calfw-org)

; Settings

	(define-key evil-normal-state-map (kbd ",cal") (lambda () (interactive) (cfw:open-ical-calendar "https://calendar.google.com/calendar/ical/nathan.mador.house%40gmail.com/public/basic.ics")))
	; (define-key evil-normal-state-map (kbd ",cal") (lambda () (interactive) (cfw:open-ical-calendar "/home/musicnate/.emacs.d/calendar/emacs-cal.ics")))

	; TODO intergrate org mode

(provide 'init-calendar)

Change local location of ics to online version.


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

;;; Commentary:

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

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

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

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

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

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

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

;;; Commentary:

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

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

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

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

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

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

Simplify 'Fine' case to avoid another regex

If the string has been trimmed on the left and right for
whitespace (in the let-binding), the string will be empty.


(setf inhibit-startup-screen t) ; disable welcome screen

(when (not (display-graphic-p))
  (menu-bar-mode -1)) ; disable menu bar in CLI

;; improve scrolling
(setf scroll-margin 5
      scroll-step 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01)

(show-paren-mode 1) ; highlight matching parens

(global-hl-line-mode 1) ; highlight current line

(setq-default indent-tabs-mode nil) ; use spaces instead of tabs

(setf inhibit-startup-screen t) ; disable welcome screen

(setf ring-bell-function 'ignore) ; disable alarm bell

(when (not (display-graphic-p))
  (menu-bar-mode -1)) ; disable menu bar in CLI

;; improve scrolling
(setf scroll-margin 5
      scroll-step 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01)

(show-paren-mode 1) ; highlight matching parens

(global-hl-line-mode 1) ; highlight current line

(setq-default indent-tabs-mode nil) ; use spaces instead of tabs

Disable alarm bell in emacs

Disable alarm bell in emacs


(require 'yaml-mode)

(add-to-list 'auto-mode-alist '("\.yml" . feature-mode))

(require 'yaml-mode)

(add-to-list 'auto-mode-alist '("\.yml" . yaml-mode))

Fix yaml auto load list.

Fix yaml auto load list.


;;; package --- Summary

;;; Commentary:

;;; Code:

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

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

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

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

(load-theme 'badger)

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

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

;;; package --- Summary

;;; Commentary:

;;; Code:

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

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

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

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

(load-theme 'badger)

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

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

Fix syntax error in color theme module

Fix syntax error in color theme module


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

((nil . ((fill-column . 80)))
 (c++-mode . ((mode . subword)))
 (c-mode . ((mode . subword))))

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

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

Allow for headings starting with "///" in C/C++ files


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

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

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

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

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

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

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

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

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

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

(provide 'jl-ui)

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

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

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

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

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

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

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

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

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

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

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

(provide 'jl-ui)

Use 2 spaces for tabs

emacs: Use 2 spaces for tabs


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

(use-package! god-mode
  :hook (doom-after-init-modules . god-mode-all)
  :config
  (add-hook 'post-command-hook #'+god--configure-cursor-and-modeline-h)
  (add-hook 'overwrite-mode-hook #'+god--toggle-on-overwrite-h))

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

(use-package! god-mode
  :hook (doom-after-init-modules . god-mode-all)
  :config
  (add-hook 'post-command-hook #'+god--configure-cursor-and-modeline-h)
  (add-hook 'overwrite-mode-hook #'+god--toggle-on-overwrite-h)

  (after! which-key
    (which-key-enable-god-mode-support)))

Enable god-mode support for which-key if required

Signed-off-by: Akhil Wali <943cd345c3e5219847c26c148b71517511dbc93b@gmail.com>


(add-hook
 'ruby-mode-hook
 (lambda ()
   ;; Check spelling.
   (flyspell-prog-mode)
   ;; Don't autofill
   (auto-fill-mode 0)
   ;; Make enter indent.
   (local-set-key (kbd "C-m") 'reindent-then-newline-and-indent)
   ;; Clean up whitespace on save.
   (add-hook 'before-save-hook 'whitespace-cleanup nil t)
   ;; Rebuild tags on save.
   (add-hook (make-local-variable 'after-save-hook) 'rebuild-tags nil t)
   ;; Disable rubocop
   (defvar flycheck-disabled-checkers "flycheck.el")
   (setq flycheck-disabled-checkers
         (cons 'ruby-rubocop flycheck-disabled-checkers))
   ;; Turn on subword-mode
   (require 'diminish)
   (subword-mode 1)
   (diminish 'subword-mode)
   ;; Make do/end less prominent.
   (defvar paren-face-regexp)
   (setq-local paren-face-regexp
               (rx symbol-start (or "do" "end") symbol-end))))

(add-hook
 'ruby-mode-hook
 (lambda ()
   ;; Check spelling.
   (flyspell-prog-mode)
   ;; Don't autofill
   (auto-fill-mode 0)
   ;; Make enter indent.
   (local-set-key (kbd "C-m") 'reindent-then-newline-and-indent)
   ;; Make smart-tab always indent
   (defvar smart-tab-always-indent nil)
   (setq-local smart-tab-always-indent t)
   ;; Clean up whitespace on save.
   (add-hook 'before-save-hook 'whitespace-cleanup nil t)
   ;; Rebuild tags on save.
   (add-hook (make-local-variable 'after-save-hook) 'rebuild-tags nil t)
   ;; Disable rubocop
   (defvar flycheck-disabled-checkers "flycheck.el")
   (setq flycheck-disabled-checkers
         (cons 'ruby-rubocop flycheck-disabled-checkers))
   ;; Turn on subword-mode
   (require 'diminish)
   (subword-mode 1)
   (diminish 'subword-mode)
   ;; Make do/end less prominent.
   (defvar paren-face-regexp)
   (setq-local paren-face-regexp
               (rx symbol-start (or "do" "end") symbol-end))))

Make tab always indent in Ruby

Make tab always indent in Ruby