(global-company-mode)

(defun my/custom-backends ()
  (setq company-backends (delete 'company-capf company-backend))
  (add-to-list 'company-backends 'company-c-headers))

(setq-default company-backends
	      '((company-bbdb
		 company-nxml
		 company-css
		 company-eclim
		 company-semantic
		 company-c-headers
		 company-yasnippet
		 company-xcode
		 company-cmake
		 company-dabbrev-code
		 company-gtags
		 company-etags
		 company-keywords
		 company-oddmuse
		 company-files
		 company-semantic
		 company-capf)))

;(add-hook 'c-mode-hook 'my/custom-backends)
;(add-hook 'c++-mode-hook 'my/custom-backends)

(eval-after-load 'company
  '(progn
     (define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
     (define-key company-active-map [tab] 'company-complete-common-or-cycle)))
;; (setq company-selection t) <-- this doesn't make sense -- Dmitry
(setq company-idle-delay 0)

(provide 'setup-company)

(global-company-mode)

(defun my/custom-backends ()
  (setq company-backends (delete 'company-capf company-backend))
  (add-to-list 'company-backends 'company-c-headers))

(setq-default company-backends
	      '((company-bbdb
		 company-nxml
		 company-css
		 company-eclim
		 company-semantic
		 company-c-headers
		 company-yasnippet
		 company-xcode
		 company-cmake
		 company-dabbrev-code
		 company-gtags
		 company-etags
		 company-keywords
		 company-oddmuse
		 company-files
		 company-capf)))

;(add-hook 'c-mode-hook 'my/custom-backends)
;(add-hook 'c++-mode-hook 'my/custom-backends)

(eval-after-load 'company
  '(progn
     (define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
     (define-key company-active-map [tab] 'company-complete-common-or-cycle)))
;; (setq company-selection t) <-- this doesn't make sense -- Dmitry
(setq company-idle-delay 0)

(provide 'setup-company)

Remove duplicate semantic backend. Woops!


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

(setq indent-tabs-mode nil)

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

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

(setq indent-tabs-mode nil)

(if window-system
    (progn
        ; make forward-delete work
        (global-set-key [kp-delete] 'delete-char)
        (global-set-key [M-kp-delete] 'kill-word)
        ; make command the META key, and option access accents properly
        (setq ns-alternate-modifier (quote none))
        (setq ns-command-modifier (quote meta))
        (menu-bar-mode 1)
        (tool-bar-mode 0))
   (menu-bar-mode 0))

Save font settings here as well as in custom


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

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

(provide 'init-locales)

(require 'cl-lib)

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

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

(provide 'init-locales)

Replace an flet with cl-flet

Replace an flet with cl-flet


(use-package projectile
  :ensure t
  :defer t
  :bind (("C-c p" . projectile-command-map))
  :init
  (setq projectile-indexing-method 'native)
  (setq projectile-enable-caching t)
  (setq projectile-project-search-path '("~/workspace/"))
  (projectile-mode 1))

(use-package projectile
  :ensure t
  :defer t
  :bind (("C-c p" . projectile-command-map))
  :init
  (setq projectile-indexing-method 'alien)
  (setq projectile-enable-caching t)
  (setq projectile-project-search-path '("~/workspace/"))
  (setq projectile-completion-system 'helm)
  (projectile-mode 1))

Emacs: Set a better cache and enable Helm integration


;;; init-terraform.el --- Work with Terraform configurations -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

;;; Terraform

(when (maybe-require-package 'terraform-mode)
  (when (maybe-require-package 'company-terraform)
    (after-load 'terraform-mode
      (company-terraform-init))))

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

;;; init-terraform.el --- Work with Terraform configurations -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

;;; Terraform

(when (maybe-require-package 'terraform-mode)
  (when (maybe-require-package 'company-terraform)
    (after-load 'terraform-mode
      (company-terraform-init)

      ;; I find formatters based on "reformatter" to be more reliable
      ;; so I redefine `terraform-format-on-save-mode' here.
      (when (maybe-require-package 'reformatter)
        (reformatter-define terraform-format
          :program "terraform" :args '("fmt" "-"))))))

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

Use reformatter to redefine terraform-format-on-save-mode


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

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

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

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

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

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

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

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

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

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

;; store all backup and autosave files outside the working directory,
;; in the temporary-file-directory
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))

Make Emacs save temp files outside the working dir


;; Hy mode
;;
;; You can get an hy repl by typing in M-x inferior-lisp while in a hy
;; buffer. Needs some work to send buffer to the repl, and only open a
;; new repl if one does not already exist for the active hy buffer.
(use-package hy-mode
  :ensure t
  :mode ("\\.hy\\'" . hy-mode)
  :config
  (require 'programming-init)
  (setq hy-mode-inferior-lisp-command "hy")
  :init
  ;; Add smartparens-strict-mode
  (dolist (func '(my-programming-hooks
                  smartparens-strict-mode
                  rainbow-delimiters-mode))
    (add-hook 'hy-mode-hook func))
  (use-package aggressive-indent
    :ensure t
    :init
    (add-hook 'hy-mode-hook 'aggressive-indent-mode)
    (add-hook 'inferior-lisp-mode-hook 'aggressive-indent-mode))
  (define-key hy-mode-map "\C-x\C-e" 'hy-shell-eval-last-sexp)
  (define-key hy-mode-map "\C-c\C-c" 'hy-shell-eval-buffer))
(provide 'hy-init)

;; Hy mode
;;
;; You can get an hy repl by typing in M-x inferior-lisp while in a hy
;; buffer. Needs some work to send buffer to the repl, and only open a
;; new repl if one does not already exist for the active hy buffer.
(use-package hy-mode
  :ensure t
  :mode ("\\.hy\\'" . hy-mode)
  :config
  (require 'programming-init)
  (setq hy-mode-inferior-lisp-command "hy")
  ;; Add smartparens-strict-mode
  (dolist (func '(my-programming-hooks
                  smartparens-strict-mode
                  rainbow-delimiters-mode))
    (add-hook 'hy-mode-hook func))
  (use-package aggressive-indent
    :ensure t
    :init
    (add-hook 'hy-mode-hook 'aggressive-indent-mode)
    (add-hook 'inferior-lisp-mode-hook 'aggressive-indent-mode))
  (define-key hy-mode-map "\C-x\C-e" 'hy-shell-eval-last-sexp)
  (define-key hy-mode-map "\C-c\C-c" 'hy-shell-eval-buffer))
(provide 'hy-init)

Correct the load ordering for hy-mode (for hy-mode-map).


;; Time-stamp: <2017-05-01 17:28:23 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")))

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

(provide 'setup-nim)

;; Time-stamp: <2017-07-06 18:46:00 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")))

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

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

(provide 'setup-nim)

Add ob-nim; Org Babel for Nim

Add ob-nim; Org Babel for Nim


;;; config-magit --- What it says on the tin.

;;; Commentary:
;; None at this time.

;;; Code:
;; Shut magit up.
(setq magit-last-seen-setup-instructions "1.4.0")

;; Make magit start full-frame, but otherwise behave the same.
(setq magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1)

;; Bind C-k to set-mark-command. In magit, I can't seem to reliably stage blocks
;; by going into visual mode, C-SPC is launchers, and C-@ is crazy awkward. So,
;; I need another binding. C-k is a pneumonic for marK.
(global-set-key (kbd "C-k") 'set-mark-command)

(provide 'config-magit)
;;; config-magit.el ends here

;;; config-magit --- What it says on the tin.

;;; Commentary:
;; None at this time.

;;; Code:
;; Shut magit up.
(setq magit-last-seen-setup-instructions "1.4.0")

;; Make magit start full-frame, but otherwise behave the same.
(setq magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1)

;; Warn
(setq git-commit-summary-max-length 50)

;; Bind C-k to set-mark-command. In magit, I can't seem to reliably stage blocks
;; by going into visual mode, C-SPC is launchers, and C-@ is crazy awkward. So,
;; I need another binding. C-k is a pneumonic for marK.
(global-set-key (kbd "C-k") 'set-mark-command)

(provide 'config-magit)
;;; config-magit.el ends here

Use 50 column git summaries

Use 50 column git summaries


;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here!
;; Remember, you do NOT need to run 'doom sync' after modifying this file!

(setq user-full-name "abtv"
      user-mail-address "")

(setq doom-theme 'adwaita)
(with-eval-after-load "adwaita-theme"
  (custom-theme-set-faces
   'adwaita
   '(default ((t (:background "#CCCCCC"))))))

(setq org-directory "~/org/")
(with-eval-after-load 'org
 (setq
   org-agenda-span 7
   org-agenda-start-on-weekday 1))

(setq display-line-numbers-type nil)

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here!
;; Remember, you do NOT need to run 'doom sync' after modifying this file!

(setq user-full-name "abtv"
      user-mail-address "")

(setq doom-theme 'adwaita)
(with-eval-after-load "adwaita-theme"
  (custom-theme-set-faces
   'adwaita
   '(default ((t (:background "#CCCCCC"))))))

(setq org-directory "~/org/")
(with-eval-after-load 'org
 (setq
   org-agenda-span 7
   org-agenda-start-on-weekday 1))

(map! :leader
      :desc "Kill this buffer" "d" #'kill-this-buffer)

(setq display-line-numbers-type nil)

Kill current buffer with SPC d in Emacs

Kill current buffer with SPC d in Emacs


;; text-editing.el
;;
;; Misc. settings for formatting text

(setq-default tab-always-indent nil             ; tab actually works like a tab key
              require-final-newline 't          ; unix-friendly trailing newline
              tab-width 4                       ; tabs are four spaces
              indent-tabs-mode nil              ; tab works like a tab key
              sentence-end-double-space nil     ; sentences end with one space
              fill-column 78)                   ; good width for default

(add-hook 'before-save-hook 'whitespace-cleanup)    ; no messy space
(add-hook 'text-mode-hook 'turn-on-auto-fill)       ; wrap text

;; Emacs's open-line functionality is dumb
(defvar newline-and-indent t
  "Modify the behavior of the open-*-line functions to cause them to autoindent.")

(defun open-next-line (arg)
  "Move to the next line and then opens a line. See also
    `newline-and-indent'."
  (interactive "p")
  (end-of-line)
  (open-line arg)
  (next-line 1)
  (when newline-and-indent
    (indent-according-to-mode)))

(defun open-previous-line (arg)
  "Open a new line before the current one.
     See also `newline-and-indent'."
  (interactive "p")
  (beginning-of-line)
  (open-line arg)
  (when newline-and-indent
    (indent-according-to-mode)))

(global-set-key (kbd "C-o") 'open-next-line)
(global-set-key (kbd "M-o") 'open-previous-line)

Add open lines functionality from vim.

Add open lines functionality from vim.


;; Time-stamp: <2015-02-23 11:42:32 kmodi>

;; Rainbow Delimiters
;; http://www.emacswiki.org/emacs/RainbowDelimiters

(use-package rainbow-delimiters
  :config
  (progn
    ;; Enable in all programming-related modes
    (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)))

(provide 'setup-rainbow-delimiters)

;; Time-stamp: <2015-02-23 11:42:32 kmodi>

;; Rainbow Delimiters
;; http://www.emacswiki.org/emacs/RainbowDelimiters

(use-package rainbow-delimiters
  :config
  (progn
    ;; Enable in all programming-related modes
    (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)))

(provide 'setup-rainbow-delimiters)

Improve add-hook for function rainbow-delimiters-mode.


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

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

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

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

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

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

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

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

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

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

Remove redundant coding system configuration


(use-package org
  :config
  ;; When clocking in, just use the time from the last clocked out
  ;; item.
  (setq org-clock-continuously t)

  ;; Show drawers, e.g. :PROPERTIES:, when we expand a heading.
  ;; See http://emacs.stackexchange.com/a/22540/304
  (remove-hook 'org-cycle-hook #'org-cycle-hide-drawers)

  ;; When creating or completing a TODO, record the timestamps.
  (setq org-log-done 'time)

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

  ;; Show *foo* and /foo/ without org markers, just the formatting.
  (setq org-hide-emphasis-markers t)

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

  ;; Don't underline dates, it's distracting.
  (custom-set-faces
   '(org-date ((((class color)) (:underline nil))) t)))

(require 'org-expiry)

(add-hook 'org-after-todo-state-change-hook
          (lambda ()
            (when (string= org-state "TODO")
              (save-excursion
                (org-back-to-heading)
                (org-expiry-insert-created)))))

(setq deft-directory "~/scratch")
(setq deft-default-extension "org")

(provide 'org-customisations)

(use-package org
  :config
  ;; When clocking in, just use the time from the last clocked out
  ;; item.
  (setq org-clock-continuously t)

  ;; Show drawers, e.g. :PROPERTIES:, when we expand a heading.
  ;; See http://emacs.stackexchange.com/a/22540/304
  (remove-hook 'org-cycle-hook #'org-cycle-hide-drawers)

  ;; When creating or completing a TODO, record the timestamps.
  (setq org-log-done 'time)

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

  ;; Show *foo* and /foo/ without org markers, just the formatting.
  (setq org-hide-emphasis-markers t)

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

  ;; Don't underline dates, it's distracting.
  (custom-set-faces
   '(org-date ((((class color)) (:underline nil))) t)))

(define-key org-mode-map (kbd "C-c t") #'counsel-org-tag)

(require 'org-expiry)

(add-hook 'org-after-todo-state-change-hook
          (lambda ()
            (when (string= org-state "TODO")
              (save-excursion
                (org-back-to-heading)
                (org-expiry-insert-created)))))

(setq deft-directory "~/scratch")
(setq deft-default-extension "org")

(provide 'org-customisations)

Define a keybinding for tagging org headings with counsel


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

(setq clojure-src-root (expand-file-name "~/Projects/External"))

(setq swank-clojure-jar-path (concat clojure-src-root "/clojure/clojure.jar")
      swank-clojure-extra-classpaths (list (concat clojure-src-root "/clojure-contrib/clojure-contrib.jar")))

(require 'swank-clojure-autoload)

(eval-after-load "slime"
  '(progn
     ;; Ensure we get a REPL
     (slime-setup '(slime-repl))))

(defun slime-clojure ()
  "Fire up slime running the swank-clojure backend"
  (interactive)
  (slime 'clojure))

(provide 'init-clojure)

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

(setq clojure-src-root (expand-file-name "~/Projects/External"))

(setq swank-clojure-jar-path (concat clojure-src-root "/clojure/clojure.jar")
      swank-clojure-extra-vm-args (list "-Xmx1024m")
      swank-clojure-extra-classpaths (list (concat clojure-src-root "/clojure-contrib/clojure-contrib.jar")))

(require 'swank-clojure-autoload)

(eval-after-load "slime"
  '(progn
     ;; Ensure we get a REPL
     (slime-setup '(slime-repl))))

(defun slime-clojure ()
  "Fire up slime running the swank-clojure backend"
  (interactive)
  (slime 'clojure))

(provide 'init-clojure)

Allow the clojure REPL more memory by default under slime


(maybe-require-package 'diff-hl)
(add-hook 'prog-mode-hook 'turn-on-diff-hl-mode)
(add-hook 'vc-dir-mode-hook 'turn-on-diff-hl-mode)

(maybe-require-package 'browse-at-remote)

(provide 'init-vc)

(when (maybe-require-package 'diff-hl)
  (add-hook 'prog-mode-hook 'turn-on-diff-hl-mode)
  (add-hook 'vc-dir-mode-hook 'turn-on-diff-hl-mode))

(maybe-require-package 'browse-at-remote)

(provide 'init-vc)

Enable diff-hl-mode only when available

Enable diff-hl-mode only when available


;;; .emacs --- initialization
;; Please be -*- emacs-lisp -*-
;;; Code:
; (package-initialize)

(if (file-exists-p "~/.site-config")
    (save-excursion
      (let ((site-config-buf (find-file-noselect "~/.site-config")))
        (switch-to-buffer site-config-buf)
        (goto-char (point-min))
        (while (re-search-forward "export \\(.*\\)=\\(.*\\)" nil t)
          (setenv (match-string 1) (match-string 2)))
        (kill-buffer site-config-buf))))

(load (concat (getenv "DOTC_DIR") "/site-lisp/clgc-init.el"))

;;; .emacs ends here

;;; .emacs --- initialization
;; Please be -*- emacs-lisp -*-
;;; Code:
; (package-initialize)

(if (file-exists-p "~/.site-config")
    (save-excursion
      (let ((site-config-buf (find-file-noselect "~/.site-config")))
        (switch-to-buffer site-config-buf)
        (goto-char (point-min))
        (while (re-search-forward "export \\(.*\\)=\\(.*\\)" nil t)
          (setenv (match-string 1) (match-string 2)))
        (kill-buffer site-config-buf))))

(setenv "INSIDE_EMACS" "1")
(load (concat (getenv "DOTC_DIR") "/site-lisp/clgc-init.el"))

;;; .emacs ends here

Set INSIDE_EMACS on emacs start

Set INSIDE_EMACS on emacs start


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

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

Set default tab-width to 4 in Emacs

Set default tab-width to 4 in Emacs


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

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

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

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

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

Add a C-c f keybinding for formatting with LSP


(defconst mfa-go-packages '(go-dlv))

(defun mfa-go/init-go-dlv ()
  (use-package go-dlv
    :defer t))

(defconst mfa-go-packages '(go-dlv projectile))

(defun mfa-go/init-go-dlv ()
  (use-package go-dlv
    :defer t))

(defun mfa-go/post-init-projectile ()
  (push '(projectile-project-test-cmd . "go test") safe-local-variable-values)
  (push '(projectile-project-compilation-cmd . "go build") safe-local-variable-values))

Whitelist go build commands as safe local variable values


Add conf mode for systemd

Add conf mode for systemd


(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)
   ;; Clean whitespace on save (except in /Developer/).
   (add-hook 'before-save-hook
             (lambda ()
               (unless
                   (string-match "/Developer/" default-directory)
                 (whitespace-cleanup))) nil t)
   ;; Use visual-line-mode instead of auto-fill-mode
   (auto-fill-mode 0)
   (visual-line-mode 1)
   ;; Disable flycheck
   (flycheck-mode 0)
   ;; Disable company-mode
   (company-mode 0)))

(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)
   ;; Clean whitespace on save (except in /Developer/).
   (add-hook 'before-save-hook
             (lambda ()
               (unless
                   (string-match "/Developer/" default-directory)
                 (whitespace-cleanup))) nil t)
   ;; Use visual-line-mode instead of auto-fill-mode
   (auto-fill-mode 0)
   (visual-line-mode 1)
   ;; Disable flycheck
   (flycheck-mode 0)
   ;; Disable company-mode
   (company-mode 0)
   ;; Turn on subword mode.
   (subword-mode)
   (require 'diminish)
   (diminish 'subword-mode)))

Enable subword mode in markdown

Enable subword mode in markdown


(dolist (hook '(lisp-mode-hook
                emacs-lisp-mode-hook
                scheme-mode-hook
                ruby-mode-hook
                yaml-mode
                python-mode-hook
                shell-mode-hook
                php-mode-hook
                css-mode-hook
                haskell-mode-hook
                caml-mode-hook
                nxml-mode-hook
                crontab-mode-hook
                perl-mode-hook
                tcl-mode-hook
                javascript-mode-hook))
  (add-hook hook 'flyspell-prog-mode))
(add-hook 'nxml-mode-hook
          (lambda ()
            (add-to-list 'flyspell-prog-text-faces 'nxml-text-face)))

(provide 'init-flyspell)

(dolist (hook '(lisp-mode-hook
                emacs-lisp-mode-hook
                scheme-mode-hook
                clojure-mode-hook
                ruby-mode-hook
                yaml-mode
                python-mode-hook
                shell-mode-hook
                php-mode-hook
                css-mode-hook
                haskell-mode-hook
                caml-mode-hook
                nxml-mode-hook
                crontab-mode-hook
                perl-mode-hook
                tcl-mode-hook
                javascript-mode-hook))
  (add-hook hook 'flyspell-prog-mode))
(add-hook 'nxml-mode-hook
          (lambda ()
            (add-to-list 'flyspell-prog-text-faces 'nxml-text-face)))

(provide 'init-flyspell)

Add clojure-mode to mode list for flyspell-prog-mode


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

 :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

 :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
 (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
 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 :tools ein in doom

Enable :tools ein in doom


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

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

(defvar pjones:packages
  '( bbdb
     beginend
     bm
     circe
     circe-notifications
     color-theme-sanityinc-tomorrow
     company
     company-flx
     company-ghc
     dante
     deft
     dictionary
     dired-collapse
     dired-narrow
     dired-subtree
     flx
     flx-ido
     flycheck
     gist
     google-contacts
     graphviz-dot-mode
     indium
     haskell-mode
     highlight-indent-guides
     htmlize
     http
     hydra
     inf-ruby
     js2-mode
     magit
     markdown-mode
     nix-mode
     no-littering
     passmm
     rainbow-mode
     rhtml-mode
     ruby-end
     scad-mode
     smex
     smtpmail-multi
     yaml-mode
     yasnippet
   )
  "A list of packages to ensure are installed at launch.")

;; Prepare package management
(package-initialize)

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

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

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

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

(defvar pjones:packages
  '( bbdb
     beginend
     bm
     circe
     circe-notifications
     color-theme-sanityinc-tomorrow
     company
     company-flx
     company-ghc
     dante
     deft
     dictionary
     dired-collapse
     dired-narrow
     dired-subtree
     flx
     flx-ido
     flycheck
     gist
     google-contacts
     graphviz-dot-mode
     indium
     haskell-mode
     highlight-indent-guides
     htmlize
     http
     hydra
     inf-ruby
     js2-mode
     magit
     markdown-mode
     nix-mode
     no-littering
     org
     org-tree-slide
     passmm
     rainbow-mode
     rhtml-mode
     ruby-end
     scad-mode
     smex
     smtpmail-multi
     yaml-mode
     yasnippet
   )
  "A list of packages to ensure are installed at launch.")

;; Prepare package management
(package-initialize)

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

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

Bring in orgmode and org-tree-slide

Bring in orgmode and org-tree-slide


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

;;;###autoload
(defun display-assume-graphic-p ()
  "My Emacs instances are dedicated to either the graphical environment or the
terminal. My customizations differ slightly between the two. This functions
returns whether this Emacs instance is dedicated to the graphical environment."
  (or (display-graphic-p)
      (string-equal (getenv "EMACS_SOCKET_NAME") "server-x")))

;;;###autoload
(defun display-scaling-factor ()
  "Reads the display scaling factor from the Cinnamon dconf database.
This will return 2 on Hi-DPI displays, 1 otherwise."
  (pcase (getenv "DESKTOP_SESSION")
    ("plasma"
     (round (string-to-number
             (shell-command-to-string
              "xrdb -query | awk -F :\\\\t 'BEGIN { dpi = 96 } $1 == \"Xft.dpi\" { dpi = $2 } END { print dpi }'"))
            96))
    ("cinnamon"
     (string-to-number
      (shell-command-to-string
       "dconf read /org/cinnamon/active-display-scale")))
    ("gnome"
     (string-to-number
      (shell-command-to-string
       "dconf read /org/gnome/desktop/interface/scaling-factor | awk '{ print $2 }'")))
    (_ 1)))

;;;###autoload
(defun display-adjusted-font-size ()
  "Returns my preferred font size of 14 point multiplied by the screen scaling
factor set by the desktop environment."
  (* 14 (display-scaling-factor)))

(provide 'display)

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

;;;###autoload
(defun display-assume-graphic-p ()
  "My Emacs instances are dedicated to either the graphical environment or the
terminal. My customizations differ slightly between the two. This functions
returns whether this Emacs instance is dedicated to the graphical environment."
  (or (display-graphic-p)
      (string-equal (daemonp) "server-x")))

;;;###autoload
(defun display-scaling-factor ()
  "Reads the display scaling factor from the Cinnamon dconf database.
This will return 2 on Hi-DPI displays, 1 otherwise."
  (pcase (getenv "DESKTOP_SESSION")
    ("plasma"
     (round (string-to-number
             (shell-command-to-string
              "xrdb -query | awk -F :\\\\t 'BEGIN { dpi = 96 } $1 == \"Xft.dpi\" { dpi = $2 } END { print dpi }'"))
            96))
    ("cinnamon"
     (string-to-number
      (shell-command-to-string
       "dconf read /org/cinnamon/active-display-scale")))
    ("gnome"
     (string-to-number
      (shell-command-to-string
       "dconf read /org/gnome/desktop/interface/scaling-factor | awk '{ print $2 }'")))
    (_ 1)))

;;;###autoload
(defun display-adjusted-font-size ()
  "Returns my preferred font size of 14 point multiplied by the screen scaling
factor set by the desktop environment."
  (* 14 (display-scaling-factor)))

(provide 'display)

Make check for the "GUI" daemon instance more robust

There is no need to read the environment variable (which might not be set,
that's the brittle part) to determine the name of the server socket. We can
rather use (daemonp) which doesn't return a boolean, as the suffix "p" might
suggest, rather it returns the socket name.


((nil . ((eval . (setq compile-command (format "cd %s && make check" (locate-dominating-file buffer-file-name ".dir-locals.el")))))))

((nil . ((eval . (setq compile-command (format "cd %s && make all" (locate-dominating-file buffer-file-name ".dir-locals.el")))))))

Set compile-command to "make all" instead of "make check"


;; linum-relative: Vim-like relative line numbers
;; https://github.com/coldnew/linum-relative
(use-package linum-relative
  :ensure linum-relative
  :init
  (linum-relative-global-mode 1))

;; atom-one-dark-theme: An Emacs port of the Atom One Dark theme from Atom.io.
;; https://github.com/jonathanchu/atom-one-dark-theme
(use-package atom-one-dark-theme
  :ensure atom-one-dark-theme
  :config
  (progn
    (unless noninteractive
      (load-theme 'atom-one-dark t))))

;; Disable the intro screen & message
(setq inhibit-splash-screen t
      inhibit-startup-echo-area-message t
      inhibit-startup-message t)

;; Sane line wrapping
(visual-line-mode 1)

;; Always trail newline
(setq require-final-newline t)

;; Disable the toolbar
(tool-bar-mode -1)

(provide 'my-lookfeel)

;;; linum-relative: Vim-like relative line numbers
;;; https://github.com/coldnew/linum-relative
(use-package linum-relative
  :ensure linum-relative
  :init
  (linum-relative-global-mode 1))

;;; atom-one-dark-theme: An Emacs port of the Atom One Dark theme from Atom.io.
;;; https://github.com/jonathanchu/atom-one-dark-theme
(use-package atom-one-dark-theme
  :ensure atom-one-dark-theme
  :config
  (progn
    (unless noninteractive
      (load-theme 'atom-one-dark t))))

;; Disable the intro screen & message
(setq inhibit-splash-screen t
      inhibit-startup-echo-area-message t
      inhibit-startup-message t)

;; Sane line wrapping
(visual-line-mode 1)

;; Always trail newline
(setq require-final-newline t)

;; Disable the toolbar
(tool-bar-mode -1)

;; Set font
(add-to-list 'default-frame-alist '(font . "Hack-10"))

(provide 'my-lookfeel)

Set font to Hack-10 and updated comments


;;; init.el --- Where all the magic begins
;;
;; This file loads Org-mode and then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.

(require 'cl)

(defun tnoda/find-brew-cask-prefix
  ()
  (with-current-buffer (get-buffer-create "*brew-cask-prefix")
    (erase-buffer)
    (if (zerop (call-process "brew" nil t nil "--prefix" "cask"))
        (buffer-substring (point-min) (1- (point-max))))))

(defconst tnoda/cask-el-path
  (when-let (prefix (tnoda/find-brew-cask-prefix))
            (expand-file-name "cask.el" prefix)))

(require 'cask tnoda/cask-el-path)
(cask-initialize)

;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files
(defconst tnoda/dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name)))

(require 'org)
(require 'ob-tangle)

;; load up all literate org-mode files in this directory
(mapc #'org-babel-load-file (directory-files tnoda/dotfiles-dir t "\\.org$"))

;;; init.el ends here

;;; Originally retrieved from http://orgmode.org/worg/org-contrib/babel/intro.html on 2012-01-10

;;; init.el --- Where all the magic begins
;;
;; This file loads Org-mode and then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.

(require 'cl)

(defun tnoda/find-brew-cask-prefix
  ()
  (with-current-buffer (get-buffer-create "*brew-cask-prefix")
    (erase-buffer)
    (if (zerop (call-process "brew" nil t nil "--prefix" "cask"))
        (buffer-substring (point-min) (1- (point-max))))))

(defconst tnoda/cask-el-path
  (when-let (prefix (tnoda/find-brew-cask-prefix))
            (expand-file-name "cask.el" prefix)))

(require 'cask tnoda/cask-el-path)
(cask-initialize)

(add-to-list 'Info-directory-list (cask-resource-path "org-plus-contrib"))

;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files
(defconst tnoda/dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name)))

(require 'org)
(require 'ob-tangle)

;; load up all literate org-mode files in this directory
(mapc #'org-babel-load-file (directory-files tnoda/dotfiles-dir t "\\.org$"))

;;; init.el ends here

;;; Originally retrieved from http://orgmode.org/worg/org-contrib/babel/intro.html on 2012-01-10

Add Org's cask directory to Info-directory-list.


;; Time-stamp: <2014-02-18 13:26:32 kmodi>

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

(require 'magit)

(setq magit-completing-read-function 'magit-ido-completing-read
      magit-repo-dirs '( "~/.emacs.d"
                         )
      )

(setq setup-magit-loaded t)
(provide 'setup-magit)

;; Time-stamp: <2014-03-07 15:13:15 kmodi>

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

(require 'magit)

(setq magit-completing-read-function 'magit-ido-completing-read
      magit-auto-revert-mode nil
      magit-repo-dirs '( "~/.emacs.d"
                         )
      )

(setq setup-magit-loaded t)
(provide 'setup-magit)

Set the magit auto revert to false

Set the magit auto revert to false


(when (eq system-type 'darwin)
  (progn
    (defun copy-from-osx () (shell-command-to-string "pbpaste"))
    (defun paste-to-osx (text &optional push)
      (let ((process-connection-type nil))
	(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
	  (process-send-string proc text)
	  (process-send-eof proc))))

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

(when (eq system-type 'darwin)
  (progn
    (defun copy-from-osx () (let ((tramp-mode nil) (default-directory "~"))
                              (shell-command-to-string "pbpaste")))
    (defun paste-to-osx (text &optional push)
      (let ((process-connection-type nil))
        (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
          (process-send-string proc text)
          (process-send-eof proc))))

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

Copy and paste correctly when editing files with tramp.


;; ~/.emacs.d/behavior.el
;; Configuration settings for how Emacs should behave

(use-package better-defaults
  :ensure t)

(use-package helm
  :ensure t)
(helm-mode 1)

;; Always follow symlinks, do not prompt
(setq vc-follow-symlinks t)

;; Automatically download ELPA packages if not present
(setq use-package-always-ensure t)

;; Automatically fill paragraphs instead of doing M-q a whole bunch
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook 'turn-on-auto-fill)

;; ~/.emacs.d/behavior.el
;; Configuration settings for how Emacs should behave

(use-package better-defaults
  :ensure t)

;; Use Helm for basic autocompletion and dialogs
(use-package helm
  :ensure t)
(helm-mode 1)
(global-set-key "\C-x\C-f" 'helm-find-files)
(global-set-key "\M-x" 'helm-M-x)

;; Always follow symlinks, do not prompt
(setq vc-follow-symlinks t)

;; Automatically download ELPA packages if not present
(setq use-package-always-ensure t)

;; Automatically fill paragraphs instead of doing M-q a whole bunch
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook 'turn-on-auto-fill)

Use helm for C-x C-f and M-x

Use helm for C-x C-f and M-x


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

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

Add org-bullets package in Emacs

Add org-bullets package in Emacs


(defun set-exec-path-from-shell-PATH ()
  (let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(when *is-a-mac*
  (eval-after-load "woman"
    '(setq woman-manpath (append (list "/opt/local/man") woman-manpath)))

  ;; When started from Emacs.app or similar, ensure $PATH
  ;; is the same the user would see in Terminal.app
  (if window-system (set-exec-path-from-shell-PATH)))

(provide 'init-exec-path)

(defun set-exec-path-from-shell-PATH ()
  (let ((path-from-shell (shell-command-to-string "$SHELL -i -l -c 'echo $PATH'")))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(when *is-a-mac*
  (eval-after-load "woman"
    '(setq woman-manpath (append (list "/opt/local/man") woman-manpath)))

  ;; When started from Emacs.app or similar, ensure $PATH
  ;; is the same the user would see in Terminal.app
  (if window-system (set-exec-path-from-shell-PATH)))

(provide 'init-exec-path)

Use -l when exec-ing $SHELL to find the user's desired path


;;; helm-ag.el --- Configuration for helm-ag

;;; Commentary:
;; Set up helm-ag searching
;; - Use pt (The Platinum Searcher) rather than ag.
;; - Set a keybinding

;;; Code:
(use-package helm-ag
  :ensure t
  :init
  (setq helm-ag-fuzzy-match t)
  (setq helm-ag-base-command "pt -e nocolor --nogroup")
  :bind
  ("C-c p s h" . helm-ag))

;;; helm-ag.el ends here

;;; helm-ag.el --- Configuration for helm-ag

;;; Commentary:
;; Set up helm-ag searching
;; - Use pt (The Platinum Searcher) rather than ag.
;; - Set a keybinding

;;; Code:
(use-package helm-ag
  :ensure t
  :init
  (setq helm-ag-fuzzy-match t)
  :bind
  ("C-c p s h" . helm-ag))

;;; helm-ag.el ends here

Revert to ag rather than pt searches

Revert to ag rather than pt searches


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

 :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

 :lang
 (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
 (company +auto)

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

 :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

 :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 doom emacs agda plugin

Enable doom emacs agda plugin


(require 'use-package)

(use-package ghc
  :config (progn
	    (add-hook 'haskell-mode-hook 'ghc-init))
  :ensure t)

(use-package haskell-mode
  :ensure t
  :config (progn
	    (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
	    (add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
	    (setq haskell-process-type 'cabal-repl))
	    (setq haskell-notify-p t)
	    (setq haskell-tags-on-save t)
	    (setq haskell-stylish-on-save t)
	    (setq haskell-indentation-mode))

(require 'use-package)

(use-package ghc
  :config (progn
	    (add-hook 'haskell-mode-hook 'ghc-init))
  :ensure t)

(use-package haskell-mode
  :ensure t
  :config (progn
	    (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
	    (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
	    (setq haskell-indentation-show-indentations nil)
	    (setq haskell-process-type 'cabal-repl))
	    (setq haskell-notify-p t)
	    (setq haskell-tags-on-save t)
	    (setq haskell-stylish-on-save t))

Use haskell indentation and don't show them


(defvar osx-packages
  '(
    pbcopy
    )
  "List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")

(defun osx/init-pbcopy ()
  (use-package pbcopy
    :init
    (unless (display-graphic-p)
      (turn-on-pbcopy))))

(defvar osx-packages
  '(
    pbcopy
    )
  "List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")

(defun osx/init-pbcopy ()
  (use-package pbcopy
    :if (not (display-graphic-p))
    :init (turn-on-pbcopy)))

Use :if keyword for pbcopy init

Use :if keyword for pbcopy init


;; requires s.el to be available and loaded
(require 's)
(require 'cl-lib)

(defun get-string-from-file (filePath)
  (with-temp-buffer
    (insert-file-contents filePath)
    (buffer-string)))

(defun sorted-helm-themes ()
  (cl-sort (mapcar 'symbol-name (helm-themes--candidates)) 'string-lessp :key 'downcase))

(defun generate-theme-files ()
  (mapc
   (lambda (theme)
     (helm-themes--load-theme theme)
     (htmlize-file "./sample.exs" (concat "./html/" theme ".html")))
   (sorted-helm-themes)))

(defun generate-index-html (tpl iframes-html)
  (s-format tpl 'elt (list spacemacs-version iframes-html)))

(defun generate-iframes-html (tpl themes)
  (s-join ""
          (mapcar
           (lambda (theme)
             (s-format tpl 'elt (list theme)))
           themes)))

(defun generate-site-files ()
  (delete-directory "./html")
  (generate-theme-files)
  (append-to-file
   (generate-index-html (get-string-from-file "./templates/layout.html")
                        (generate-iframes-html(get-string-from-file "./templates/iframe.html") (sorted-helm-themes)))
   nil "./html/index.html"))

(generate-site-files)

;; requires s.el to be available and loaded
;; Just evaluate the buffer the files will be generated in ./html
(require 's)
(require 'cl-lib)

(defun get-string-from-file (filePath)
  (with-temp-buffer
    (insert-file-contents filePath)
    (buffer-string)))

(defun sorted-helm-themes ()
  (cl-sort (mapcar 'symbol-name (helm-themes--candidates)) 'string-lessp :key 'downcase))

(defun generate-theme-files ()
  (mapc
   (lambda (theme)
     ;; (helm-themes--load-theme theme)
     (htmlize-file "./sample.exs" (concat "./html/" theme ".html")))
   (sorted-helm-themes)))

(defun generate-index-html (tpl iframes-html)
  (s-format tpl 'elt (list spacemacs-version iframes-html)))

(defun generate-iframes-html (tpl themes)
  (s-join ""
          (mapcar
           (lambda (theme)
             (s-format tpl 'elt (list theme)))
           themes)))

(defun generate-site-files ()
  (if (file-exists-p "./html")
    (delete-directory "./html" t))
  (mkdir "./html")
  (generate-theme-files)
  (append-to-file
   (generate-index-html (get-string-from-file "./templates/layout.html")
                        (generate-iframes-html(get-string-from-file "./templates/iframe.html") (sorted-helm-themes)))
   nil "./html/index.html"))

(generate-site-files)

Remove and recreate the html directory on every run


;;; tools/wakatime/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(add-hook 'doom-after-switch-buffer-hook #'+wakatime-init)

;;;###autoload
(defun +wakatime-init ()
  "Initialize wakatime (if `wakatime-api-key' is set, otherwise no-op with a
warning)."
  (if wakatime-api-key
      (global-wakatime-mode +1)
    (message "No `wakatime-api-key' set! wakaktime-mode will stay disabled."))
  (remove-hook 'doom-after-switch-buffer-hook #'+wakatime-init))

;;; tools/wakatime/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(add-hook 'doom-after-switch-buffer-hook #'+wakatime-init)

;;;###autoload
(defvar wakatime-api-key nil)

;;;###autoload
(defun +wakatime-init ()
  "Initialize wakatime (if `wakatime-api-key' is set, otherwise no-op with a
warning)."
  (if wakatime-api-key
      (global-wakatime-mode +1)
    (message "No `wakatime-api-key' set! wakaktime-mode will stay disabled."))
  (remove-hook 'doom-after-switch-buffer-hook #'+wakatime-init))

Fix wakatime breaking emacs if no api-key set


;;; ar-helm-projectile.el --- Helm projectile support.

;;; Commentary:
;; Helm projectile helpers.

;;; Code:

(require 'ar-shell)
(require 'cl)
(require 'helm-projectile)
(require 'esh-mode)

(defun ar/helm-projectile-shell-cd ()
  "Change shell current working directory using helm projectile."
  (interactive)
  (assert (or (string-equal mode-name "EShell")
              (string-equal mode-name "Shell")) nil "Not in (E)Shell mode")
  (let ((helm-dir-source (copy-tree  helm-source-projectile-directories-list)))
    (add-to-list 'helm-dir-source (cons 'action (if (string-equal mode-name "EShell")
                                                    (lambda (path)
                                                      (insert (format "cd %s" path))
                                                      (eshell-send-input))
                                                    'ar/shell-cd)))
    (add-to-list 'helm-dir-source '(keymap . nil))
    (add-to-list 'helm-dir-source '(header-line . "cd to directory..."))
    (helm :sources helm-dir-source
          :buffer "*helm-dirs*"
          :candidate-number-limit 10000)))

(provide 'ar-helm-projectile)

;;; ar-helm-projectile.el ends here

;;; ar-helm-projectile.el --- Helm projectile support.

;;; Commentary:
;; Helm projectile helpers.

;;; Code:

(require 'ar-shell)
(require 'cl)
(require 'helm-projectile)
(require 'esh-mode)

(defun ar/helm-projectile-shell-cd ()
  "Change shell current working directory using helm projectile."
  (interactive)
  (assert (or (equal major-mode 'eshell-mode)
              (equal major-mode 'shell-mode)) nil "Not in (E)Shell mode")
  (let ((helm-dir-source (copy-tree  helm-source-projectile-directories-list)))
    (add-to-list 'helm-dir-source (cons 'action (if (string-equal mode-name "EShell")
                                                    (lambda (path)
                                                      (insert (format "cd %s" path))
                                                      (eshell-send-input))
                                                  'ar/shell-cd)))
    (add-to-list 'helm-dir-source '(keymap . nil))
    (add-to-list 'helm-dir-source '(header-line . "cd to directory..."))
    (helm :sources helm-dir-source
          :buffer "*helm-dirs*"
          :candidate-number-limit 10000)))

(provide 'ar-helm-projectile)

;;; ar-helm-projectile.el ends here

Use major-mode when checking for shell (instead of mode-name)


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

(package! minimap :pin "5765245dee97a3c8818fd5cd3db1eca7247fcbbc")

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

(package! minimap :pin "d8850be6fb7b3dbff0cd9b5a04d10a6dcc527326")

Fix 'bad object 5765245...' error on minimap module


(defvar syl20bnr-packages
  '(
    rainbow-identifiers
    )
  "List of all packages to install and/or initialized. Built-in packages
which require an initialization must be listed explicitly in the list.")

(defun syl20bnr/init-rainbow-identifiers ()
  (use-package rainbow-identifiers
    :commands rainbow-identifiers-mode
    :init
    (progn
      (setq rainbow-identifiers-choose-face-function 'rainbow-identifiers-cie-l*a*b*-choose-face
            rainbow-identifiers-cie-l*a*b*-saturation 100
            rainbow-identifiers-cie-l*a*b*-lightness 40
            ;; override theme faces
            rainbow-identifiers-faces-to-override '(highlight-quoted-symbol
                                                    font-lock-variable-name-face))
      (add-to-hooks 'rainbow-identifiers-mode '(prog-mode-hook
                                                erlang-mode-hook)))
    :config
    (syl20bnr/tweak-theme-colors 'solarized-light)))

Fix syntax error in syl20bnr configuration layer


(require 'company)
(require 'dash)

(defvar company-jit-prefixes
  `(
    (python-mode
     (,(rx symbol-start "import ") ,(rx symbol-start "from "))
     company-anaconda)
    (rust-mode
     (,(rx "::") ,(rx "."))
     racer-company-complete)
    (css-mode
     (,(rx ": "))
     company-css))
  "Prefix strings that trigger company completion.")

(defun company-jit-match-p (prefix)
  "Does the text before point match PREFIX?"
  (looking-back prefix))

(defun company-jit-should-complete-p ()
  "Return nil if point is in a comment or string."
  (-let [(_ _ _ in-string in-comment &rest _) (syntax-ppss)]
    (and (not in-string) (not in-comment))))

(defun company-jit-post-self-insert ()
  "Open company in situations where the user probably wants completions."
  (catch 'break
    (--each company-jit-prefixes
      (-let [(mode prefixes backend) it]
        ;; If we're in the mode listed in `company-jit-prefixes'
        (when (and (eq mode major-mode)
                   ;; and we're not in a string or comment
                   (company-jit-should-complete-p)
                   ;; and we're looking at one of the prefixes mentioned
                   (--any-p (company-jit-match-p it) prefixes))
          (company-begin-backend backend)
          (throw 'break nil))))))

(add-hook 'post-self-insert-hook #'company-jit-post-self-insert)

(provide 'company-jit)

(require 'company)
(require 'dash)

(defvar company-jit-prefixes
  `(
    (python-mode
     (,(rx symbol-start "import ") ,(rx symbol-start "from "))
     company-anaconda)
    (rust-mode
     (,(rx "::") ,(rx "."))
     racer-company-complete)
    (css-mode
     (,(rx ": "))
     company-css))
  "Prefix strings that trigger company completion.")

(defun company-jit-match-p (prefix)
  "Does the text before point match PREFIX?"
  (looking-back prefix))

(defun company-jit-post-self-insert ()
  "Open company in situations where the user probably wants completions."
  (catch 'break
    (--each company-jit-prefixes
      (-let [(mode prefixes backend) it]
        ;; If we're in the mode listed in `company-jit-prefixes'
        (when (and (eq mode major-mode)
                   ;; and we're in code
                   (not (company-in-string-or-comment))
                   ;; and we're looking at one of the prefixes mentioned
                   (--any-p (company-jit-match-p it) prefixes))
          (company-begin-backend backend)
          (throw 'break nil))))))

(add-hook 'post-self-insert-hook #'company-jit-post-self-insert)

(provide 'company-jit)

Use company functions instead of rolling our own.


;; Time-stamp: <2015-01-23 09:43:08 kmodi>

;; StackExchange Mode
;; http://www.emacswiki.org/emacs/sx.el

(req-package sx)

(provide 'setup-sx)

;; Time-stamp: <2015-01-28 11:30:43 kmodi>

;; StackExchange Mode
;; https://github.com/vermiculus/sx.el

(req-package sx)

(provide 'setup-sx)

Fix the package source hyperlink

Fix the package source hyperlink


(use-package evil-little-word)

(use-package evil-operator-moccur
  :init
    (global-evil-operator-moccur-mode 1))

(use-package evil-operator-comment
  :init
  (global-evil-operator-comment-mode 1))

(use-package evil-little-word)

(use-package evil-operator-comment
  :init
  (global-evil-operator-comment-mode 1))

Remove unused evil plugin for mocur

Remove unused evil plugin for mocur


(provide 'init-local)

;; rails reloaded plugin
(push "~/.emacs.d/site-lisp/rails-reloaded" load-path)
(require 'rails-autoload)

;; rails reloaded plugin
(push "~/.emacs.d/site-lisp/rails-reloaded" load-path)
(require 'rails-autoload)

;; Standard ML https://class.coursera.org/proglang-003/wiki/view?page=smlEmacsInstall
(setenv "PATH" (concat "/home/david1/workspace/sml/bin:" (getenv "PATH")))
(setq exec-path (cons "/home/david1/workspace/sml/bin"  exec-path))

(require-package 'sml-mode)
(require 'sml-mode)

(provide 'init-local)

Add support for Standard ML

Add support for Standard ML

including path to a local binary


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; START: Ruby / Rails setup

;; Interactively Do Things (highly recommended, but not strictly required)

(ido-mode t)

;; Rinari
(push "~/.emacs.d/site-lisp/rinari" load-path)
(require 'rinari)

;; rails reloaded plugin
(push "~/.emacs.d/site-lisp/rails-reloaded" load-path)
(require 'rails-autoload)

;; END: Ruby / Rails setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(setq package-archives '(
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

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

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(safe-local-variable-values (quote ((eval checkdoc-minor-mode 1))))
 '(version-control t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 100 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))

(provide 'init-local)

;; rails reloaded plugin
(push "~/.emacs.d/site-lisp/rails-reloaded" load-path)
(require 'rails-autoload)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(safe-local-variable-values (quote ((eval checkdoc-minor-mode 1))))
 '(version-control t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 100 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))

Fix and remove duplications from local

 Fix and remove duplications from local

 customizations init-local.el


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

(provide 'init-osx-keys)

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

(provide 'init-osx-keys)

Clarify meaning of obscure key binding

Clarify meaning of obscure key binding


;;; im -- Integration for instant messaging
;;;
;;; Commentary:
;;;   Uses jabber mode.
;;; Customisations:
;;;  - Adapts python-mode to work with differnet project styles,
;;;    notably the Pylons project.
;;
;;; Code:

(require 'jabber)

(defun notify-jabber-notify (from buf text proposed-alert)
  "Notify via notify.el about new messages using FROM BUF TEXT PROPOSED-ALERT."
  (when (or jabber-message-alert-same-buffer
	    (not (memq (selected-window) (get-buffer-window-list buf))))
    (if (jabber-muc-sender-p from)
	(notify (format "(PM) %s"
			(jabber-jid-displayname (jabber-jid-user from)))
		(format "%s: %s" (jabber-jid-resource from) text)))
    (notify (format "%s" (jabber-jid-displayname from))
	    text)))

(add-hook #'jabber-alert-message-hooks #'notify-jabber-notify)

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

;;; im -- Integration for instant messaging
;;;
;;; Commentary:
;;;   Uses jabber mode.
;;; Customisations:
;;;  - Adapts python-mode to work with differnet project styles,
;;;    notably the Pylons project.
;;
;;; Code:

(require 'jabber)
(require 'notify)

(defun notify-jabber-notify (from buf text proposed-alert)
  "Notify via notify.el about new messages using FROM BUF TEXT PROPOSED-ALERT."
  (when (or jabber-message-alert-same-buffer
	    (not (memq (selected-window) (get-buffer-window-list buf))))
    (if (jabber-muc-sender-p from)
	(notify (format "(PM) %s"
			(jabber-jid-displayname (jabber-jid-user from)))
		(format "%s: %s" (jabber-jid-resource from) text)))
    (notify (format "%s" (jabber-jid-displayname from))
	    text)))

(add-hook 'jabber-alert-message-hooks #'notify-jabber-notify)

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

Clean up lisp syntax errors.

Clean up lisp syntax errors.


;;; winner-use.el --- Revert to previous window states (bundled with Emacs)

(use-package winner
  :config
  (winner-mode 1))

(provide 'winner-use)

;;; winner-use.el ends here

;;; winner-use.el --- Revert to previous window states (bundled with Emacs)

(use-package winner
  :bind
  (:map winner-mode-map
        ("C-w C-h" . winner-undo)
        ("C-w C-l" . winner-redo))

  :config
  (winner-mode 1)

  :demand)

(provide 'winner-use)

;;; winner-use.el ends here

Add some keybindings for winner-mode

Add some keybindings for winner-mode


(require-package 'tidy)
(add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))

(require-package 'tagedit)
(after-load 'sgml-mode
  (tagedit-add-paredit-like-keybindings)
  (add-hook 'sgml-mode-hook (lambda () (tagedit-mode 1))))

(add-auto-mode 'html-mode "\\.\\(jsp\\|tmpl\\)\\'")

;; Note: ERB is configured in init-ruby

(provide 'init-html)

Remove another use of the tidy package

Remove another use of the tidy package

See #540


(setq-default ruby-indent-line global-tab-width)

(smart-tabs-advice ruby-indent-line ruby-indent-level)
(smart-tabs-insinuate 'ruby)

(setf ruby-indent-tabs-mode t)
(setf ruby-use-smie nil)

(add-to-list 'auto-mode-alist '("\\.god\\'" . ruby-mode))

(provide 'ruby)

;; Set ruby-indent-line to global-tab-width
(setq-default ruby-indent-line global-tab-width)

;; Provide advice to Smart Tabs about how to handle Ruby's special
;; indentation variables.
(smart-tabs-advice ruby-indent-line ruby-indent-level)

;; Apply Ruby language support to Smart Tabs.
(smart-tabs-insinuate 'ruby)

;; Use tabs mode in Ruby by default.
(setf ruby-indent-tabs-mode t)

;; Don't use SMIE because SMIE sucks.
(setf ruby-use-smie nil)

;; God configurations are in Ruby.
;; TODO Add more Ruby-esque extensions.
(add-to-list 'auto-mode-alist '("\\.god\\'" . ruby-mode))

(provide 'ruby)

Add documentation to Ruby support

Add documentation to Ruby support


(require 'package)

(defvar marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
(defvar gnu '("gnu" . "http://elpa.gnu.org/packages/"))
(defvar melpa '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Add marmalade to package repos
(add-to-list 'package-archives marmalade)
(add-to-list 'package-archives melpa t)

(package-initialize)

(unless (file-exists-p "~/.emacs.d/elpa/archives")
  (package-refresh-contents))

(defun packages-install (&rest packages)
  (mapc (lambda (package)
          (let ((name (car package))
                (repo (cdr package)))
            (when (not (package-installed-p name))
              (let ((package-archives (list repo)))
                (package-initialize)
                (package-install name)))))
        packages)
  (package-initialize)
  (delete-other-windows))

(provide 'setup-package)

(require 'package)

(defvar marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
(defvar gnu '("gnu" . "http://elpa.gnu.org/packages/"))
(defvar melpa '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Add marmalade to package repos
(add-to-list 'package-archives marmalade)
(add-to-list 'package-archives melpa t)

(package-initialize)

(unless (and (file-exists-p "~/.emacs.d/elpa/archives/marmalade")
             (file-exists-p "~/.emacs.d/elpa/archives/gnu")
             (file-exists-p "~/.emacs.d/elpa/archives/melpa"))
  (package-refresh-contents))

(defun packages-install (&rest packages)
  (mapc (lambda (package)
          (let ((name (car package))
                (repo (cdr package)))
            (when (not (package-installed-p name))
              (let ((package-archives (list repo)))
                (package-initialize)
                (package-install name)))))
        packages)
  (package-initialize)
  (delete-other-windows))

(provide 'setup-package)

Make sure melpa, marmalade and gnu is all present in archives.


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

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

Remove defunct config for vc-darcs

Remove defunct config for vc-darcs


;;; package --- Summary

;;; Commentary:

;;; Code:

(add-to-list 'load-path (expand-file-name "site-lisp" user-emacs-directory))

(require-package 'slime)
(setq slime-lisp-implementations
      '((ccl ("/usr/local/bin/ccl64"))
        (cmucl ("/usr/local/Cellar/cmucl/20e/bin/lisp"))))
(after-load 'slime
  (slime-setup '(slime-repl slime-fancy)))

(require-package 'exec-path-from-shell)
(after-load 'exec-path-from-shell
  (dolist (var '("JAVA_HOME"))
    (add-to-list 'exec-path-from-shell-variables var)))

(require-package 'pretty-lambdada)
(pretty-lambda-for-modes)

(require 'cltl2)

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

;;; package --- Summary

;;; Commentary:

;;; Code:

(add-to-list 'load-path (expand-file-name "site-lisp" user-emacs-directory))

(require-package 'slime)
(setq slime-lisp-implementations
      '((ccl ("/usr/local/bin/ccl64"))
        (cmucl ("/usr/local/Cellar/cmucl/20e/bin/lisp"))))
(after-load 'slime
  (slime-setup '(slime-repl slime-fancy)))

(require-package 'exec-path-from-shell)
(after-load 'exec-path-from-shell
  (dolist (var '("JAVA_HOME"))
    (add-to-list 'exec-path-from-shell-variables var)))

(require-package 'pretty-lambdada)
(pretty-lambda-for-modes)

(require 'cltl2)

;;; maxima
(add-to-list 'load-path "/usr/local/Cellar/maxima/5.33.0/share/maxima/5.33.0/emacs/")
(autoload 'maxima-mode "maxima" "Maxima mode" t)
(autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima" "Maxima interaction" t)
(autoload 'imath-mode "imath" "Imath mode for math formula input" t)
(setq imaxima-use-maxima-mode-flag t)
(add-to-list 'auto-mode-alist '("\\.ma[cx]" . maxima-mode))

;;; shortcut
(global-set-key (kbd "<f5>") 'ibuffer)

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

Add maxima mode and ibuffer shortcut

Add maxima mode and ibuffer shortcut


(require-package 'color-theme-sanityinc-solarized)
(require-package 'color-theme-sanityinc-tomorrow)

;; If you don't customize it, this is the theme you get.
(setq-default custom-enabled-themes '(sanityinc-tomorrow-bright))

;; Ensure that themes will be applied even if they have not been customized
(defun reapply-themes ()
  "Forcibly load the themes listed in `custom-enabled-themes'."
  (dolist (theme custom-enabled-themes)
    (unless (custom-theme-p theme)
      (load-theme theme)))
  (custom-set-variables `(custom-enabled-themes (quote ,custom-enabled-themes))))

(add-hook 'after-init-hook 'reapply-themes)

;;------------------------------------------------------------------------------
;; Toggle between light and dark
;;------------------------------------------------------------------------------
(defun light ()
  "Activate a light color theme."
  (interactive)
  (setq custom-enabled-themes '(sanityinc-tomorrow-day))
  (reapply-themes))

(defun dark ()
  "Activate a dark color theme."
  (interactive)
  (setq custom-enabled-themes '(sanityinc-tomorrow-bright))
  (reapply-themes))

(provide 'init-themes)

(require-package 'color-theme-sanityinc-solarized)
(require-package 'color-theme-sanityinc-tomorrow)

;; If you don't customize it, this is the theme you get.
(setq-default custom-enabled-themes '(sanityinc-solarized-light))

;; Ensure that themes will be applied even if they have not been customized
(defun reapply-themes ()
  "Forcibly load the themes listed in `custom-enabled-themes'."
  (dolist (theme custom-enabled-themes)
    (unless (custom-theme-p theme)
      (load-theme theme)))
  (custom-set-variables `(custom-enabled-themes (quote ,custom-enabled-themes))))

(add-hook 'after-init-hook 'reapply-themes)

;;------------------------------------------------------------------------------
;; Toggle between light and dark
;;------------------------------------------------------------------------------
(defun light ()
  "Activate a light color theme."
  (interactive)
  (color-theme-sanityinc-solarized-light))

(defun dark ()
  "Activate a dark color theme."
  (interactive)
  (color-theme-sanityinc-solarized-dark))

(provide 'init-themes)

Revert "Change default theme to my preferred dark theme"

This reverts commit 7940db01b08862b34888ebe05aabedfac21784d9.


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

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

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

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

Remove smartrep from our own package list add evil-surround


(require 'git-gutter-fringe)

(global-git-gutter-mode t)
(setq git-gutter:hide-gutter t)

;; Don't need log/message.
(setq git-gutter:verbosity 0)

(setq git-gutter-fr:side 'right-fringe)
(setq git-gutter:update-hooks '(after-save-hook after-revert-hook))

;; custom graphics that works nice with half-width fringes
(fringe-helper-define 'git-gutter-fr:added nil
  "..X...."
  "..X...."
  "XXXXX.."
  "..X...."
  "..X...."
)
(fringe-helper-define 'git-gutter-fr:deleted nil
  "......."
  "......."
  "XXXXX.."
  "......."
  "......."
)
(fringe-helper-define 'git-gutter-fr:modified nil
  "..X...."
  ".XXX..."
  "XXXXX.."
  ".XXX..."
  "..X...."
)

(require 'git-gutter-fringe)

(global-git-gutter-mode t)
(setq git-gutter:hide-gutter t)

;; Don't need log/message.
(setq git-gutter:verbosity 0)

(setq git-gutter-fr:side 'right-fringe)
;; (setq git-gutter:update-hooks '(after-save-hook after-revert-hook))

;; custom graphics that works nice with half-width fringes
(fringe-helper-define 'git-gutter-fr:added nil
  "..X...."
  "..X...."
  "XXXXX.."
  "..X...."
  "..X...."
)
(fringe-helper-define 'git-gutter-fr:deleted nil
  "......."
  "......."
  "XXXXX.."
  "......."
  "......."
)
(fringe-helper-define 'git-gutter-fr:modified nil
  "..X...."
  ".XXX..."
  "XXXXX.."
  ".XXX..."
  "..X...."
)

Remove explicit hooks from git-gutter-fringe configuration.


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

(defconst my-atomic-chrome-packages '(atomic-chrome))

(defun my-atomic-chrome/init-atomic-chrome ()
  (use-package atomic-chrome
    :defer t
    :init
    (when (and (daemonp) (display-assume-graphic-p))
      (add-hook 'spacemacs-post-user-config-hook #'atomic-chrome-start-server))
    :config
    (progn
      (setq atomic-chrome-buffer-open-style 'frame
            atomic-chrome-extension-type-list '(atomic-chrome))

      (when (configuration-layer/package-used-p 'markdown-mode)
        (add-to-list 'atomic-chrome-url-major-mode-alist '("github" . gfm-mode)))

      (when (configuration-layer/package-used-p 'dokuwiki-mode)
        (add-to-list 'atomic-chrome-url-major-mode-alist '("wiki" . dokuwiki-mode))))))

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

(defconst my-atomic-chrome-packages '(atomic-chrome))

(defun my-atomic-chrome/init-atomic-chrome ()
  (use-package atomic-chrome
    :defer t
    :init
    (when (and (daemonp) (display-assume-graphic-p))
      (add-hook 'spacemacs-post-user-config-hook #'atomic-chrome-start-server))
    :config
    (progn
      (setq atomic-chrome-buffer-open-style 'frame)

      (when (configuration-layer/package-used-p 'markdown-mode)
        (add-to-list 'atomic-chrome-url-major-mode-alist '("github" . gfm-mode)))

      (when (configuration-layer/package-used-p 'dokuwiki-mode)
        (add-to-list 'atomic-chrome-url-major-mode-alist '("wiki" . dokuwiki-mode))))))

Enable support for GhostText extension, to support Firefox as well


(require 'ecukes)

(defun kill-js-buffers ()
  (mapc (lambda (buffer)
            (when (string-match "\.js" (buffer-name buffer))
              (kill-buffer (buffer-name buffer))))
          (buffer-list)))

(After ;; Kill all test buffers
 (when (get-buffer "*mocha tests*")
   (kill-buffer "*mocha tests*"))
 (kill-js-buffers))

(require 'ecukes)
(require 'f)

(defun kill-js-buffers ()
  (mapc (lambda (buffer)
            (when (f-ext? (or (buffer-file-name buffer) "") "js")
              (kill-buffer (buffer-name buffer))))
          (buffer-list)))

(After ;; Kill all test buffers
 (when (get-buffer "*mocha tests*")
   (kill-buffer "*mocha tests*"))
 (kill-js-buffers))

Use `f-ext?` to detect file extensions.

Use `f-ext?` to detect file extensions.


;; Time-stamp: <2014-07-03 11:46:12 kmodi>

;; Yet Another Folding, Folding code blocks based on indentation.
;; Source: https://github.com/zenozeng/yafolding.el

(require 'yafolding)

(add-hook 'prog-mode-hook
          (lambda () (yafolding-mode)))

(setq yafolding-ellipsis-content ">>>>>")

(setq setup-yafolding-loaded t)
(provide 'setup-yafolding)

;; C-Enter <- Fold the current block; cursor has to be on the top-most line of the block
;; C-S-Enter <- Toggle folding all blocks

;; Time-stamp: <2014-07-24 22:04:27 kmodi>

;; Yet Another Folding, Folding code blocks based on indentation.
;; Source: https://github.com/zenozeng/yafolding.el

(require 'yafolding)

(add-hook 'prog-mode-hook
          (lambda () (yafolding-mode)))

(setq yafolding-ellipsis-content ">>>folded")

(setq setup-yafolding-loaded t)
(provide 'setup-yafolding)

;; C-Enter <- Fold the current block; cursor has to be on the top-most line of the block
;; C-S-Enter <- Toggle folding all blocks

Change string to indicate code folding has happened


(when (maybe-require-package 'rust-mode)
  (when (maybe-require-package 'racer)
    (add-hook 'rust-mode-hook #'racer-mode)
    (add-hook 'racer-mode-hook #'eldoc-mode)))

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

(provide 'init-rust)

(when (maybe-require-package 'rust-mode)
  (when (maybe-require-package 'racer)
    (add-hook 'rust-mode-hook #'racer-mode)
    (add-hook 'racer-mode-hook #'eldoc-mode))
  (when (maybe-require-package 'company)
    (add-hook 'racer-mode-hook #'company-mode)))

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

(provide 'init-rust)

Add rust racer autocompletion with company


(require-package 'haskell-mode)

;; Use intero for completion and flycheck

(when (maybe-require-package 'intero)
  (after-load 'haskell-mode
    (intero-global-mode)
    (add-hook 'haskell-mode-hook 'eldoc-mode))
  (after-load 'intero
    ;; Don't clobber sanityinc/counsel-search-project binding
    (define-key intero-mode-map (kbd "M-?") nil)
    (after-load 'flycheck
      (flycheck-add-next-checker 'intero
                                 '(warning . haskell-hlint)))))

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

;; Indentation
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

;; Source code helpers

(add-hook 'haskell-mode-hook 'haskell-auto-insert-module-template)

(when (maybe-require-package 'hindent)
  (add-hook 'haskell-mode-hook 'hindent-mode))

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

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

(provide 'init-haskell)

(require-package 'haskell-mode)

;; Use intero for completion and flycheck

(when (maybe-require-package 'intero)
  (after-load 'haskell-mode
    (intero-global-mode)
    (add-hook 'haskell-mode-hook 'eldoc-mode))
  (after-load 'haskell-cabal
    (define-key haskell-cabal-mode-map (kbd "C-c C-l") 'intero-restart))
  (after-load 'intero
    ;; Don't clobber sanityinc/counsel-search-project binding
    (define-key intero-mode-map (kbd "M-?") nil)
    (after-load 'flycheck
      (flycheck-add-next-checker 'intero
                                 '(warning . haskell-hlint)))))

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

;; Indentation
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

;; Source code helpers

(add-hook 'haskell-mode-hook 'haskell-auto-insert-module-template)

(when (maybe-require-package 'hindent)
  (add-hook 'haskell-mode-hook 'hindent-mode))

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

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

(provide 'init-haskell)

Add a binding for `intero-restart' in cabal mode


;;; my-python.el --- Python settings & customisations -*- 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:

(defun my-python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(use-package company-jedi
  :defer t
  :init
  (eval-after-load "company"
    '(add-hook 'python-mode-hook 'my-python-mode-hook)))

(use-package anaconda-mode
  :defer t
  :config
  (add-hook 'python-mode-hook 'anaconda-mode)
  (add-hook 'python-mode-hook 'anaconda-eldoc-mode))

(use-package company-anaconda
  :defer t
  :config
  (eval-after-load "company"
    '(add-to-list 'company-backends 'company-anaconda)))

(use-package pyvenv)

(provide 'my-python)

;;; my-python.el ends here

;;; my-python.el --- Python settings & customisations -*- 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:

(use-package anaconda-mode
  :defer t
  :config
  (add-hook 'python-mode-hook 'anaconda-mode)
  (add-hook 'python-mode-hook 'anaconda-eldoc-mode))

(use-package company-anaconda
  :defer t
  :after company
  :config
  (push 'company-anaconda company-backends))

(use-package pyvenv
  :defer t)

(provide 'my-python)

;;; my-python.el ends here

Make anaconda-mode enable automatically, fix autocomplete


;;; ar-helm-projectile.el --- Helm projectile support.

;;; Commentary:
;; Helm projectile helpers.

;;; Code:

(require 'ar-shell)
(require 'helm-projectile)

(defun ar/helm-projectile-shell-cd ()
  "Change shell current working directory using helm projectile."
  (interactive)
  (unless (string-equal mode-name "Shell")
    (error "Not in Shell mode"))
  (let ((helm-dir-source (copy-tree  helm-source-projectile-directories-list)))
    (add-to-list 'helm-dir-source '(action . ar/shell-cd))
    (add-to-list 'helm-dir-source '(keymap . nil))
    (add-to-list 'helm-dir-source '(header-line . "cd to directory..."))
    (helm :sources helm-dir-source
          :buffer "*helm-dirs*"
          :candidate-number-limit 10000)))

(provide 'ar-helm-projectile)

;;; ar-helm-projectile.el ends here

;;; ar-helm-projectile.el --- Helm projectile support.

;;; Commentary:
;; Helm projectile helpers.

;;; Code:

(require 'ar-shell)
(require 'cl)
(require 'helm-projectile)

(defun ar/helm-projectile-shell-cd ()
  "Change shell current working directory using helm projectile."
  (interactive)
  (assert (string-equal mode-name "Shell") nil "Not in Shell mode")
  (let ((helm-dir-source (copy-tree  helm-source-projectile-directories-list)))
    (add-to-list 'helm-dir-source '(action . ar/shell-cd))
    (add-to-list 'helm-dir-source '(keymap . nil))
    (add-to-list 'helm-dir-source '(header-line . "cd to directory..."))
    (helm :sources helm-dir-source
          :buffer "*helm-dirs*"
          :candidate-number-limit 10000)))

(provide 'ar-helm-projectile)

;;; ar-helm-projectile.el ends here

Use assert instead of unless and error.

Use assert instead of unless and error.


(require 'snails-core)
(require 'exec-path-from-shell)

(exec-path-from-shell-initialize)

(snails-create-async-backend
 :name
 "RG"

 :build-command
 (lambda (input)
   (when (and (executable-find "rg")
              (> (length input) 5))
     (let ((project (project-current)))
       (when project
         (list "rg" "--no-heading" "--column" "--color" "never" input (expand-file-name (cdr project)))
         ))))

 :candidate-filter
 (lambda (candidate-list)
   (let (candidates)
     (dolist (candidate candidate-list)
       (let ((file-info (split-string candidate ":"))
             (project-dir (expand-file-name (cdr (project-current)))))
         (add-to-list 'candidates
                      (list
                       (snails-wrap-file-icon-with-candidate
                        (nth 0 file-info)
                        (format "PDIR/%s" (nth 1 (split-string candidate project-dir))))
                       candidate)
                      t)))
     candidates))

 :candiate-do
 (lambda (candidate)
   (let ((file-info (split-string candidate ":")))
     (when (> (length file-info) 3)
       (find-file (nth 0 file-info))
       (goto-line (string-to-number (nth 1 file-info)))
       (goto-column (max (- (string-to-number (nth 2 file-info)) 1) 0))
       ))))

(provide 'snails-backend-rg)

(require 'snails-core)
(require 'exec-path-from-shell)

(exec-path-from-shell-initialize)

(snails-create-async-backend
 :name
 "RG"

 :build-command
 (lambda (input)
   (when (and (executable-find "rg")
              (> (length input) 5))
     (let ((project (project-current)))
       (when project
         (list "rg" "--no-heading" "--column" "--color" "never" "--max-columns" "300" input (expand-file-name (cdr project)))
         ))))

 :candidate-filter
 (lambda (candidate-list)
   (let (candidates)
     (dolist (candidate candidate-list)
       (let ((file-info (split-string candidate ":"))
             (project-dir (expand-file-name (cdr (project-current)))))
         (add-to-list 'candidates
                      (list
                       (snails-wrap-file-icon-with-candidate
                        (nth 0 file-info)
                        (format "PDIR/%s" (nth 1 (split-string candidate project-dir))))
                       candidate)
                      t)))
     candidates))

 :candiate-do
 (lambda (candidate)
   (let ((file-info (split-string candidate ":")))
     (when (> (length file-info) 3)
       (find-file (nth 0 file-info))
       (goto-line (string-to-number (nth 1 file-info)))
       (goto-column (max (- (string-to-number (nth 2 file-info)) 1) 0))
       ))))

(provide 'snails-backend-rg)

Add max-column option for rg backend.

Add max-column option for rg backend.


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

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

;; Custom wrappers

(wrap-region-add-wrapper "{ value: " " }" "v" 'js2-mode)
(wrap-region-add-wrapper "$(" ")" "$" '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)
(wrap-region-add-wrapper "${" "}" "$" '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)

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

;; Custom wrappers

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

(wrap-region-add-wrapper "<c:out value=\"" "\"/>" "o" 'html-mode)
(wrap-region-add-wrapper "
" "
" "p" 'html-mode)
(wrap-region-add-wrapper "
" "
" "d" '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)
(wrap-region-add-wrapper "${" "}" "$" 'html-mode)

(wrap-region-add-wrapper "*" "*" "*" 'markdown-mode)

(provide 'setup-wrap-region)

Add more nice wrappers to wrap-region.

Add more nice wrappers to wrap-region.


(defconst mfa-markdown-packages '(flycheck))

(defun mfa-markdown/post-init-flycheck ()
  (spacemacs/enable-flycheck 'markdown-mode)
  (with-eval-after-load 'flycheck
    (flycheck-add-next-checker 'markdown-markdownlint-cli 'proselint)))

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

(defconst mfa-markdown-packages '(flycheck
                                  markdown-mode))

(defun mfa-markdown/post-init-flycheck ()
  (spacemacs/enable-flycheck 'markdown-mode)
  (with-eval-after-load 'flycheck
    (flycheck-add-next-checker 'markdown-markdownlint-cli 'proselint)))

(defun mfa-markdown/post-init-markdown-mode ()
  (add-hook 'markdown-mode-hook #'auto-fill-mode))

Enable auto-fill mode in markdown buffers