(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

(add-hook
 'markdown-mode-hook
 (lambda ()
   (local-unset-key (kbd "<backtab>"))))

(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

(add-hook
 'markdown-mode-hook
 (lambda ()
   (local-unset-key (kbd "<backtab>"))
   (defvar markdown-indent-on-enter "markdown-mode.el")
   (setq markdown-indent-on-enter nil)))

Disable indent on newline for markdown files


(defun configure-sql-indentation ()
  "Configure the indentation settings for `sqlind-minor-mode'."
  (require 'sql-indent-left)
  (setq
   sqlind-basic-offset 2
   sqlind-indentation-offsets-alist `((in-select-clause +)
                                      (select-join-condition +)
                                      ,@sqlind-indentation-left-offsets-alist)))
(add-hook 'sqlind-minor-mode-hook 'configure-sql-indentation)

(defun configure-sql-indentation ()
  "Configure the indentation settings for `sqlind-minor-mode'."
  (require 'sql-indent-left)
  (setq
   sqlind-basic-offset 2
   sqlind-indentation-offsets-alist
   `((in-select-clause +)
     (select-join-condition +)
     (nested-statement-open sqlind-use-anchor-indentation +)
     (nested-statement-continuation sqlind-use-anchor-indentation +)
     ,@sqlind-indentation-left-offsets-alist)))
(add-hook 'sqlind-minor-mode-hook 'configure-sql-indentation)

Indent by a fixed amount inside parens

Indent by a fixed amount inside parens


; ~/.emacs.d/my-gui.el

;; Remove scrollbars, menu bars, and toolbars
; when is a special form of "if", with no else clause, it reads:
; (when <condition> <code-to-execute-1> <code-to-execute2> ...)
(when (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; Remove scrollbars, menu bars, and toolbars

(unless (eq window-system 'mac)
  (when (and (fboundp 'menu-bar-mode) (not (eq menu-bar-mode -1)))
    (menu-bar-mode -1)))
(when (and (fboundp 'scroll-bar-mode) (not (eq scroll-bar-mode -1)))
  (scroll-bar-mode -1))
(when (and (fboundp 'tool-bar-mode) (not (eq tool-bar-mode -1)))
  (tool-bar-mode -1))
;; tooltips in echo-aera
(when (and (fboundp 'tooltip-mode) (not (eq tooltip-mode -1)))
  (tooltip-mode -1))

Add tooltip mode to remove tooltips

Add tooltip mode to remove tooltips


;; modernizing Emacs' Package Menu
;; with package ratings, usage statistics, customizability, and more
(use-package paradox
  :defer 0.1
  :init
  (setq
   paradox-github-token "5572ad3a003df76865d5a039b4a2152452c8aff9"
   paradox-execute-asynchronously t
   paradox-automatically-star t)
  :config
  ;; replace the default interface with paradox
  (paradox-enable))

(use-package exec-path-from-shell
  :init
  (setq exec-path-from-shell-check-startup-files nil)
  :config
  (exec-path-from-shell-copy-envs '("WAKATIME_API_KEY"))
  (when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize)))

(use-package use-package-ensure-system-package)

;; (use-package use-package-chords
;;   :config (key-chord-mode 1))

(use-package server
  :config
  (unless (server-running-p)
    (server-start)))

(use-package auto-package-update
  :config
  (setq
   auto-package-update-delete-old-versions t
   auto-package-update-interval 4)
  (auto-package-update-maybe))

(provide 'init-system)

;; modernizing Emacs' Package Menu
;; with package ratings, usage statistics, customizability, and more
(use-package paradox
  :defer 0.1
  :init
  (setq
   paradox-execute-asynchronously t
   paradox-automatically-star t)
  :config
  ;; replace the default interface with paradox
  (paradox-enable))

(use-package exec-path-from-shell
  :init
  (setq exec-path-from-shell-check-startup-files nil)
  :config
  (exec-path-from-shell-copy-envs '("WAKATIME_API_KEY"))
  (when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize)))

(use-package use-package-ensure-system-package)

;; (use-package use-package-chords
;;   :config (key-chord-mode 1))

(use-package server
  :config
  (unless (server-running-p)
    (server-start)))

(use-package auto-package-update
  :config
  (setq
   auto-package-update-delete-old-versions t
   auto-package-update-interval 4)
  (auto-package-update-maybe))

(provide 'init-system)

Remove revoken oauth token lol

Remove revoken oauth token lol


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

;;;###autoload
(defun +doom-modeline|resize-for-big-font ()
  "Adjust the modeline's height when `doom-big-font-mode' is enabled. This was
made to be added to `doom-big-font-mode-hook'."
  (let ((default-height (default-value '+doom-modeline-height)))
    (if doom-big-font-mode
        (let* ((font-size (font-get doom-font :size))
               (big-size (font-get doom-big-font :size))
               (ratio (/ (float big-size) font-size)))
          (setq +doom-modeline-height (ceiling (* default-height ratio))))
      (setq +doom-modeline-height default-height))
    ;; already has a variable watcher in Emacs 26+
    (unless EMACS26+ (+doom-modeline|refresh-bars))))

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

(defvar +doom-modeline--old-bar-height nil)
;;;###autoload
(defun +doom-modeline|resize-for-big-font ()
  "Adjust the modeline's height when `doom-big-font-mode' is enabled. This was
made to be added to `doom-big-font-mode-hook'."
  (unless +doom-modeline--old-bar-height
    (setq +doom-modeline--old-bar-height +doom-modeline-height))
  (let ((default-height +doom-modeline--old-bar-height))
    (if doom-big-font-mode
        (let* ((font-size (font-get doom-font :size))
               (big-size (font-get doom-big-font :size))
               (ratio (/ (float big-size) font-size)))
          (setq +doom-modeline-height (ceiling (* default-height ratio 0.75))))
      (setq +doom-modeline-height default-height))
    ;; already has a variable watcher in Emacs 26+
    (unless EMACS26+ (+doom-modeline|refresh-bars))))

Fix modeline growing incrementally on big font mode

Fixes #575


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

(doom!
 :completion
 ivy
 (company +auto)

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

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

 :emacs
 (dired +icons)
 electric
 vc

 :tools
 (lookup +docsets)
 eval
 make
 magit
 lsp
 editorconfig
 flyspell
 flycheck
 pdf
 ein

 :lang
 agda
 (sh +fish)
 emacs-lisp
 markdown
 (csharp +unity)
 (haskell +lsp)
 (org
  +attach
  +babel
  +export
  +present)
 (cc +lsp)
 ocaml
 idris
 (web +html +css)
 (latex +latexmk)

 :term
 vterm
 eshell

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

 :collab
 ;;floobits          ; peer programming for a price
 ;;impatient-mode    ; show off code over HTTP

 :config
 (default)
 ;;literate
 )

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

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

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

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

 :emacs
 (dired +icons)
 electric
 vc

 :tools
 (lookup +docsets)
 eval
 make
 magit
 lsp
 editorconfig
 flyspell
 flycheck
 pdf
 ein

 :lang
 agda
 (sh +fish)
 emacs-lisp
 markdown
 (csharp +unity)
 (haskell +lsp)
 (org
  +attach
  +babel
  +export
  +present)
 (cc +lsp)
 ocaml
 idris
 (web +html +css)
 (latex +latexmk)

 :term
 vterm
 eshell

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

 :collab
 ;;floobits          ; peer programming for a price
 ;;impatient-mode    ; show off code over HTTP

 :config
 (default)
 ;;literate
 )

Enable +icons and +childframe for ivy in emacs


(add-hook
 'typescript-mode-hook
 (lambda ()
  ;; Activate auto-fill-mode.
  (set-fill-column 100)
  (auto-fill-mode t)
  ;; Enable Flyspell.
  (flyspell-prog-mode)
  ;; Make enter indent.
  (local-set-key (kbd "RET") 'newline-and-indent)
  ;; Set indent level.
  (defvar typescript-indent-level)
  (setq typescript-indent-level 2)
  ;; Clean whitespace on save.
  (add-hook 'before-save-hook 'whitespace-cleanup nil t)
  ;; Allow movement between subwords.
  (subword-mode 1)
  (require 'diminish)
  (diminish 'subword-mode)))

(add-hook
 'typescript-mode-hook
 (lambda ()
   ;; Activate auto-fill-mode.
   (set-fill-column 100)
   (auto-fill-mode t)
   ;; Enable Flyspell.
   (flyspell-prog-mode)
   ;; Disable eslint
   (defvar flycheck-disabled-checkers)
   (setq-local flycheck-disabled-checkers
               (cons 'javascript-eslint flycheck-disabled-checkers))
   ;; Make enter indent.
   (local-set-key (kbd "RET") 'newline-and-indent)
   ;; Set indent level.
   (defvar typescript-indent-level)
   (setq typescript-indent-level 2)
   ;; Clean whitespace on save.
   (add-hook 'before-save-hook 'whitespace-cleanup nil t)
   ;; Allow movement between subwords.
   (subword-mode 1)
   (require 'diminish)
   (diminish 'subword-mode)))

Disable eslint for typescript files

Disable eslint for typescript files


(require 'wrap-region)

;; Active in all modes
(wrap-region-global-mode t)

;; Only wrap region if trigger key is given a negative prefix argument
(setq wrap-region-only-with-negative-prefix t)

;; Custom wrappers

(wrap-region-add-wrapper "{ value: " " }" "v" 'js2-mode)

(wrap-region-add-wrapper "<c:out value=\"" "\"/>" "o" 'html-mode)
(wrap-region-add-wrapper "
" "
" "p" 'html-mode)
(wrap-region-add-wrapper "
" "
" "l" 'html-mode)
(wrap-region-add-wrapper "" "" "r" 'html-mode)

(provide 'setup-wrap-region)

(require 'wrap-region)

;; Active in all modes
(wrap-region-global-mode t)

;; Only wrap region if trigger key is given a negative prefix argument
(setq wrap-region-only-with-negative-prefix t)

;; Custom wrappers

(wrap-region-add-wrapper "{ value: " " }" "v" 'js2-mode)

(wrap-region-add-wrapper "<c:out value=\"" "\"/>" "o" 'html-mode)
(wrap-region-add-wrapper "
" "
" "p" 'html-mode)
(wrap-region-add-wrapper "
" "
" "l" 'html-mode)
(wrap-region-add-wrapper "" "" "s" 'html-mode)
(wrap-region-add-wrapper "" "" "a" 'html-mode)
(wrap-region-add-wrapper "" "" "r" 'html-mode)
(wrap-region-add-wrapper "
" "
" "h" 'html-mode)

(provide 'setup-wrap-region)

Add strong, a and h1 to html-mode wrap-region.


;; Time-stamp: <2014-08-13 11:46:17 kmodi>

;; LaTeX
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

(setq LaTeX-command "latex -shell-escape")

;; Source: http://www.sigmafield.org/2009/10/03/using-doc-view-with-auto-revert-to-view-latex-pdf-output-in-emacs
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
;; Source: http://www.gnu.org/software/auctex/manual/auctex/Multifile.html
(setq TeX-PDF-mode t
      TeX-auto-save t
      TeX-parse-self t
      TeX-save-query nil)

(setq-default TeX-master nil) ; Query for master file.

(provide 'setup-latex)

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

;; LaTeX
(load "auctex.el" nil t t)

;; preview-latex doesn't work in emacs 24.4 (also doesn't seem like it's needed)
(==e243
 (load "preview-latex.el" nil t t))

(setq LaTeX-command "latex -shell-escape")

;; Source: http://www.sigmafield.org/2009/10/03/using-doc-view-with-auto-revert-to-view-latex-pdf-output-in-emacs
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
;; Source: http://www.gnu.org/software/auctex/manual/auctex/Multifile.html
(setq TeX-PDF-mode t
      TeX-auto-save t
      TeX-parse-self t
      TeX-save-query nil)

(setq-default TeX-master nil) ; Query for master file.

(provide 'setup-latex)

Disable loading of `preview-latex' in emacs 24.4; that would still be loaded in emacs 24.3


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

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

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

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

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

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

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

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

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

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

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

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

Add projectile prefix to Emacs

Add projectile prefix to Emacs


;; org publish options

(setq org-publish-project-alist
	  '(
		;; ... add all the components here (see below)...

		;; All org files (notes)
		("org-notes"
		 :base-directory "~/org/business"
		 :base-extension "org"
		 :publishing-directory "/var/www/manual/"
		 :style "<link rel=\"stylesheet\" href=\"css/stylesheet.css\" type=\"text/css\" />"
		 :recursive f
		 :publishing-function org-html-publish-to-html
		 :headline-levels 4             ; Just the default for this project.
		 :auto-preamble t
		 :html-head "<link rel=\"stylesheet\" href=\"css/stylesheet.css\" type=\"text/css\" />"
		 )

		;; Attachments
		("org-static"
		 :base-directory "~/org/"
		 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|htaccess"
		 :publishing-directory "/var/www/manual/"
		 :recursive t
		 :publishing-function org-publish-attachment
		 )

		;; Publish component
		("org"
     :components ("org-notes" "org-static"))

	  ))

 '(org-stuck-projects (quote ("hard" ("REDUNDANT" "DONE" "NEXT" "NEXTACTION") nil "")))

; Create a little function to run publish mode in a shortcut
(defun puborg ()
  (interactive)
  (org-publish-project "org")
)

;; org publish options

(setq org-publish-project-alist
	  '(
		;; ... add all the components here (see below)...

		;; All org files (notes)
		("org-notes"
		 :base-directory "~/org/business"
		 :base-extension "org"
		 :publishing-directory "/var/www/manual/"
		 :style "<link rel=\"stylesheet\" href=\"css/stylesheet.css\" type=\"text/css\" />"
		 :recursive f
		 :publishing-function org-html-publish-to-html
		 :headline-levels 4             ; Just the default for this project.
		 :auto-preamble t
		 :html-head "<link rel=\"stylesheet\" href=\"css/stylesheet.css\" type=\"text/css\" />"
		 )

		;; Attachments
		("org-static"
		 :base-directory "~/org/"
		 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|htaccess"
		 :publishing-directory "/var/www/manual/"
		 :recursive t
		 :publishing-function org-publish-attachment
		 )

		;; Publish component
		("org"
     :components ("org-notes" "org-static"))

	  ))

 '(org-stuck-projects (quote ("hard" ("REDUNDANT" "DONE" "NEXT" "NEXTACTION") nil "")))

; Create a little function to run publish mode in a shortcut
(defun puborg ()
  (interactive)
  (setq org-export-with-broken-links 't)
  (org-publish-project "org")
)

Add publish with broken links

Add publish with broken links


(if (equal (getenv "TERM_PROGRAM") "iTerm.app")
    (progn
      ;; mouse integration
      (require 'mouse) ;; needed for iterm2 compatibility
      (require 'mwheel)

      (xterm-mouse-mode)
      (defvar mouse-wheel-progressive-speed)
      (setq mouse-wheel-progressive-speed nil)
      (defvar mouse-wheel-scroll-amount)
      (setq mouse-wheel-scroll-amount '(1))

      (mouse-wheel-mode 1)

      (declare-function cua-copy-region (arg) "cua-base.el")
      (defun smart-copy-region ()
        (interactive)
        (cua-copy-region nil)
        (shell-command-on-region
         (region-beginning)
         (region-end)
         "pbcopy")
        (message ""))
      (global-set-key (kbd "M-w") 'smart-copy-region)))

;; mouse integration
(require 'mouse) ;; needed for iterm2 compatibility
(require 'mwheel)

(if (equal (getenv "TERM_PROGRAM") "iTerm.app")
    (progn
      (xterm-mouse-mode)
      (defvar mouse-wheel-progressive-speed)
      (setq mouse-wheel-progressive-speed nil)
      (defvar mouse-wheel-scroll-amount)
      (setq mouse-wheel-scroll-amount '(1))

      (mouse-wheel-mode 1)

      (declare-function cua-copy-region (arg) "cua-base.el")
      (defun smart-copy-region ()
        (interactive)
        (cua-copy-region nil)
        (shell-command-on-region
         (region-beginning)
         (region-end)
         "pbcopy")
        (message ""))
      (global-set-key (kbd "M-w") 'smart-copy-region)))

Clean up OSX mouse handling

Clean up OSX mouse handling


(use-package org
  :mode ("\\.org$" . org-mode)
  :config
  (progn
    (require 'org-install)
    (define-key global-map "\C-cl" 'org-store-link)
    (define-key global-map "\C-ca" 'org-agenda)
    (setq org-log-done t)
    (use-package org-bullets
      :config
      (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
    (use-package org-trello
      :config
      (add-hook 'org-mode-hook 'org-trello-mode))))

(use-package org
  :mode ("\\.org$" . org-mode)
  :config
  (progn
    (require 'org-install)
    (define-key global-map "\C-cl" 'org-store-link)
    (define-key global-map "\C-ca" 'org-agenda)
    (setq org-log-done t)
    (setq org-agenda-files '("~/Dropbox/org"))
    (use-package org-bullets
      :config
      (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
    (use-package org-trello
      :config
      (add-hook 'org-mode-hook 'org-trello-mode))))

Add org files to agenda files list

Add org files to agenda files list


;;; setup-file-nav.el --- Set up tools to navigate through files.
;;; Commentary:
;;; Code:

;; direx looks like a good alternative. I have tried NeoTree, but it sucks.
(use-package direx
  :ensure t)

;; NeoTree could *sometimes* be better than Dired.
(use-package neotree
  :ensure t
  :bind ("<f7>" . neotree-toggle))

;; This package is cool, I like coloring stuff around
(use-package dired-k
  :ensure t
  :config
  (progn
    (add-hook 'dired-initial-position-hook 'dired-k)
    (add-hook 'dired-after-readin-hook #'dired-k-no-revert)))

;; it seems sensible to hide every detail by default and use ) when I
;; have to show more info, like file size or permissions
(use-package dired+
 :ensure t
 :config
 (global-dired-hide-details-mode 1)
 ;; Since b is unbound in dired and ^ is a very annoying key to press,
 ;; lets bind that to dired-up-directory
 (with-eval-after-load 'dired+
   (define-key dired-mode-map (kbd "b") #'dired-up-directory)))

(provide 'setup-file-nav)
;;; setup-file-nav.el ends here

;;; setup-file-nav.el --- Set up tools to navigate through files.
;;; Commentary:
;;; Code:

;; direx looks like a good alternative. I have tried NeoTree, but it sucks.
(use-package direx
  :ensure t)

;; NeoTree could *sometimes* be better than Dired.
(use-package neotree
  :ensure t
  :bind ("<f7>" . neotree-toggle))

;; This package is cool, I like coloring stuff around
(use-package dired-k
  :ensure t
  :config
  (progn
    (add-hook 'dired-initial-position-hook 'dired-k)
    (add-hook 'dired-after-readin-hook #'dired-k-no-revert)))

;; it seems sensible to hide every detail by default and use ) when I
;; have to show more info, like file size or permissions
(use-package dired+
 :ensure t
 :config
 (global-dired-hide-details-mode 1)
 ;; Since b is unbound in dired and ^ is a very annoying key to press,
 ;; lets bind that to dired-up-directory
 (with-eval-after-load 'dired+
   (define-key dired-mode-map (kbd "b") #'dired-up-directory)))

;; We want to be able to toggle dot files in dired
(with-eval-after-load 'dired
  (require 'dired-x)
  (setq dired-omit-files (concat dired-omit-files "\\|^\\..+$"))
  (define-key dired-mode-map "h" #'dired-omit-mode))

(provide 'setup-file-nav)
;;; setup-file-nav.el ends here

Make dired be able to toggle dot files

Make dired be able to toggle dot files


;; Time-stamp: <2017-03-24 16:44:20 kmodi>

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

(use-package nim-mode
  :ensure t
  :mode (("\\.nim\\'" . nim-mode)))

(provide 'setup-nim)

;; Time-stamp: <2017-04-14 23:15:22 kmodi>

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

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

(provide 'setup-nim)

Add nim compilation command to smart-compile-alist


(define-package
  "fsharp-mode"
  "0.9"
  "F# mode for Emacs"
  '((popup      "0.5")
    (pos-tip    "0.4.5")
    (s          "1.3.1")
    (dash       "1.1.0")))

(define-package
  "fsharp-mode"
  "0.9"
  "F# mode for Emacs"
  '((popup      "0.5")
    (pos-tip    "0.4.5")
    (s          "1.3.1")
    (dash       "1.1.0")
    (auto-complete "1.4")))

Add auto-complete package as dependency

Add auto-complete package as dependency


(require 'package)

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

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

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

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

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

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

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

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

(package-initialize)

(require 'package)

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

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

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

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

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

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

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

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

(package-initialize)

Use clj-refactor in Melpa to work with cider 0.10.0, which requires clj-refactor 2.0.0-SNAPSHOT.


;; Personal Emacs configuration
;; Lorenzo Cabrini <lorenzo.cabrini@gmail.com>

;; Package management
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
			 ("melpa" . "https://melpa.org/packages/")
			 ("melpa-stable" . "https://stable.melpa.org/packages/")))
(package-initialize)

;; Set up UTF-8 environment
(set-language-environment "UTF-8")

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

;; User interface
(blink-cursor-mode 0)  ; Cursor, don't blink
(tool-bar-mode -1)

;; Theme
(load-theme 'wheatgrass t)

;; Powerline
(require 'powerline)
(powerline-default-theme)

;; C and related languages
(require 'cc-mode)
(setq c-default-style "linux")

;; Org mode
(setq org-agenda-files '("~/org"))

Add files in ~/org to the Org agenda.

Add files in ~/org to the Org agenda.


(require 'ace-jump-mode)
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)

(require 'ace-jump-mode)
(define-key global-map (kbd "C-0") 'ace-jump-mode)

Change my shortcut for ace-jump

Change my shortcut for ace-jump


;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; vertical window split
(setq split-width-threshold nil)

;; theme
(use-package zenburn-theme
  :ensure t
  :config
  (setq default-frame-alist nil)
  (load-theme 'zenburn t))

;; zoom
(defhydra hydra-zoom (global-map "<f1>")
  "zoom"
  ("O" zoom-font-off "off")
  ("i" zoom-font "in")
  ("o" zoom-font-out "out"))

(provide 'setup-interface)

;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; vertical window split
(setq split-width-threshold 190)
(setq split-height-threshold nil)

;; theme
(use-package zenburn-theme
  :ensure t
  :config
  (setq default-frame-alist nil)
  (load-theme 'zenburn t))

;; zoom
(defhydra hydra-zoom (global-map "<f1>")
  "zoom"
  ("O" zoom-font-off "off")
  ("i" zoom-font "in")
  ("o" zoom-font-out "out"))

(provide 'setup-interface)

Fix window not splitting correctly

Fix window not splitting correctly


;; Enable the built in pair mode
(electric-pair-mode 1)

;; Turn off menubar
(menu-bar-mode -1)

;; auto-indent
(define-key global-map (kbd "C-j") 'newline-and-indent)

;; Tab settings
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)

; stop emacs from contaminating each directory with semantic.cache
(setq semanticdb-default-save-directory "/tmp")

;; (display-battery-mode)
(setq column-number-mode t)
;;(display-time)
(setq backup-inhibited t) ;; disable backup

;fullscreen mode (Redundant in Emacs 24.4)
(defun switch-full-screen ()
  (interactive)
  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))

;; Setup external directory variable
(setq elisp-external-dir
	  (expand-file-name "external" user-emacs-directory))

;; Add external projects to load path
(add-to-list 'load-path elisp-external-dir)

(dolist (project (directory-files elisp-external-dir t "\\w+"))
  (when (file-directory-p project)
	(add-to-list 'load-path project)))

; Auto revert unless there is unsaved data
(global-auto-revert-mode t)

;; Don't ask to save abbrevs
(setq save-abbrevs 'silently)

;; Use highlight colors
(global-font-lock-mode t)

Revert "electric-pair-mode failed with python files."

This reverts commit d5b221c3e03a9fa1aed9f765e29304270cf12188.


;;; packages.el --- Ruby Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq yaml-packages '(yaml-mode))

(defun yaml/init-yaml-mode ()
  "Initialize YAML mode"
  (use-package yaml-mode
    :mode (("\\.\\(yml\\|yaml\\)\\'" . yaml-mode)
           ("Procfile\\'" . yaml-mode))
    :config (add-hook 'yaml-mode-hook
                      '(lambda ()
                         (define-key yaml-mode-map "\C-m" 'newline-and-indent)))))

;;; packages.el --- YAML Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq yaml-packages '(yaml-mode))

(defun yaml/init-yaml-mode ()
  "Initialize YAML mode"
  (use-package yaml-mode
    :mode (("\\.\\(yml\\|yaml\\)\\'" . yaml-mode)
           ("Procfile\\'" . yaml-mode))
    :config (add-hook 'yaml-mode-hook
                      '(lambda ()
                         (define-key yaml-mode-map "\C-m" 'newline-and-indent)))))

Fix the header for the YAML package.el

Fix the header for the YAML package.el


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

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

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

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

(provide 'init-rails)

(global-rinari-mode)

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

(provide 'init-rails)

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


(require-package 'todochiku)

(require 'todochiku) ;; growl notifications when compilation finishes
(setq todochiku-icons-directory
      (expand-file-name "site-lisp/todochiku-icons" user-emacs-directory))

(defcustom terminal-notifier-path
  "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
  "Path to the terminal-notifier app for Mountain Lion, if installed.
See https://github.com/alloy/terminal-notifier for more information.")

(when (and *is-a-mac* (file-executable-p terminal-notifier-path))
  (defadvice todochiku-get-arguments (around todochiku-terminal-notifier activate)
    (setq ad-return-value
          (list "-title" title "-message" message "-activate" "org.gnu.Emacs")))
  (setq todochiku-command terminal-notifier-path))

(defadvice todochiku-message (around check-for-helper activate)
  "Suppress message attempts when the `todochiku-command' program is missing."
  (when (executable-find todochiku-command)
    ad-do-it))

(provide 'init-growl)

(require-package 'todochiku)

(defadvice todochiku-message (around check-for-helper activate)
  "Suppress message attempts when the `todochiku-command' program is missing."
  (when (executable-find todochiku-command)
    ad-do-it))

(setq todochiku-icons-directory
      (expand-file-name "site-lisp/todochiku-icons" user-emacs-directory))

(defcustom terminal-notifier-path
  "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
  "Path to the terminal-notifier app for Mountain Lion, if installed.
See https://github.com/alloy/terminal-notifier for more information.")

(when (and *is-a-mac* (file-executable-p terminal-notifier-path))
  (defadvice todochiku-get-arguments (around todochiku-terminal-notifier activate)
    (setq ad-return-value
          (list "-title" title "-message" message "-activate" "org.gnu.Emacs")))
  (setq todochiku-command terminal-notifier-path))

(require 'todochiku) ;; growl notifications when compilation finishes

(provide 'init-growl)

Change initialisation order for todochiku to better handle missing commands

Fixes #140


(dolist (hook '(nxml-mode-hook haml-mode-hook sass-mode-hook))
  (add-hook hook (lambda () (rinari-launch))))
(defun update-rails-ctags ()
  (interactive)
  (let ((default-directory (or (rinari-root) default-directory)))
    (shell-command (concat "ctags -a -e -f " rinari-tags-file-name " --tag-relative -R app lib vendor test"))))
(require 'rinari)

(add-hook 'rails-minor-mode-hook (lambda () (local-set-key [f6] 'recompile)))

(provide 'init-rails)

(dolist (hook '(nxml-mode-hook haml-mode-hook sass-mode-hook magit-mode-hook))
  (add-hook hook (lambda () (rinari-launch))))
(defun update-rails-ctags ()
  (interactive)
  (let ((default-directory (or (rinari-root) default-directory)))
    (shell-command (concat "ctags -a -e -f " rinari-tags-file-name " --tag-relative -R app lib vendor test"))))
(require 'rinari)

(add-hook 'rails-minor-mode-hook (lambda () (local-set-key [f6] 'recompile)))

(provide 'init-rails)

Add rinari-launch to magit-mode-hook for convenience, since magit doesn't use the C-c prefix


(require-package 'dired+)
(require-package 'dired-sort)

(setq-default diredp-hide-details-initially-flag nil
              dired-dwim-target t)

;; Prefer g-prefixed coreutils version of standard utilities when available
(let ((gls (executable-find "gls")))
  (when gls (setq insert-directory-program gls)))

(after-load 'dired
  (require 'dired+)
  (require 'dired-sort)
  (when (fboundp 'global-dired-hide-details-mode)
    (global-dired-hide-details-mode -1))
  (setq dired-recursive-deletes 'top)
  (define-key dired-mode-map [mouse-2] 'dired-find-file)
  (add-hook 'dired-mode-hook
            (lambda () (guide-key/add-local-guide-key-sequence "%"))))

(when (maybe-require-package 'diff-hl)
  (after-load 'dired
    (add-hook 'dired-mode-hook 'diff-hl-dired-mode)))

(provide 'init-dired)

(require-package 'dired-sort)

(setq-default dired-dwim-target t)

;; Prefer g-prefixed coreutils version of standard utilities when available
(let ((gls (executable-find "gls")))
  (when gls (setq insert-directory-program gls)))

(when (maybe-require-package 'diredfl)
  (add-hook 'dired-mode-hook 'diredfl-mode))

(after-load 'dired
  (require 'dired-sort)
  (setq dired-recursive-deletes 'top)
  (define-key dired-mode-map [mouse-2] 'dired-find-file)
  (add-hook 'dired-mode-hook
            (lambda () (guide-key/add-local-guide-key-sequence "%"))))

(when (maybe-require-package 'diff-hl)
  (after-load 'dired
    (add-hook 'dired-mode-hook 'diff-hl-dired-mode)))

(provide 'init-dired)

Drop dired+ and use diredfl for enhanced font-locking


(require 'todochiku) ;; growl notifications when compilation finishes
(setq todochiku-icons-directory (expand-file-name "~/.emacs.d/site-lisp/todochiku-icons"))

;;----------------------------------------------------------------------------
;; Use terminal-notifier in OS X Mountain Lion
;; https://github.com/alloy/terminal-notifier (Install in /Applications)
;;----------------------------------------------------------------------------
(setq terminal-notifier-path
      "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier")

(defadvice todochiku-get-arguments (around todochiku-nc)
  (setq ad-return-value
        (list "-title" title "-message" message "-activate" "org.gnu.Emacs")))

(when (file-executable-p terminal-notifier-path)
  (setq todochiku-command terminal-notifier-path)
  (ad-activate 'todochiku-get-arguments))

(provide 'init-growl)

(require 'todochiku) ;; growl notifications when compilation finishes
(setq todochiku-icons-directory (expand-file-name "~/.emacs.d/site-lisp/todochiku-icons"))

(defcustom terminal-notifier-path
  "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
  "Path to the terminal-notifier app for Mountain Lion, if installed.
See https://github.com/alloy/terminal-notifier for more information.")

(when (and *is-a-mac* (file-executable-p terminal-notifier-path))
  (defadvice todochiku-get-arguments (around todochiku-terminal-notifier activate)
    (setq ad-return-value
          (list "-title" title "-message" message "-activate" "org.gnu.Emacs")))
  (setq todochiku-command terminal-notifier-path))

(provide 'init-growl)

Tidy up terminal-notifier code, and skip file test when not on OS X


(require 'init-frame-hooks)

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

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

(provide 'init-xterm)

(require 'init-frame-hooks)

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

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

(provide 'init-xterm)

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

Closes #85


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

(def-package! fill-column-indicator
  :hook ((text-mode prog-mode conf-mode) . turn-on-fci-mode)
  :config
  (defun +fci|set-color ()
    (setq fci-rule-color (face-foreground 'line-number)))
  (add-hook 'doom-load-theme-hook #'+fci|set-color)
  (+fci|set-color)

  (when (featurep! :completion company)
    (add-hook 'company-completion-started-hook #'+fci|disable-when-company-activates)
    (add-hook! '(company-completion-finished-hook company-completion-cancelled-hook)
      #'+fci|enable-when-company-deactivates)))

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

(defvar +fci-rule-color-function
  (lambda () (face-foreground 'line-number))
  "Color used to draw the fill-column rule.

Accepts a color string or a function that returns a color.

Changes to this variable do not take effect until `fci-mode' is restarted.")

;;
;; Plugins
;;

(def-package! fill-column-indicator
  :hook ((text-mode prog-mode conf-mode) . turn-on-fci-mode)
  :config
  (defun +fci|set-color ()
    "Automatically change `fci-rule-color' based on `+fci-rule-color-function's
return value. To disable this, either set `+fci-rule-color-function' to nil or
remove `+fci|set-color' from `fci-mode-hook'."
    (when (functionp +fci-rule-color-function)
      (setq fci-rule-color (funcall +fci-rule-color-function))))
  (add-hook 'fci-mode-hook #'+fci|set-color)

  (when (featurep! :completion company)
    (add-hook 'company-completion-started-hook #'+fci|disable-when-company-activates)
    (add-hook! '(company-completion-finished-hook company-completion-cancelled-hook)
      #'+fci|enable-when-company-deactivates)))

Make ui/fci's automatic color change customizable


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

(setq dired-listing-switches "-lRA --ignore='.git' --group-directories-first"
      dired-auto-revert-buffer t
      dired-isearch-filenames t)

(defun pjones:dired-show-only-matching-files (regexp)
  (interactive "sFiles to show (regexp): ")
  (dired-mark-files-regexp regexp)
  (dired-toggle-marks)
  (dired-do-kill-lines))

(defun pjones:dired-load-hook ()
  (define-key dired-mode-map [?%?h] 'pjones:dired-show-only-matching-files))

(add-hook 'dired-load-hook 'pjones:dired-load-hook)
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)

Add a new dired function to only show files that match a regexp


(defconst olical-lisp-packages
  '(lispy
    parinfer))

(defun olical-lisp/init-lispy ()
  (use-package lispy))

(defun olical-lisp/init-parinfer ()
  (use-package parinfer
    :init
    (progn
      (setq-default parinfer-lighters '(" infer" . " (infer)"))
      (setq-default parinfer-extensions
                    '(defaults
                       pretty-parens
                       evil
                       lispy
                       smart-tab
                       smart-yank))
      (add-hook 'clojure-mode-hook #'parinfer-mode)
      (add-hook 'racket-mode-hook #'parinfer-mode)
      (add-hook 'scheme-mode-hook #'parinfer-mode)
      (add-hook 'emacs-lisp-mode-hook #'parinfer-mode)
      (spacemacs/set-leader-keys-for-minor-mode 'parinfer-mode "," 'parinfer-toggle-mode))))

(defconst olical-lisp-packages
  '(lispy))

(defun olical-lisp/init-lispy ()
  (use-package lispy))

Remove parinfer, forces me to use lispy more


;; Default js indentation levels
(setq-default js2-basic-offset 2)
(setq js-indent-level 2)

;; Disallow scrolling with mouse wheel
(mouse-wheel-mode nil)

;; Don't screw up key bindings in magit-mode
(add-to-list 'wrap-region-except-modes 'adventur-mode)

;; Font size
(define-key global-map (kbd "M-s +") 'zoom-in)
(define-key global-map (kbd "M-s -") 'zoom-out)

;; org-mode: beginning/end of buffer on M-up/down

(eval-after-load "org"
  '(progn
     (define-key org-mode-map (kbd "M-<up>") 'beginning-of-buffer)
     (define-key org-mode-map (kbd "M-<down>") 'end-of-buffer)
     (define-key org-mode-map (kbd "C-S-<up>") 'org-metaup)
     (define-key org-mode-map (kbd "C-S-<down>") 'org-metadown)))

;; Default js indentation levels
(setq-default js2-basic-offset 2)
(setq js-indent-level 2)

;; Disallow scrolling with mouse wheel
(mouse-wheel-mode nil)

;; Don't screw up key bindings in magit-mode
(add-to-list 'wrap-region-except-modes 'adventur-mode)

;; Font size
(define-key global-map (kbd "M-s +") 'zoom-in)
(define-key global-map (kbd "M-s -") 'zoom-out)

;; Use GNU ls - install with:
;;    brew install xz
;;    brew install coreutils
(setq insert-directory-program "gls")

;; org-mode: beginning/end of buffer on M-up/down
(eval-after-load "org"
  '(progn
     (define-key org-mode-map (kbd "M-<up>") 'beginning-of-buffer)
     (define-key org-mode-map (kbd "M-<down>") 'end-of-buffer)
     (define-key org-mode-map (kbd "C-S-<up>") 'org-metaup)
     (define-key org-mode-map (kbd "C-S-<down>") 'org-metadown)))

Use GNU ls since it supports --dired

Use GNU ls since it supports --dired


(flycheck-define-checker python-pylama
  "A Python syntax and style checker using the pylama utility. See URL
  `http://pypi.python.org/pypi/pylama'."

  :command ("pylama" source-inplace)
  :error-patterns
  ((error line-start (file-name) ":" line ":" (message) line-end))
  :modes python-mode)

(add-to-list 'flycheck-checkers 'python-pylama)

(add-hook 'after-init-hook #'global-flycheck-mode)
(add-to-list 'display-buffer-alist
             `(,(rx bos "*Flycheck errors*" eos)
               (display-buffer-reuse-window
                display-buffer-in-side-window)
               (reusable-frames . visible)
               (side . bottom)
               (window-height . 0.2)))

Add pylama checker to flycheck

Add pylama checker to flycheck


(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "<home>") 'beginning-of-line)
(global-set-key (kbd "<end>") 'end-of-line)
(global-set-key (kbd "M-<home>") 'beginning-of-buffer)
(global-set-key (kbd "C-<home>") 'beginning-of-buffer)
(global-set-key (kbd "M-<end>") 'end-of-buffer)
(global-set-key (kbd "C-<end>") 'end-of-buffer)
(global-set-key (kbd "M-g") 'goto-line)
(global-set-key (kbd "C-x C-r") 'my/recentf-ido-find-file)
(global-set-key (kbd "M-y") 'kill-ring-ido) ; replace usual kill-ring-pop
(global-set-key (kbd "<M-up>") 'my/move-line-up)
(global-set-key (kbd "<M-down>") 'my/move-line-down)

(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
(global-set-key (kbd "<home>") 'beginning-of-line)
(global-set-key (kbd "<end>") 'end-of-line)
(global-set-key (kbd "M-<home>") 'beginning-of-buffer)
(global-set-key (kbd "C-<home>") 'beginning-of-buffer)
(global-set-key (kbd "M-<end>") 'end-of-buffer)
(global-set-key (kbd "C-<end>") 'end-of-buffer)
(global-set-key (kbd "M-g") 'goto-line)
(global-set-key (kbd "C-x C-r") 'my/recentf-ido-find-file)
(global-set-key (kbd "M-y") 'kill-ring-ido) ; replace usual kill-ring-pop
(global-set-key (kbd "<M-up>") 'my/move-line-up)
(global-set-key (kbd "<M-down>") 'my/move-line-down)

Add commands for searching backwards too.


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

;; Auto-indent after paste in Go triggers goimports, that makes pasting imports
;; difficult. Let's let gofmt triggered by file save handle the indentation.
(add-to-list 'spacemacs-indent-sensitive-modes 'go-mode)

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

;; Automatic re-indentation after paste in `go-mode' may trigger a call to
;; goimports which will remove unused imports. That makes it frustrating to
;; paste source code containing new package imports, as they will immediately be
;; removed again if the buffer doesn't yet contain any logic using the new
;; package.
;;
;; To avoid this issue we will disable automatic re-indentation after paste. The
;; task to re-indent the source code will be left to an `after-save-hook' which
;; calls goimports, gofmt or equivalent.
;;
(add-to-list 'spacemacs-indent-sensitive-modes 'go-mode)

Improve description of why we mark go-mode to be indent sensitive


;;; pdf-tools-conf.el -- Setting for pdf-tools.
;;
;;; Commentary:
;;
;;; Code:
(eval-when-compile
  (require 'pdf-tools))

;; Dependencies:
(require 'pdf-outline)

(defun pjones:pdf-outline-follow-link-and-quit ()
  "Follow outline link and delete the outline window."
  (interactive)
  (let ((win (selected-window)))
    (pdf-outline-follow-link nil)
    (delete-window win)))

;; Settings:
(custom-set-variables
 '(pdf-view-continuous nil))

;; Extra key bindings:
(define-key pdf-outline-buffer-mode-map (kbd "RET") #'pjones:pdf-outline-follow-link-and-quit)

;;; pdf-tools-conf.el ends here

;;; pdf-tools-conf.el -- Setting for pdf-tools.
;;
;;; Commentary:
;;
;;; Code:
(eval-when-compile
  (require 'pdf-tools))

;; Dependencies:
(require 'pdf-outline)

(defun pjones:pdf-outline-follow-link-and-quit ()
  "Follow outline link and delete the outline window."
  (interactive)
  (let ((win (selected-window))
        (buf (current-buffer)))
    (pdf-outline-follow-link nil)
    (delete-window win)
    (kill-buffer buf)))

(defun pjones:pdf-outline-quit ()
  "Close the outline buffer and window."
  (interactive)
  (let ((win (selected-window))
        (buf (current-buffer)))
    (delete-window win)
    (kill-buffer buf)))

;; Settings:
(custom-set-variables
 '(pdf-view-continuous nil))

;; Extra key bindings:
(define-key pdf-outline-buffer-mode-map (kbd "RET") #'pjones:pdf-outline-follow-link-and-quit)
(define-key pdf-outline-buffer-mode-map (kbd "q")   #'pjones:pdf-outline-quit)

;;; pdf-tools-conf.el ends here

pdf-tools: Delete the outline buffer when jumping away

This also helps ensure a new outline is created the next time one is
needed and will match the PDF document.  (Reloading the PDF doesn't
seem to also reload the outline.)


;; ==============================================================================
;; Undo/redo extensions
;; ------------------------------------------------------------------------------

;; (use-package "redo+"
;;   :load-path "site-lisp/redo+")

(use-package "undo-tree"
  :config
  (global-undo-tree-mode)
  (global-set-key (kbd "s-z g") 'global-undo-tree-mode)
  (global-set-key (kbd "s-z t") 'undo-tree-visualize)
  (define-key function-key-map (kbd "s-z z") 'undo)
  (define-key function-key-map (kbd "s-z Z") 'redo))

(autoload 'longlines-mode "longlines.el"
  "Minor mode for editing long lines." t)

;; ==============================================================================
;; Undo/redo extensions
;; ------------------------------------------------------------------------------

;; (use-package "redo+"
;;   :load-path "site-lisp/redo+")

(use-package "undo-tree"
  :config
  (global-undo-tree-mode)
  (global-set-key (kbd "s-z g") 'global-undo-tree-mode)
  (global-set-key (kbd "s-z t") 'undo-tree-visualize)
  (define-key function-key-map (kbd "s-z z") 'undo)
  (define-key function-key-map (kbd "s-z x") 'redo))

(autoload 'longlines-mode "longlines.el"
  "Minor mode for editing long lines." t)

Change key map for redo

Change key map for redo


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

(package! php-boris)
(package! php-extras :recipe (:host github :repo "arnested/php-extras"))
(package! php-mode)
(package! php-refactor-mode)
(package! phpunit)

(when (featurep! +hack)
  (package! hack-mode :recipe (:host github :repo "hhvm/hack-mode")))

(unless (featurep! +lsp)
  (package! phpactor)
  (package! company-phpactor))

(when (featurep! :editor format)
  (package! php-cs-fixer))

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

(package! php-boris)
(package! php-extras :recipe (:host github :repo "arnested/php-extras"))
(package! php-mode)
(package! php-refactor-mode)
(package! phpunit)

(when (featurep! +hack)
  (package! hack-mode :recipe (:host github :repo "hhvm/hack-mode")))

(unless (featurep! +lsp)
  (package! phpactor)
  (when (featurep! :completion company)
    (package! company-phpactor)))

(when (featurep! :editor format)
  (package! php-cs-fixer))

Add feature detection for company-phpactor

`company-phpactor` separation gives us the ability to only install it if `company` is enabled.

Co-Authored-By: Oleksii Filonenko <389acbe81f0fd7fe3ec649f394c339e6fc62238f@protonmail.com>


(setq lua-packages
  '(
    company
    flycheck
    lua-mode
    ))

(defun lua/post-init-flycheck ()
  (spacemacs/add-flycheck-hook 'lua-mode))

(defun lua/init-lua-mode ()
  (use-package lua-mode
    :defer t
    :mode ("\\.lua\\'" . lua-mode)
    :interpreter ("lua" . lua-mode)
    :config
    (progn
      (setq lua-indent-level 2
            lua-indent-string-contents t)
      (spacemacs/set-leader-keys-for-major-mode 'lua-mode "d" 'lua-search-documentation)
      (spacemacs/set-leader-keys-for-major-mode 'lua-mode "sb" 'lua-send-buffer)
      (spacemacs/set-leader-keys-for-major-mode 'lua-mode "sf" 'lua-send-defun)
      (spacemacs/set-leader-keys-for-major-mode 'lua-mode "sl" 'lua-send-current-line)
      (spacemacs/set-leader-keys-for-major-mode 'lua-mode "sr" 'lua-send-region))))

(defun lua/post-init-company ()
  (add-hook 'lua-mode-hook 'company-mode))

(setq lua-packages
  '(
    company
    flycheck
    lua-mode
    ))

(defun lua/post-init-flycheck ()
  (spacemacs/add-flycheck-hook 'lua-mode))

(defun lua/init-lua-mode ()
  (use-package lua-mode
    :defer t
    :mode ("\\.lua\\'" . lua-mode)
    :interpreter ("lua" . lua-mode)
    :init
    (progn
      (setq lua-indent-level 2
            lua-indent-string-contents t)
      (spacemacs/set-leader-keys-for-major-mode 'lua-mode
        "d" 'lua-search-documentation
        "sb" 'lua-send-buffer
        "sf" 'lua-send-defun
        "sl" 'lua-send-current-line
        "sr" 'lua-send-region))))

(defun lua/post-init-company ()
  (add-hook 'lua-mode-hook 'company-mode))

Move lua setup to init block

Move lua setup to init block


;; set your desired tab width
(setq-default indent-tabs-mode nil)

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

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

;; highlight current line
(add-hook 'after-change-major-mode-hook 'hl-line-mode)

;; show line numbers in programming modes
(add-hook 'prog-mode-hook 'linum-mode)
(setq linum-format "%4d ")

;; spellchecker in comments for programming modes
(add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode)))
(setq flyspell-issue-message-flag nil)

;; enable interactive do
(ido-mode t)

;; disable auto-save capabilities
(setq make-backup-files nil)
(setq auto-save-default nil)

;; disable line wrapping
(set-default 'truncate-lines t)

;; quick whitespace-mode shortcut
(global-set-key (kbd "C-x w") 'whitespace-mode)

;; set your desired tab width
(setq-default indent-tabs-mode nil)

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

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

;; highlight current line
(add-hook 'after-change-major-mode-hook 'hl-line-mode)

;; show line numbers in programming modes
(add-hook 'prog-mode-hook 'linum-mode)
(setq linum-format "%4d ")

;; spellchecker in comments for programming modes
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
(setq flyspell-issue-message-flag nil)

;; enable interactive do
(ido-mode t)

;; disable auto-save capabilities
(setq make-backup-files nil)
(setq auto-save-default nil)

;; disable line wrapping
(set-default 'truncate-lines t)

;; quick whitespace-mode shortcut
(global-set-key (kbd "C-x w") 'whitespace-mode)

;; enable follow-mode for multi-column editing in large screens
(add-hook 'prog-mode-hook 'follow-mode)

Enable follow-mode for programming modes, for multi-column editing.


(req-package linum
  :config
  (add-hook 'prog-mode-hook #'linum-mode)
  (setq linum-format "%3d\u2502"))

(req-package linum
  :config
  (add-hook 'prog-mode-hook #'linum-mode)
  (setq linum-format " %3d\u2502"))

Add more space for line number

Add more space for line number


(use-package helm
  :config
  (setq helm-split-window-default-side 'below)
  (helm-mode 1)
  :bind
  (("M-x" . helm-M-x)))

(use-package helm-ls-git
  :config
  (progn
    (use-package evil-leader
      :config
      (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
      (evil-leader/set-key
        "ff" 'helm-find-files
        "fr" 'helm-recentf
        "bb" 'helm-buffers-list
        "fp" 'helm-browse-project))))

(provide 'helm-settings)

(use-package helm
  :config
  (setq helm-split-window-default-side 'below)
  (helm-mode 1)
  :bind
  (("M-x" . helm-M-x)))

(use-package helm-ls-git
  :config
  (progn
    (use-package evil-leader
      :config
      (setq recentf-max-menu-items 1000)
      (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
      (evil-leader/set-key
        "ff" 'helm-find-files
        "fr" 'helm-recentf
        "bb" 'helm-buffers-list
        "fp" 'helm-browse-project))))

(provide 'helm-settings)

Set the number of recenf files list

Set the number of recenf files list


;;; go-keyify.el --- keyify integration for Emacs

;; Copyright 2016 Dominik Honnef. All rights reserved.
;; Use of this source code is governed by a BSD-style
;; license that can be found in the LICENSE file.

;; Author: Dominik Honnef
;; Version: 1.0.0
;; Keywords: languages go
;; URL: https://github.com/dominikh/go-keyify
;;
;; This file is not part of GNU Emacs.

;;; Code:

(require 'json)

;;;###autoload
(defun go-keyify ()
  "Turn an unkeyed struct literal into a keyed one.

Call with point on or in a struct literal."
  (interactive)
  (let ((res (json-read-from-string
              (shell-command-to-string (format "keyify -json %s:#%d"
                                               (shell-quote-argument (buffer-file-name))
                                               (position-bytes (point))))))
        (point (point)))
    (delete-region
     (1+ (cdr (assoc 'start res)))
     (1+ (cdr (assoc 'end res))))
    (insert (cdr (assoc 'replacement res)))
    (indent-region (1+ (cdr (assoc 'start res))) (point))
    (goto-char point)))

(provide 'go-keyify)

;;; go-keyify.el ends here

;;; go-keyify.el --- keyify integration for Emacs

;; Copyright 2016 Dominik Honnef. All rights reserved.
;; Use of this source code is governed by a BSD-style
;; license that can be found in the LICENSE file.

;; Author: Dominik Honnef
;; Version: 1.0.0
;; Keywords: languages go
;; URL: https://github.com/dominikh/go-keyify
;;
;; This file is not part of GNU Emacs.

;;; Code:

(require 'json)

;;;###autoload
(defun go-keyify ()
  "Turn an unkeyed struct literal into a keyed one.

Call with point on or in a struct literal."
  (interactive)
  (let ((res (json-read-from-string
              (shell-command-to-string (format "keyify -json %s:#%d"
                                               (shell-quote-argument (buffer-file-name))
                                               (1- (position-bytes (point)))))))
        (point (point)))
    (delete-region
     (1+ (cdr (assoc 'start res)))
     (1+ (cdr (assoc 'end res))))
    (insert (cdr (assoc 'replacement res)))
    (indent-region (1+ (cdr (assoc 'start res))) (point))
    (goto-char point)))

(provide 'go-keyify)

;;; go-keyify.el ends here

Fix off-by-one error in Emacs integration


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

(def-package! clojure-mode
  :mode "\\.clj$")

(def-package! cider
  :commands (cider-jack-in cider-mode)
  :config
  (setq nrepl-hide-special-buffers t))

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

(def-package! clojure-mode
  :mode (("\\.clj$" . clojure-mode)
         ("\\.cljs$". clojurescript-mode))
  :commands (clojure-mode clojurescript-mode) ;; this might not be necessary
  :config
  (map! :map clojure-mode-map
        (:localleader
          "'"      #'cider-jack-in
          "\""     #'cider-jack-in-clojurescript
          "r"      #'cider-eval-region)))

(def-package! cider
  :commands (cider-jack-in cider-mode cider-jack-in-clojurescript)
  :config
  (setq nrepl-hide-special-buffers t))

Add cljs mode and localleader keybindings


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

(if (featurep! +eglot)
    (progn
      (package! eglot :pin "ac9239bed5e3bfbf057382d1a75cdfa23f2caddd")
      (package! project
        :recipe (:host github :repo "emacs-straight/project")
        :pin "da0333a697b18f0a863c1b1523d2fc7991b31174"))
  (package! lsp-mode :pin "5f3f9848b2d4afc69049121c60126a6405447106")
  (package! lsp-ui :pin "d92cf83d95c9ca177b735500ead88cf68dc2e2db")
  (when (featurep! :completion ivy)
    (package! lsp-ivy :pin "dce58b5509271bbedb53ba9d0278dcb563a43977"))
  (when (featurep! :completion helm)
    (package! helm-lsp :pin "5018af9c709a783de1b9e101e07c948cceed67f1")))

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

(if (featurep! +eglot)
    (progn
      (package! eglot :pin "ac9239bed5e3bfbf057382d1a75cdfa23f2caddd")
      (package! project :pin "da0333a697b18f0a863c1b1523d2fc7991b31174"))
  (package! lsp-mode :pin "5f3f9848b2d4afc69049121c60126a6405447106")
  (package! lsp-ui :pin "d92cf83d95c9ca177b735500ead88cf68dc2e2db")
  (when (featurep! :completion ivy)
    (package! lsp-ivy :pin "dce58b5509271bbedb53ba9d0278dcb563a43977"))
  (when (featurep! :completion helm)
    (package! helm-lsp :pin "5018af9c709a783de1b9e101e07c948cceed67f1")))

Remove forced project.el recipe hack

Remove forced project.el recipe hack

Now that straight.el fixed the bug upstream there's no reason to force it anymore


;; OCaml
;; Use the opam installed utop
(setq utop-command "opam config exec -- utop -emacs")
(autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
(add-hook 'tuareg-mode-hook 'utop-minor-mode)
(add-hook 'tuareg-mode-hook
          (lambda()
            ;; Enable the representation of some keywords using fonts
            (when (functionp 'prettify-symbols-mode)
              (prettify-symbols-mode))))
(setq tuareg-match-clause-indent 0)
(add-hook 'tuareg-mode-hook 'paredit-nonlisp)
(with-eval-after-load 'tuareg
  (define-key tuareg-mode-map "{" 'paredit-open-curly)
  (define-key tuareg-mode-map "}" 'paredit-close-curly-and-newline)
  (define-key tuareg-mode-map (kbd "M-n") 'tuareg-next-phrase)
  (define-key tuareg-mode-map (kbd "M-p") 'tuareg-previous-phrase))

;; ocp-indent
(require 'ocp-indent)

;; Start merlin on ocaml files
(require 'merlin)
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)

(provide 'init-ocaml)

;; OCaml
;; Use the opam installed utop
(setq utop-command "opam config exec -- utop -emacs")
(autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
(add-hook 'tuareg-mode-hook 'utop-minor-mode)
(add-hook 'tuareg-mode-hook
          (lambda()
            ;; Enable the representation of some keywords using fonts
            (when (functionp 'prettify-symbols-mode)
              (prettify-symbols-mode))))
(setq tuareg-prettify-symbols-full t)
(setq tuareg-match-clause-indent 0)
(add-hook 'tuareg-mode-hook 'paredit-nonlisp)
(with-eval-after-load 'tuareg
  (define-key tuareg-mode-map "{" 'paredit-open-curly)
  (define-key tuareg-mode-map "}" 'paredit-close-curly-and-newline)
  (define-key tuareg-mode-map (kbd "M-n") 'tuareg-next-phrase)
  (define-key tuareg-mode-map (kbd "M-p") 'tuareg-previous-phrase))

;; ocp-indent
(require 'ocp-indent)

;; Start merlin on ocaml files
(require 'merlin)
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)

(provide 'init-ocaml)

Use full pretty symbol set in tuareg mode


(column-number-mode t)
(display-time-mode 1)
(electric-pair-mode t)
(auto-fill-mode -1)
(global-linum-mode 1)
(setq-default indent-tabs-mode nil)
(popwin-mode 1)
(delete-selection-mode 1)
(drag-stuff-global-mode 1)
(global-auto-complete-mode t)
(whole-line-or-region-mode t)

(column-number-mode t)
(display-time-mode 1)
(electric-pair-mode t)
(auto-fill-mode -1)
(global-linum-mode 1)
(setq-default indent-tabs-mode nil)
(popwin-mode 1)
(delete-selection-mode 1)
(drag-stuff-global-mode 1)
(global-auto-complete-mode t)
(whole-line-or-region-global-mode t)

Update whole line or region

Update whole line or region


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

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

(provide 'init-osx-keys)

Remove M-c and M-v bindings under OS X.

Remove M-c and M-v bindings under OS X.

M-v clashes with the default key for scrolling up.

It's arguably better to use the standard yank/kill bindings consistently
within Emacs.


(defun kotct/dot-config-directory ()
  "Returns the directory name for where our machine-local Dot configuration directory should be."
  (concat (file-name-directory (or (getenv "XDG_CONFIG_HOME") "~/.config")) "dot/"))

(defun kotct/dot-emacs-config-directory ()
  "Returns the directory name for where our machine-local Emacs subconfiguration directory should be."
  (let ((dot-config-dir (kotct/dot-config-directory))
        (emacs-subdir "emacs/"))
    (concat dot-config-dir emacs-subdir)))

(let (emacs-config-directory (kotct/dot-emacs-config-directory))
  (load (concat emacs-config-directory "init") 'noerror nil nil 'must-suffix))

(provide 'machine-local)

(defun kotct/dot-config-directory ()
  "Returns the directory name for where our machine-local Dot configuration directory should be."
  (concat (or (getenv "XDG_CONFIG_HOME") "~/.config/") "dot/"))

(defun kotct/dot-emacs-config-directory ()
  "Returns the directory name for where our machine-local Emacs subconfiguration directory should be."
  (let ((dot-config-dir (kotct/dot-config-directory))
        (emacs-subdir "emacs/"))
    (concat dot-config-dir emacs-subdir)))

(let ((emacs-config-directory (kotct/dot-emacs-config-directory)))
  (load (concat (file-name-directory emacs-config-directory) "init") 'noerror nil nil 'must-suffix))

(provide 'machine-local)

Refactor defuns to fix some problems

Refactor defuns to fix some problems


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

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

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

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

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

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

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

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

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

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

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

Remove the Ruby version from the modeline

The face settings rbenv uses to display the Ruby version in the modeline are
just too jarringly different from the rest of the modeline. It is also
unnecessary information, I _know_ which version I set in `.ruby-version`, there
is no use in constantly reminding me of it.


(use-package erc
  :init
  (setq erc-autojoin-channels-alist
        '(("freenode.net"
           ;; "##aws"
           ;; "##C"
           ;; "##C++-general"
           ;; "#clang"
           "#clnoobs"
           "#clojure"
           "#clojure-beginners"
           ;; "#clojure-emacs"
           ;; "#clojurescript"
           ;; "#cmake"
           ;; "#cplusplus.com"
           "#emacs"
           "#emacs-beginners"
           "#lisp"
           "#osv"
           ;; "#llvm"
           "#racket"
           "#scheme"
           ;; "#sword"
           "#ubuntu"))))
(provide 'erc-init)

(use-package erc
  :init
  (setq erc-autojoin-channels-alist
        '(("freenode.net"
           ;; "##aws"
           ;; "##C"
           ;; "##C++-general"
           ;; "#clang"
           "#clnoobs"
           "#clojure"
           "#clojure-beginners"
           ;; "#clojure-emacs"
           ;; "#clojurescript"
           ;; "#cmake"
           ;; "#cplusplus.com"
           "#emacs"
           "#emacs-beginners"
           ;; "#lisp"
           ;; "#osv"
           ;; "#llvm"
           "#racket"
           ;; "#scheme"
           "#sword"
           ;; "#ubuntu"
           ))))
(provide 'erc-init)

Reduce the auto-connect channels for ERC startup


(require 'company)
(require 'racer)
(require 'rust-mode)
(require 'eldoc)
(require 'flycheck)
(require 'flycheck-rust)

(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
(add-hook 'rust-mode-hook  #'company-mode)
(add-hook 'rust-mode-hook  #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
(setq company-tooltip-align-annotations t)

(provide 'init-rust)

(require 'cargo)
(require 'company)
(require 'racer)
(require 'rust-mode)
(require 'eldoc)
(require 'flycheck)
(require 'flycheck-rust)

(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
(add-hook 'rust-mode-hook  #'company-mode)
(add-hook 'rust-mode-hook  #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'rust-mode-hook 'cargo-minor-mode)
(with-eval-after-load 'rust-mode
  (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
(setq company-tooltip-align-annotations t)

(provide 'init-rust)

Add cargo mode for rust

Add cargo mode for rust


;;; my-ansible.el --- Ansible mode settings -*- lexical-binding: t -*-

;; Copyright (C) 2016  Sergey Timanin

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

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

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

;;; Commentary:

;;; Code:

(require 'my-completion)

(use-package ansible
  :init
  ;; Auto-enable for yaml files
  (add-hook 'yaml-mode-hook '(lambda () (ansible 1)))
  ;; Enable company backend for completion
  (add-to-list 'company-backends 'company-ansible))

(provide 'my-ansible)

;;; my-ansible.el ends here

;;; my-ansible.el --- Ansible mode settings -*- lexical-binding: t -*-

;; Copyright (C) 2016  Sergey Timanin

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

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

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

;;; Commentary:

;;; Code:

(require 'my-completion)

(use-package ansible
  :init
  ;; Auto-enable for yaml files
  (add-hook 'yaml-mode-hook '(lambda () (ansible 1)))
  :config
  ;; Enable company backend for completion
  (add-hook 'ansible-hook 'company-mode)
  (add-to-list 'company-backends 'company-ansible))

(provide 'my-ansible)

;;; my-ansible.el ends here

Add completion hook for ansible mode.

Add completion hook for ansible mode.


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

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

Change font size depending in the platform


;; hide menu bar
(menu-bar-mode 0)

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

;; spaces
(require 'whitespace)
(global-whitespace-mode)
(setq whitespace-style '(face trailing tabs lines-tail))
(setq whitespace-line-column 80)
(set-face-background 'whitespace-trailing "red")
(set-face-background 'whitespace-tab "color-236")
(set-face-foreground 'whitespace-line nil)
(set-face-background 'whitespace-line "color-238")

;; (line, column)
(setq line-number-mode t)
(setq column-number-mode t)

;; fill column length
(setq-default fill-column 80)

(provide 'custom-ui)

;; hide menu bar
(menu-bar-mode 0)

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

;; spaces
(require 'whitespace)
(global-whitespace-mode)
(setq whitespace-style '(face trailing tabs lines-tail))
(setq whitespace-line-column 80)
(set-face-background 'whitespace-trailing "red")
(set-face-background 'whitespace-tab "gray20")
(set-face-foreground 'whitespace-line nil)
(set-face-background 'whitespace-line "gray20")

;; (line, column)
(setq line-number-mode t)
(setq column-number-mode t)

;; fill column length
(setq-default fill-column 80)

(provide 'custom-ui)

Change background for tab and column>80

Change background for tab and column>80

Colors are changed because of True Color support.


(defconst mfa-dired-packages '(all-the-icons all-the-icons-dired dired-narrow dired))

(defun mfa-dired/init-all-the-icons ()
  (use-package all-the-icons
    :defer t))

(defun mfa-dired/init-all-the-icons-dired ()
  (use-package all-the-icons-dired
    :defer t
    :diminish
    :init
    (with-eval-after-load 'dired
      (add-hook 'dired-mode-hook #'all-the-icons-dired-mode))))

(defun mfa-dired/init-dired-narrow ()
  (use-package dired-narrow
    :defer t
    :init
    (spacemacs/set-leader-keys-for-major-mode 'dired-mode "/" #'dired-narrow)))

(defun mfa-dired/post-init-dired ()
  (spacemacs|use-package-add-hook dired
    :post-config
    (progn
      (add-hook 'dired-mode-hook #'dired-dwim-target-mode)
      (spacemacs/set-leader-keys-for-major-mode 'dired-mode
        "ot" #'dired-dwim-target-mode)
      (evil-define-key 'evilified dired-mode-map
        (kbd "RET") #'dired-find-file-by-prefix)
      (evil-define-key 'evilified dired-mode-map
        "-" #'dired-up-directory))))

(defconst mfa-dired-packages '(all-the-icons all-the-icons-dired dired-narrow dired))

(defun mfa-dired/init-all-the-icons ()
  (use-package all-the-icons
    :defer t
    :init
    (setq inhibit-compacting-font-caches t)))

(defun mfa-dired/init-all-the-icons-dired ()
  (use-package all-the-icons-dired
    :defer t
    :diminish
    :init
    (with-eval-after-load 'dired
      (add-hook 'dired-mode-hook #'all-the-icons-dired-mode))))

(defun mfa-dired/init-dired-narrow ()
  (use-package dired-narrow
    :defer t
    :init
    (spacemacs/set-leader-keys-for-major-mode 'dired-mode "/" #'dired-narrow)))

(defun mfa-dired/post-init-dired ()
  (spacemacs|use-package-add-hook dired
    :post-config
    (progn
      (add-hook 'dired-mode-hook #'dired-dwim-target-mode)
      (spacemacs/set-leader-keys-for-major-mode 'dired-mode
        "ot" #'dired-dwim-target-mode)
      (evil-define-key 'evilified dired-mode-map
        (kbd "RET") #'dired-find-file-by-prefix)
      (evil-define-key 'evilified dired-mode-map
        "-" #'dired-up-directory))))

Apply performance tuning suggested by the all-the-icons README


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

((sh-mode
  (sh-basic-offset . 4)))

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

((sh-mode
  ((sh-basic-offset . 4))))

Fix incorrect type in dir locals file

Fix incorrect type in dir locals file

The argument should be a list.

Signed-off-by: Nicolas Bock <f98f0827b96d4d55ae7f19f2b371a91ca0f3d663@gmail.com>


(require 'flycheck-color-mode-line)

(eval-after-load "flycheck"
  '(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))

(require 'flycheck-color-mode-line)

(setq flycheck-check-syntax-automatically '(save mode-enabled))

(eval-after-load "flycheck"
  '(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))

Remove flyckeck check on idle.

Remove flyckeck check on idle.


(require 'init-clojure)
(require-package 'emacs '(24))

(require-package 'cider)
(require-package 'ac-cider)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; nrepl with Clojure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq nrepl-popup-stacktraces nil)

(after-load 'cider
  (add-hook 'cider-repl-mode-hook 'ac-cider-setup)
  (add-hook 'cider-mode-hook 'ac-cider-setup)
  (after-load 'auto-complete
    (add-to-list 'ac-modes 'cider-repl-mode))

  (add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function)
  (add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)
  (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
  (add-hook 'cider-repl-mode-hook 'subword-mode)
  (add-hook 'cider-repl-mode-hook 'paredit-mode)
  (define-key cider-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc)

  ;; nrepl isn't based on comint
  (add-hook 'cider-repl-mode-hook
            (lambda () (setq show-trailing-whitespace nil))))

(provide 'init-clojure-cider)

(require 'init-clojure)
(require-package 'emacs '(24))

(require-package 'cider)
(require-package 'ac-cider)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; nrepl with Clojure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq nrepl-popup-stacktraces nil)

(after-load 'cider
  (add-hook 'cider-repl-mode-hook 'ac-cider-setup)
  (add-hook 'cider-mode-hook 'ac-cider-setup)
  (after-load 'auto-complete
    (add-to-list 'ac-modes 'cider-repl-mode))

  (add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function)
  (add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)
  (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
  (add-hook 'cider-repl-mode-hook 'subword-mode)
  (add-hook 'cider-repl-mode-hook 'paredit-mode)
  (define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-popup-doc)

  ;; nrepl isn't based on comint
  (add-hook 'cider-repl-mode-hook
            (lambda () (setq show-trailing-whitespace nil))))

(provide 'init-clojure-cider)

Fix trailing reference to ac-nrepl

Fix trailing reference to ac-nrepl


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

((nil . ((bug-reference-url-format . "https://bugs.gnu.org/%s")
         (indent-tabs-mode . nil)
         (fill-column . 80)))
 (c++-mode . ((page-delimiter . "^///")
              (mode . subword)))
 (c-mode . ((page-delimiter . "^///")
            (mode . subword)))
 ("elisp/proto/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../" "../../bazel-bin/" "../../bazel-bin/external/com_google_protobuf/")))))
 ("elisp/runfiles/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../")))))
 ("examples/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../" "./" "ext/" "../bazel-bin/" "../bazel-bin/external/com_google_protobuf/")))))
 ("tests/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../")))))
 ("tests/pkg/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../"))))))

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

((nil . ((compile-command . "./build.py")
         (bug-reference-url-format . "https://bugs.gnu.org/%s")
         (indent-tabs-mode . nil)
         (fill-column . 80)))
 (c++-mode . ((page-delimiter . "^///")
              (mode . subword)))
 (c-mode . ((page-delimiter . "^///")
            (mode . subword)))
 ("elisp/proto/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../" "../../bazel-bin/" "../../bazel-bin/external/com_google_protobuf/")))))
 ("elisp/runfiles/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../")))))
 ("examples/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../" "./" "ext/" "../bazel-bin/" "../bazel-bin/external/com_google_protobuf/")))))
 ("tests/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../")))))
 ("tests/pkg/" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "../../"))))))

Add a default value for ‘compile-command’


;;; projector.el -- Functions for projecting.
(eval-when-compile
  (require 'highline))

(defvar pjones:projector-font-big
  "-unknown-DejaVu Sans Mono-normal-normal-normal-*-22-*-*-*-m-0-iso10646-1"
  "A large font to use for projectors.")

(defun pjones:projector-font ()
  "Switch the current frame to a big font."
  (interactive)
  (set-frame-font pjones:projector-font-big))

(defun pjones:projector-highline ()
  "Toggle highline mode from outside Emacs."
  (with-current-buffer (window-buffer (selected-window))
    (call-interactively 'highline-mode)))

(defun pjones:projector-next-line ()
  "Move to the next line from outside Emacs."
  (with-current-buffer (window-buffer (selected-window))
    (call-interactively 'next-line)
    (if highline-mode (highline-highlight-current-line))))

(defun pjones:projector-prev-line ()
  "Move to the previous line from outside Emacs."
  (with-current-buffer (window-buffer (selected-window))
    (call-interactively 'previous-line)
    (if highline-mode (highline-highlight-current-line))))

(defun pjones:projector-recenter ()
  "Places the current line at the top of the window from outside
Emacs."
  (with-current-buffer (window-buffer (selected-window))
    (recenter 0)
    (if highline-mode (highline-highlight-current-line))))

Add the ability to recenter the display from a remote


;; * Flycheck

(my/ensure-package-installed 'flycheck)

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

(setq flycheck-indication-mode nil)
(setq flycheck-display-errors-delay 100) ; workaround to disable it

(let ((map my/global-map))
  (define-key map [f10] 'flycheck-mode))

;; * Flycheck

(my/ensure-package-installed 'flycheck)

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

(setq-default flycheck-emacs-lisp-load-path 'inherit)
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))

(setq flycheck-indication-mode nil)
(setq flycheck-display-errors-delay 100) ; workaround to disable it

(let ((map my/global-map))
  (define-key map [f10] 'flycheck-mode))

Reduce error check in emacs-lisp

[Emacs] Reduce error check in emacs-lisp


;; 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
(tool-bar-mode -1)
(tooltip-mode -1)
(scroll-bar-mode -1)
(set-fringe-style -1)

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

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

;; my custom theme of choice
(load-theme 'tomorrow-night t)

;; available custom themes
;;
;; solarized:
;; (load-theme 'solarized t)
;; (load-theme 'solarized-dark t)
;;
;; tomorrow:
;; (load-theme 'tomorrow t)
;; (load-theme 'tomorrow-night t)
;; (load-theme 'tomorrow-night-bright t)
;; (load-theme 'tomorrow-night-blue t)
;; (load-theme 'tomorrow-night-eighties t)
;;
;; zenburn:
;; (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
(tool-bar-mode -1)
(tooltip-mode -1)
(scroll-bar-mode -1)
(set-fringe-style -1)

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

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

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

;; my custom theme of choice
(load-theme 'tomorrow-night t)

;; available custom themes
;;
;; solarized:
;; (load-theme 'solarized t)
;; (load-theme 'solarized-dark t)
;;
;; tomorrow:
;; (load-theme 'tomorrow t)
;; (load-theme 'tomorrow-night t)
;; (load-theme 'tomorrow-night-bright t)
;; (load-theme 'tomorrow-night-blue t)
;; (load-theme 'tomorrow-night-eighties t)
;;
;; zenburn:
;; (load-theme 'zenburn t)

Set Monaco as the font in OS X.

Set Monaco as the font in OS X.


(defvar current-theme
  nil
  "The currently enabled theme.")

(defun switch-to-theme (theme)
  "Enable the theme THEME. Disable the current theme."
  (if current-theme (disable-theme current-theme))
  (if (member theme custom-known-themes)
      (enable-theme theme)
    (load-theme theme 'no-confirm))
  (setf current-theme theme))

(switch-to-theme 'solarized-dark)

(provide 'theme)

(defvar current-theme
  nil
  "The currently enabled theme.")

(defun switch-to-theme (theme)
  "Enable the theme THEME. Disable the current theme."
  (if current-theme (disable-theme current-theme))
  (if (member theme custom-known-themes)
      (enable-theme theme)
    (load-theme theme 'no-confirm))
  (setf current-theme theme)
  (cond ((or (string= current-theme 'solarized-dark)
	     (string= current-theme 'solarized-light))
	 (progn
	   (setf x-underline-at-descent-line t)))
	(t nil)))

(switch-to-theme 'solarized-dark)

(provide 'theme)

Make x-underline at descender line, not base line


;; Time-stamp: <2016-05-19 22:24:54 kmodi>

;; Git Link
;; https://github.com/sshaw/git-link

(use-package git-link
  :load-path "elisp/git-link"
  :bind (:map region-bindings-mode-map
         ("g" . modi/git-link-force-hash))
  :init
  (progn
    (bind-to-modi-map "g" #'git-link-commit))
  :config
  (progn
    (setq git-link-commit-fallback-use-latest-commit t)

    (defun modi/git-link-force-hash ()
      "This function is the same as `git-link' except that it copies the link
with the commit hash in the link even if branch name is available."
      (interactive)
      (let ((git-link-use-commit t))
        (call-interactively #'git-link)))))

(provide 'setup-git-link)

;; Time-stamp: <2016-07-14 15:37:44 kmodi>

;; Git Link
;; https://github.com/sshaw/git-link

(use-package git-link
  :load-path "elisp/git-link"
  :bind (:map region-bindings-mode-map
         ("g" . modi/git-link))
  :init
  (progn
    (bind-to-modi-map "g" #'modi/git-link)
    (bind-to-modi-map "G" #'git-link-commit))
  :config
  (progn
    (setq git-link-commit-fallback-use-latest-commit t)

    (defun modi/git-link (use-branch-maybe)
      "Get git link with the exact commit hash, not the branch name.
If USE-BRANCH-MAYBE is non-nil, use branch name in the link if available."
      (interactive "P")
      (let ((git-link-use-commit (if use-branch-maybe
                                     nil
                                   t))
            ;; Reset the current-prefix-arg, do not pass that to `git-link'.
            current-prefix-arg)
        (call-interactively #'git-link)))))

(provide 'setup-git-link)

Update git-link bindings, improve modi/git-link


;;; word-count.el --- word-count Exercise (exercism)

;;; Commentary:

;;; Code:

(defun word-count (sentence)
  (let ((count nil))
    (dolist (i (split-string (downcase sentence) "[^a-z0-9]" t))
      (let ((n (assoc i count)))
        (if n (setcdr n (1+ (cdr n)))
          (push (cons i 1) count))))
    count))

(provide 'word-count)
;;; word-count.el ends here

;;; word-count.el --- word-count Exercise (exercism)

;;; Commentary:

;;; Code:

(defun word-count (sentence)
  (let ((count nil))
    (dolist (word (split-string (downcase sentence) "[^a-z0-9]" t))
      (let ((entry (assoc word count)))
        (if entry
            (setcdr entry (1+ (cdr entry)))
          (push (cons word 1) count))))
    count))

(provide 'word-count)
;;; word-count.el ends here

Use more descriptive symbol names than `i' and `n'


; Evil Leader

(require 'evil-leader)
(require 'evil-nerd-commenter)

(global-evil-leader-mode)

(evil-leader/set-leader ",")
(evil-leader/set-key
    "b" 'ibuffer
    "q" 'delete-window
    "tt" 'save-buffer
    "k" 'kill-buffer-and-window)

(evil-leader/set-key
    "full" 'toggle-frame-fullscreen)

; Nerd-Commenter
(evil-leader/set-key
    "comm" 'evilnc-comment-or-uncomment-lines)

(provide 'init-evil-leader)

; Evil Leader

(require 'evil-leader)
(require 'evil-nerd-commenter)

(global-evil-leader-mode)

(evil-leader/set-leader ",")
(evil-leader/set-key
    "b" 'ibuffer
    "q" 'delete-window
    "tt" 'save-buffer
    "k" 'kill-buffer-and-window
    "m" 'right-char
    "," 'insert-comma)

(evil-leader/set-key
    "full" 'toggle-frame-fullscreen)

; Nerd-Commenter
(evil-leader/set-key
    "comm" 'evilnc-comment-or-uncomment-lines)

; Mail
(evil-leader/set-key
    "email" 'mu4e
    "fetch" 'mu4e-get-mail-command)

; Allows me to actually type a comma...TODO ability to do this in insert mode.
(defun insert-comma ()
    (interactive)
    (insert ","))

(provide 'init-evil-leader)

Add ability to type , in emacs

Add ability to type , in emacs

Former-commit-id: bb8bf863cee948e01a303e60acbbda650e052890


;; This file configures org modes publish functionality to generate the gh-pages site for this project.
;; Load this file/buffer and then execute: M-x org-publish-project RET gh-pages RET

(setq org-publish-project-alist
      '(("gh-notes"
	  :base-directory "./org/"
	  :base-extension "org"
	  :publishing-directory "./gh-pages"
	  :recursive t
	  :publishing-function org-html-publish-to-html
	  :headline-levels 4
	  :auto-preamble t)
	("gh-assets"
	 :base-directory "./org/"
	 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
	 :publishing-directory "./gh-pages"
	 :recursive t
	 :publishing-function org-publish-attachment)
	("gh-pages" :components ("gh-notes" "gh-assets"))))

;; This file configures org modes publish functionality to generate the gh-pages site for this project.
;; Load this file/buffer and then execute: M-x org-publish-project RET gh-pages RET

(setq org-publish-project-alist
      '(("gh-notes"
	  :base-directory "./org/"
	  :base-extension "org"
	  :exclude "setup.org"
	  :publishing-directory "./gh-pages"
	  :recursive t
	  :publishing-function org-html-publish-to-html
	  :headline-levels 4
	  :auto-preamble t)
	("gh-assets"
	 :base-directory "./org/"
	 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
	 :publishing-directory "./gh-pages"
	 :recursive t
	 :publishing-function org-publish-attachment)
	("gh-pages" :components ("gh-notes" "gh-assets"))))

Exclude org setup file from published docs


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

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

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

(provide 'init-darcs)

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

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

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

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

(provide 'init-darcs)

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


(require 'flycheck)

(dolist (mode '(c
                elixir
                json
                python
                ruby))
(add-hook (intern (concat (symbol-name mode) "-mode-hook"))
		  'flycheck-mode))

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

Remove flycheck integration with next-error

Prefere to call flycheck-next-error explicitly.


(use-package scss-mode
  :mode "\\.scss$"
  :config
  (progn
    (add-hook 'scss-mode-hook 'enable-tab-width-2)

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

    (after "web-beautify"
      (add-hook! 'scss-mode-hook (setenv "jsbeautify_indent_size" "2"))
      (bind 'motion scss-mode-map "gQ" 'web-beautify-css))

    (after "auto-complete" (add-hook 'scss-mode-hook 'ac-css-mode-setup))
    (after "company" (company--backend-on 'scss-mode-hook 'company-css))))

(use-package rainbow-mode
  :defer t
  :init (add-hook 'scss-mode-hook 'rainbow-mode))

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

(use-package scss-mode
  :mode "\\.scss$"
  :config
  (progn
    ;; Syntax coloring breaks on consecutive loads for some reason. This fixes that:
    (add-hook 'scss-mode-hook 'css-mode)

    (add-hook 'scss-mode-hook 'enable-tab-width-2)

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

    (after "web-beautify"
      (add-hook! 'scss-mode-hook (setenv "jsbeautify_indent_size" "2"))
      (bind 'motion scss-mode-map "gQ" 'web-beautify-css))

    (after "auto-complete" (add-hook 'scss-mode-hook 'ac-css-mode-setup))
    (after "company" (company--backend-on 'scss-mode-hook 'company-css))))

(use-package rainbow-mode
  :defer t
  :init (add-hook 'scss-mode-hook 'rainbow-mode))

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

Fix syntax color loss in scss-mode

Fix syntax color loss in scss-mode


(defvar after-make-console-frame-hooks '()
  "Hooks to run after creating a new TTY frame")
(defvar after-make-window-system-frame-hooks '()
  "Hooks to run after creating a new window-system frame")

(defun run-after-make-frame-hooks (frame)
  "Run configured hooks in response to the newly-created FRAME.
Selectively runs either `after-make-console-frame-hooks' or
`after-make-window-system-frame-hooks'"
  (with-selected-frame frame
    (run-hooks (if window-system
                   'after-make-window-system-frame-hooks
                 'after-make-console-frame-hooks))))

(add-hook 'after-make-frame-functions 'run-after-make-frame-hooks)

(defconst sanityinc/initial-frame (selected-frame)
  "The frame (if any) active during Emacs initialization.")

(add-hook 'after-init-hook
          (lambda () (when sanityinc/initial-frame
                  (run-after-make-frame-hooks sanityinc/initial-frame))))

(provide 'init-frame-hooks)

(defvar after-make-console-frame-hooks '()
  "Hooks to run after creating a new TTY frame")
; <shafi> temporary hack: open org-todo-list upon startup
(defvar after-make-window-system-frame-hooks '(org-todo-list)
  "Hooks to run after creating a new window-system frame")

(defun run-after-make-frame-hooks (frame)
  "Run configured hooks in response to the newly-created FRAME.
Selectively runs either `after-make-console-frame-hooks' or
`after-make-window-system-frame-hooks'"
  (with-selected-frame frame
    (run-hooks (if window-system
                   'after-make-window-system-frame-hooks
                 'after-make-console-frame-hooks))))

(add-hook 'after-make-frame-functions 'run-after-make-frame-hooks)

(defconst sanityinc/initial-frame (selected-frame)
  "The frame (if any) active during Emacs initialization.")

(add-hook 'after-init-hook
          (lambda () (when sanityinc/initial-frame
                  (run-after-make-frame-hooks sanityinc/initial-frame))))

(provide 'init-frame-hooks)

Add temporary hack to open org-todo-list on startup


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

(setq dired-listing-switches "-lRA --ignore='.git' --group-directories-first"
      dired-auto-revert-buffer t
      dired-isearch-filenames t)

(defun pjones:dired-show-only-matching-files (regexp)
  (interactive "sFiles to show (regexp): ")
  (dired-mark-files-regexp regexp)
  (dired-toggle-marks)
  (dired-do-kill-lines))

(defun pjones:dired-load-hook ()
  (define-key dired-mode-map [?%?h] 'pjones:dired-show-only-matching-files))

(add-hook 'dired-load-hook 'pjones:dired-load-hook)
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)

Add a new dired function to only show files that match a regexp