summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authortslil clingman <>2019-09-11 19:18:14 -0400
committertslil clingman <>2019-09-11 19:18:14 -0400
commitac1a4884d03fc0495c773500d8a13f84b695fa43 (patch)
tree29e5ec49e0ce957d80d8f11a155b47840c74f488 /emacs
Init
Diffstat (limited to 'emacs')
-rw-r--r--emacs/init.el59
-rw-r--r--emacs/inits/00-exwm.el153
-rw-r--r--emacs/inits/01-basic.el126
-rw-r--r--emacs/inits/02-modeline.el96
-rw-r--r--emacs/inits/03-miscload.el17
-rw-r--r--emacs/inits/04-input_method.el14
-rw-r--r--emacs/inits/05-helpful.el17
-rw-r--r--emacs/inits/06-dashboard.el30
-rw-r--r--emacs/inits/10-ivy.el117
-rw-r--r--emacs/inits/12-company.el17
-rw-r--r--emacs/inits/13-ibuffer.el70
-rw-r--r--emacs/inits/14-movement.el170
-rw-r--r--emacs/inits/15-project-mgmt.el18
-rw-r--r--emacs/inits/20-programming.el121
-rw-r--r--emacs/inits/21-functional.el75
-rw-r--r--emacs/inits/22-lisp.el132
-rw-r--r--emacs/inits/23-text-related.el133
-rw-r--r--emacs/inits/24-latex.el146
-rw-r--r--emacs/inits/25-theorems.el124
-rw-r--r--emacs/inits/30-irc.el45
-rw-r--r--emacs/inits/50-file-assocs.el20
-rw-r--r--emacs/inits/60-misc-configs.el22
-rw-r--r--emacs/inits/70-global-keybinds.el32
-rw-r--r--emacs/inits/99-last.el7
-rw-r--r--emacs/notmuch-config.el244
-rw-r--r--emacs/scripts/acquiesce.el351
-rw-r--r--emacs/scripts/caps-lock-mode.el21
-rw-r--r--emacs/scripts/cdm-mode.el342
-rw-r--r--emacs/themes/acme-theme.el148
-rw-r--r--emacs/themes/soothe-theme.el856
30 files changed, 3723 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el
new file mode 100644
index 0000000..8395564
--- /dev/null
+++ b/emacs/init.el
@@ -0,0 +1,59 @@
+;; Time-stamp: <2019-04-15 16:22:30 (tslil@basingstoke)>
+
+;; Faster startup
+(setq gc-cons-threshold 100000000
+ old-file-name-handler-alist file-name-handler-alist
+ file-name-handler-alist nil)
+
+(setq user-full-name "tslil")
+
+(setq network-security-level 'high
+ tls-connection-command "gnutls-cli -p %p %h"
+ tls-checktrust t
+ tls-program '("gnutls-cli --x509cafile %t -p %p %h")
+ gnutls-verify-error t
+ gnutls-log-level 0
+ gnutls-min-prime-bits 2048
+ gnutls-trustfiles '("/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/usr/ssl/certs/ca-bundle.crt")
+ ;;imap-ssl-program '("gnutls-cli --x509cafile %t -p %p %s")
+ smtpmail-stream-type 'starttls)
+
+
+(require 'package)
+(setq package-enable-at-startup nil
+ load-prefer-newer t
+ package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
+ ("melpa" . "https://melpa.org/packages/")))
+(package-initialize)
+
+(unless (package-installed-p 'use-package)
+ (package-refresh-contents)
+ (package-install 'use-package))
+
+(eval-when-compile
+ (require 'use-package))
+(use-package bind-key :ensure t :demand)
+
+(use-package pinentry
+ :ensure t
+ :demand
+ :config
+ (setq epa-pinentry-mode 'loopback)
+ (pinentry-start))
+
+(use-package keychain-environment
+ :ensure t
+ :config
+ (keychain-refresh-environment))
+
+(use-package init-loader
+ :ensure t
+ :demand
+ :config
+ (setq init-loader-byte-compile t)
+ (init-loader-load))
+
+(setq custom-file "~/.emacs.d/custom.el")
+(unless (file-exists-p custom-file)
+ (write-region "" nil custom-file))
+(load custom-file)
diff --git a/emacs/inits/00-exwm.el b/emacs/inits/00-exwm.el
new file mode 100644
index 0000000..381f54e
--- /dev/null
+++ b/emacs/inits/00-exwm.el
@@ -0,0 +1,153 @@
+;; Time-stamp: <2019-09-11 14:35:00 (tslil@basingstoke)>
+
+(defun adjust-volume (mixer adjust)
+ (let ((tail " | tail -n 1")
+ (sed (concat " | sed 's/.*\\[\\([0-9]*.\\)\\] "
+ "\\[.*dB\\] \\[\\(.*\\)\\]$/"
+ mixer
+ " \\1 \\2/'")))
+ (shell-command
+ (concat
+ (cond ((string-equal "+" adjust) (concat "amixer set " mixer " 2%+"))
+ ((string-equal "-" adjust) (concat "amixer set " mixer " 2%-"))
+ (t (concat "amixer set " mixer " toggle")))
+ tail
+ sed))))
+
+(defun banish-rat ()
+ (interactive)
+ (shell-command "xdotool mousemove 1366 768")
+ (message "Rat banished."))
+
+(use-package exwm
+ :if (window-system)
+ :ensure t
+ :demand
+ :config
+
+ (setq exwm-workspace-number 1
+ exwm-workspace-switch-create-limit 5
+ exwm-workspace-show-all-buffers nil)
+
+ (add-hook 'exwm-update-class-hook
+ (lambda ()
+ (exwm-workspace-rename-buffer exwm-class-name)))
+
+ ;; -------------------------------------------------------------------
+ ;; Global key binds
+
+ (setq exwm-input-simulation-keys
+ '(([?\C-b] . [left])
+ ([?\C-f] . [right])
+ ([?\C-p] . [up])
+ ([?\C-n] . [down])
+ ([?\C-a] . [home])
+ ([?\C-e] . [end])
+ ([?\M-v] . [prior])
+ ([?\C-v] . [next])
+ ([?\C-s] . [C-f])
+ ;;([?\C-d] . [delete])
+ ;;([?\C-k] . [S-end delete])
+ ))
+
+ ;; reset
+ (exwm-input-set-key (kbd "s-r") 'exwm-reset)
+
+ ;; workspaces
+ (exwm-input-set-key (kbd "s-e") 'exwm-workspace-switch)
+
+ (dotimes (i 10)
+ (exwm-input-set-key (kbd (format "s-%d" i))
+ `(lambda ()
+ (interactive)
+ (exwm-workspace-switch-create ,i))))
+
+ ;; buffer and window management
+ (exwm-input-set-key (kbd "s-<tab>") 'next-buffer)
+
+ (defvar exwm-last-workspace-index 0)
+ (defun exwm-last-workspace ()
+ (interactive)
+ (let ((temp exwm-workspace-current-index))
+ (exwm-workspace-switch exwm-last-workspace-index)
+ (setq exwm-last-workspace-index temp)))
+
+ (exwm-input-set-key (kbd "s-n") 'ivy-switch-buffer)
+ (exwm-input-set-key (kbd "s-o") 'switch-window)
+ (exwm-input-set-key (kbd "s-\\") 'exwm-last-workspace)
+
+ (exwm-input-set-key (kbd "s-b") 'banish-rat)
+
+ ;; run command
+ (exwm-input-set-key (kbd "s-c") (lambda ()
+ (interactive)
+ (start-process "" nil "st")))
+ (exwm-input-set-key (kbd "s-q") (lambda ()
+ (interactive)
+ (start-process "" nil "firefox-esr")))
+ (exwm-input-set-key (kbd "s-<f2>") (lambda ()
+ (interactive)
+ (start-process "" nil "lock")))
+ (exwm-input-set-key (kbd "s-p") (lambda (command)
+ (interactive (list (read-shell-command "$ ")))
+ (start-process-shell-command command nil command)))
+ ;; Volume
+ (exwm-input-set-key (kbd "s-<f10>")
+ (lambda ()
+ (interactive)
+ (adjust-volume "Speaker" "+")))
+
+ (exwm-input-set-key (kbd "s-<f9>")
+ (lambda ()
+ (interactive)
+ (adjust-volume "Speaker" "-")))
+
+ (exwm-input-set-key (kbd "s-<f8>")
+ (lambda ()
+ (interactive)
+ (adjust-volume "Speaker" "toggle")))
+
+ (exwm-input-set-key (kbd "C-s-<f10>")
+ (lambda ()
+ (interactive)
+ (adjust-volume "Headphone" "+")))
+
+ (exwm-input-set-key (kbd "C-s-<f9>")
+ (lambda ()
+ (interactive)
+ (adjust-volume "Headphone" "-")))
+
+ (exwm-input-set-key (kbd "C-s-<f8>")
+ (lambda ()
+ (interactive)
+ (adjust-volume "Headphone" "toggle")))
+
+ (exwm-input-set-key (kbd "s-<f7>") (lambda ()
+ (interactive)
+ (shell-command "$HOME/bin/backlight_up.sh")
+ (message "Backlight up.")))
+
+ (exwm-input-set-key (kbd "s-<f6>") (lambda ()
+ (interactive)
+ (shell-command "$HOME/bin/backlight_down.sh")
+ (message "Backlight down.")))
+
+ ;; -------------------------------------------------------------------
+ ;; RandR
+
+ (require 'exwm-randr)
+ (exwm-randr-enable)
+
+ (setq exwm-randr-workspace-monitor-plist
+ '(1 "HDMI-1" 0 "eDP-1"))
+
+ (exwm-enable))
+
+;; -----------------------------------------------------------------------------
+;; EXWM-edit
+
+(use-package exwm-edit
+ :ensure t
+ :config
+ (add-hook 'exwm-edit-compose-hook (lambda ()
+ (text-mode))))
diff --git a/emacs/inits/01-basic.el b/emacs/inits/01-basic.el
new file mode 100644
index 0000000..5c66367
--- /dev/null
+++ b/emacs/inits/01-basic.el
@@ -0,0 +1,126 @@
+;; Time-stamp: <2019-09-11 10:19:29 (tslil@basingstoke)>
+
+;; -----------------------------------------------------------------------------
+;; Interface
+
+(tool-bar-mode -1)
+(menu-bar-mode -1)
+(scroll-bar-mode -1)
+(fset 'yes-or-no-p 'y-or-n-p)
+
+(setq select-enable-clipboard t
+ select-enable-primary t
+ save-interprogram-paste-before-kill t
+ require-final-newline t
+ visible-bell nil)
+
+(setq echo-keystrokes 0.1
+ confirm-kill-emacs 'y-or-n-p
+ disabled-command-function nil
+ ring-bell-function 'ignore)
+
+(size-indication-mode t)
+
+(defun enlarge-to-fill ()
+ "Stretch the buffer to accomodate `fill-column` many columns."
+ (interactive)
+ (let ((ww (window-width)))
+ (when (< ww (+ 1 fill-column))
+ (enlarge-window-horizontally (- (+ 1 fill-column) ww)))))
+
+(global-set-key (kbd "C-c 3") (lambda ()
+ (interactive)
+ (split-window-horizontally)
+ (enlarge-to-fill)))
+
+(blink-cursor-mode 0)
+(setq cursor-type 'box)
+(set-cursor-color "black")
+
+(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
+(when (eq 'x (window-system))
+ (load-theme 'zenburn t)
+ (set-face-attribute 'default nil :font "Fira Code-14"))
+
+(set-fringe-style 0)
+;; (set-fringe-mode 128)
+
+;; -----------------------------------------------------------------------------
+;; Backups
+
+(setq backup-by-copying t
+ backup-directory-alist '((".*" . "~/store/backups/"))
+ delete-old-versions t
+ kept-new-versions 6
+ kept-old-versions 2
+ version-control t)
+
+(setq create-lockfiles nil)
+
+;; -----------------------------------------------------------------------------
+;; Defaults
+
+(setq fill-column 80)
+
+(setq standard-indent 2)
+(setq-default tab-width 2
+ indent-tabs-mode nil)
+(add-hook 'before-save-hook #'whitespace-cleanup)
+
+(show-paren-mode t)
+
+(setq-default truncate-lines t
+ truncate-partial-width-windows nil)
+(setq scroll-step 1)
+
+(setq next-line-add-newlines nil)
+
+(setq enable-dir-local-variables nil)
+
+;; -----------------------------------------------------------------------------
+;; Packages
+
+(use-package recentf
+ :demand t
+ :config
+ (setq recentf-max-saved-items 42)
+ (recentf-mode))
+
+(use-package uniquify
+ :config
+ (setq uniquify-buffer-name-style 'forward))
+
+(require 'saveplace)
+(save-place-mode)
+
+(use-package undo-tree
+ :ensure t
+ :config (setq undo-tree-visualizer-timestamps t)
+ (global-undo-tree-mode 1))
+
+(use-package keyfreq
+ :ensure t
+ :config
+ (setq keyfreq-file "~/.emacs.d/keyfreq"
+ keyfreq-file-lock "~/.emacs.d/keyfreq.lock")
+ (keyfreq-mode 1)
+ (keyfreq-autosave-mode 1))
+
+;; -----------------------------------------------------------------------------
+;; Scratch buffer
+
+(defun immortal-scratch ()
+ (if (eq (current-buffer) (get-buffer "*scratch*"))
+ (progn (bury-buffer) nil) t))
+
+(add-hook 'kill-buffer-query-functions 'immortal-scratch)
+
+;; I couldn't figure the config options out, so this is the next best thing
+(defun display-startup-echo-area-message () nil)
+
+(setq initial-scratch-message nil
+ initial-buffer-choice t)
+
+(add-hook 'after-init-hook
+ (lambda ()
+ (setq default-directory "~/")))
diff --git a/emacs/inits/02-modeline.el b/emacs/inits/02-modeline.el
new file mode 100644
index 0000000..58b2cd1
--- /dev/null
+++ b/emacs/inits/02-modeline.el
@@ -0,0 +1,96 @@
+;; Time-stamp: <2019-08-13 14:43:24 (tslil@basingstoke)>
+
+;; -----------------------------------------------------------------------------
+;; Battery status and CPU temperature
+
+(defvar sys-status "")
+(defvar sys-status-cpu-temp-threshold "45")
+
+(defun linux-sys-status ()
+ (let ((bat-s (if (not (file-exists-p "/sys/class/power_supply/sbs-20-000b/uevent")) ""
+ (with-temp-buffer
+ (insert-file-contents "/sys/class/power_supply/sbs-20-000b/uevent")
+ (re-search-forward "POWER_SUPPLY_STATUS=\\(Discharging\\|Charging\\|Full\\)")
+ (let ((status (match-string 1)))
+ (if (string-equal "Full" status) "Full"
+ (let* ((perc (progn
+ (re-search-forward "POWER_SUPPLY_CAPACITY=\\([0-9]+\\)")
+ (match-string 1)))
+ (field (concat "POWER_SUPPLY_TIME_TO_"
+ (if (string-equal "Discharging" status)
+ "EMPTY" "FULL")
+ "_AVG=\\([0-9]+\\)"))
+ (seconds (progn
+ (re-search-forward field)
+ (string-to-number (match-string 1))))
+ (hours (/ seconds 3600))
+ (minutes (/ (- seconds (* hours 3600)) 60)))
+ (format "%s%s%% %dh%dm"
+ (substring status 0 1)
+ perc hours minutes)))))))
+ (temp-s (if (not (file-exists-p "/sys/class/thermal/thermal_zone1/temp")) ""
+ (with-temp-buffer
+ (insert-file-contents "/sys/class/thermal/thermal_zone1/temp")
+ (let ((temp (substring-no-properties (buffer-string) 0 -4)))
+ (if (string-greaterp temp sys-status-cpu-temp-threshold)
+ (concat " " temp "C") ""))))))
+ (if (and (string-blank-p bat-s) (string-blank-p temp-s))
+ "" (format " [%s%s]" bat-s temp-s))))
+
+(defun sys-status-update ()
+ (setq sys-status (linux-sys-status)))
+
+(defvar sys-status-update-timer (run-at-time nil 60 'sys-status-update))
+
+;; -----------------------------------------------------------------------------
+;; Remind me of my mortality
+
+(defun mortality ()
+ (format " %.4f"
+ (/ (float-time
+ (time-subtract (current-time)
+ (encode-time 0 0 0 DAY MONTH YEAR)))
+ (* 60 60 24 364.25))))
+
+;; -----------------------------------------------------------------------------
+;; Mode-line and minibuffer defaults
+
+(use-package minibuffer-line
+ :ensure t
+ :config
+ (setq minibuffer-line-refresh-interval 60
+ minibuffer-line-format
+ '("" (:eval (format-time-string "%d/%H.%M"))
+ display-time-string
+ (sys-status sys-status)
+ (:eval (mortality))
+ " " (:eval (abbreviate-file-name default-directory))))
+ ;; We redefine this function to centre the text
+ ;; Is there a better way?
+ (defun minibuffer-line--update ()
+ (with-current-buffer minibuffer-line--buffer
+ (erase-buffer)
+ (insert (format-mode-line minibuffer-line-format 'minibuffer-line))
+ (setq fill-column (frame-width))
+ (center-line)))
+ (minibuffer-line-mode 1))
+
+;; really want to hook buffer changes at all, and focus
+(add-hook 'minibuffer-exit-hook #'minibuffer-line--update)
+
+(setq global-mode-string nil)
+(setq-default mode-line-format
+ '("" mode-line-front-space
+ mode-line-modified "%@"
+ " %l:%c %[" mode-line-buffer-identification "%] %I"
+ " " mode-line-modes ;; (vc-mode vc-mode)
+ mode-line-misc-info mode-line-end-spaces))
+
+;; -----------------------------------------------------------------------------
+;; Minions to clean mode-line
+
+(use-package minions
+ :ensure t
+ :config
+ (setq minions-mode-line-lighter ":")
+ (minions-mode 1))
diff --git a/emacs/inits/03-miscload.el b/emacs/inits/03-miscload.el
new file mode 100644
index 0000000..2ac2f54
--- /dev/null
+++ b/emacs/inits/03-miscload.el
@@ -0,0 +1,17 @@
+;; Time-stamp: <2019-01-26 12:49:48 (tslil@winslow)>
+
+;;(add-to-list 'load-path (expand-file-name "~/.emacs.d/scripts/"))
+
+(add-to-list 'load-path (expand-file-name "~/.emacs.d/scripts/siege-mode"))
+(autoload 'siege-mode "siege-mode" nil t)
+
+;; (use-package siege-mode
+;; :defer t
+;; :load-path "/home/tslil/.emacs.d/scripts/siege-mode/siege-mode.el")
+
+(use-package imaxima
+ :defer t
+ :config (setq imaxima-use-maxima-mode-flag t))
+
+(use-package notmuch
+ :defer t)
diff --git a/emacs/inits/04-input_method.el b/emacs/inits/04-input_method.el
new file mode 100644
index 0000000..b463ff6
--- /dev/null
+++ b/emacs/inits/04-input_method.el
@@ -0,0 +1,14 @@
+;; Time-stamp: <2019-09-11 11:26:28 (tslil@basingstoke)>
+
+(use-package agda-input
+ :load-path "~/.emacs.d/scripts/"
+ :config
+ (dolist (sym '(("chimney" "╝")
+ ("==>" "⟹")
+ ("amalg" "⨿")
+ ("bG" "𝔾")
+ ("bU" "𝕌")))
+ (add-to-list 'agda-input-user-translations sym))
+ (agda-input-setup))
+
+(setq-default default-input-method "Agda")
diff --git a/emacs/inits/05-helpful.el b/emacs/inits/05-helpful.el
new file mode 100644
index 0000000..f8ac203
--- /dev/null
+++ b/emacs/inits/05-helpful.el
@@ -0,0 +1,17 @@
+;; Time-stamp: <2019-01-26 12:49:57 (tslil@winslow)>
+
+(use-package helpful
+ :ensure t
+ :bind (("C-h f" . helpful-callable)
+ ("C-h v" . helpful-variable)
+ ("C-h k" . helpful-key)
+ ("C-h F" . helpful-function)
+ ("C-c h" . heplful-at-point))
+ :config
+ (advice-add #'describe-key :override #'helpful-key)
+ (advice-add #'describe-function :override #'helpful-callable)
+ (advice-add #'describe-variable :override #'helpful-variable)
+ (advice-add #'describe-symbol :override #'helpful-symbol))
+
+(use-package apropos
+ :config (setq apropos-do-all t))
diff --git a/emacs/inits/06-dashboard.el b/emacs/inits/06-dashboard.el
new file mode 100644
index 0000000..7aae2a0
--- /dev/null
+++ b/emacs/inits/06-dashboard.el
@@ -0,0 +1,30 @@
+;; Time-stamp: <2019-09-11 10:42:40 (tslil@basingstoke)>
+
+(use-package fortune
+ :config
+ (setq fortune-dir "/usr/share/games/fortunes/"
+ fortune-program "fortune"
+ fortune-file "/usr/share/games/fortunes/cookie"
+ fortune-program-options '("-s"))
+ (defun dashboard-fortune (n)
+ (insert
+ (with-temp-buffer
+ (let ((fortune-buffer-name (current-buffer)))
+ (fortune-in-buffer t)
+ (buffer-string))))))
+
+(use-package dashboard
+ :ensure t
+ :config
+ (add-to-list 'dashboard-item-generators '(fortune . dashboard-fortune))
+
+ (setq dashboard-center-content t
+ dashboard-set-init-info t
+ dashboard-set-footer nil
+ dashboard-startup-banner 1
+ dashboard-items '((recents . 5)
+ (projects . 5)
+ (fortune . 0))
+ dashboard-init-info (format "Welcome ~%s!" (user-login-name)))
+
+ (dashboard-setup-startup-hook))
diff --git a/emacs/inits/10-ivy.el b/emacs/inits/10-ivy.el
new file mode 100644
index 0000000..8867bb8
--- /dev/null
+++ b/emacs/inits/10-ivy.el
@@ -0,0 +1,117 @@
+;; Time-stamp: <2019-09-09 22:10:08 (tslil@basingstoke)>
+
+(use-package amx :ensure t)
+
+(use-package counsel :ensure t
+ :after amx
+ :demand
+ :defines (counsel-for-files)
+ :bind (("C-s" . counsel-grep-or-swiper)
+ ("C-x f" . counsel-recentf)
+ ("C-x l" . counsel-locate)
+ ("C-c C-r" . ivy-resume)
+ ("C-c g" . counsel-rg)
+ ("M-x" . counsel-M-x)
+ ("C-s" . swiper-isearch)
+ :map ivy-minibuffer-map
+ ("C-m" . ivy-alt-done)
+ :map swiper-map
+ ("M-%" . swiper-query-replace))
+ :config
+ (setq ivy-use-virtual-buffers nil
+ ivy-display-style 'fancy
+ ivy-initial-inputs-alist nil
+ ivy-format-function 'ivy-format-function-line
+ ivy-count-format "")
+
+ (setq swiper-use-visual-line t)
+
+ (setq counsel-find-file-at-point t
+ counsel-grep-base-command
+ "rg -i -M 120 --no-heading --line-number --color never '%s' %s"
+ counsel-describe-function-function 'helpful-function
+ counsel-describe-variable-function 'helpful-variable)
+
+ (ivy-mode t)
+ (counsel-mode t))
+
+
+(use-package ivy-rich :ensure t
+ :config
+ (setq ivy-rich-path-style 'abbrev
+ ivy-rich-display-transformers-list
+ '(ivy-switch-buffer
+ (:columns
+ ((ivy-rich-candidate (:width 20))
+ (ivy-rich-switch-buffer-size (:width 7 :align right))
+ (ivy-rich-switch-buffer-indicators
+ (:width 2 :face error :align right))
+ (ivy-rich-switch-buffer-major-mode (:width 12 :face warning))
+ (ivy-rich-switch-buffer-project (:width 8 :face success))
+ (ivy-rich-switch-buffer-path
+ (:width (lambda (x)
+ (ivy-rich-switch-buffer-shorten-path
+ x (ivy-rich-minibuffer-width 0.3))))))
+ :predicate (lambda (cand) (get-buffer cand)))
+ counsel-M-x
+ (:columns
+ ((counsel-M-x-transformer (:width 40))
+ (ivy-rich-counsel-function-docstring
+ (:face font-lock-doc-face))))
+ counsel-describe-function
+ (:columns
+ ((counsel-describe-function-transformer (:width 40))
+ (ivy-rich-counsel-function-docstring
+ (:face font-lock-doc-face))))
+ counsel-describe-variable
+ (:columns
+ ((counsel-describe-variable-transformer (:width 40))
+ (ivy-rich-counsel-variable-docstring
+ (:face font-lock-doc-face))))
+ counsel-recentf
+ (:columns
+ ((ivy-rich-candidate (:width 0.8))
+ (ivy-rich-file-last-modified-time
+ (:face font-lock-comment-face))))))
+
+ (ivy-rich-mode 1))
+
+;; (defun limited-counsel-locate-cmd (input)
+;; "Return a shell command based on INPUT."
+;; (counsel-require-program "locate")
+;; (format "locate -l 10 -i --regex '%s'"
+;; (counsel-unquote-regex-parens
+;; (ivy--regex input))))
+
+;; (defun bad ()
+;; (interactive)
+;; (let (process buffer)
+;; (ivy-read "File: "
+;; #'(lambda (input)
+;; (append
+;; '("Recent Files\n" . "")
+;; (recentf-elements 10)
+;; (directory-files default-directory "")
+;; (mapcar (lambda (b) (buffer-name b)) (buffer-list))
+;; (if (< (length input) 3) (counsel-more-chars 3)
+;; ;; (counsel--async-command
+;; ;; (funcall #'limited-counsel-locate-cmd input))
+;; (when process (kill-process process))
+;; (setq process (start-file-process-shell-command
+;; "*locate*"
+;; "*locate*"
+;; (funcall #'limited-counsel-locate-cmd input))))
+;; ))
+;; :dynamic-collection t
+;; :unwind #'(progn (kill-buffer))
+;; :sort nil
+;; :action #'(lambda (x)
+;; (with-ivy-window
+;; (if (file-exists-p x) (find-file x)
+;; (switch-to-buffer x)))))))
+
+;; '(helm-source-recentf
+;; helm-source-file-cache
+;; helm-source-files-in-current-dir
+;; helm-source-buffers-list
+;; helm-source-locate)
diff --git a/emacs/inits/12-company.el b/emacs/inits/12-company.el
new file mode 100644
index 0000000..d514496
--- /dev/null
+++ b/emacs/inits/12-company.el
@@ -0,0 +1,17 @@
+;; Time-stamp: <2019-01-26 12:50:26 (tslil@winslow)>
+
+(use-package company :ensure t
+ :bind (("M-<tab>" . company-complete)
+ :map company-active-map
+ ("C-n" . company-select-next)
+ ("C-p" . company-select-previous))
+
+ :config
+ (setq company-begin-commands '(self-insert-command)
+ company-idle-delay 1
+ company-require-match nil
+ company-show-numbers t
+ company-auto-complete 'company-explicit-action-p
+ company-tooltip-align-annotations t)
+
+ (global-company-mode))
diff --git a/emacs/inits/13-ibuffer.el b/emacs/inits/13-ibuffer.el
new file mode 100644
index 0000000..c46babe
--- /dev/null
+++ b/emacs/inits/13-ibuffer.el
@@ -0,0 +1,70 @@
+;; Time-stamp: <2019-05-26 18:21:05 (tslil@basingstoke)>
+
+(use-package ibuffer
+ :bind (("C-x C-b" . ibuffer))
+ :hook (ibuffer-mode . (lambda ()
+ (ibuffer-switch-to-saved-filter-groups "default")))
+ :config
+ (setq ibuffer-display-summary nil
+ ibuffer-saved-filter-groups
+ '(("default"
+ ("agda" (or (mode . agda2-mode)
+ (name . "^\\*[aA]gda")))
+ ("coq" (or (mode . coq-mode)
+ (mode . coq-goals-mode)
+ (mode . coq-response-mode)
+ (mode . coq-shell-mode)))
+ ("dired" (mode . dired-mode))
+ ("elisp" (or (mode . emacs-lisp-mode)
+ (name . "^\\*Backtrace\\*")))
+ ("emacs" (or (name . "^\\*scratch\\*$")
+ (name . "^\\*Messages\\*$")
+ (name . "^\\*init log\\*$")
+ (name . "^\\*Compile-Log\\*$")))
+ ("exwm" (mode . exwm-mode))
+ ("help" (or (mode . helpful-mode)
+ (name . "^\\*Help\\*$")))
+ ("irc" (mode . rcirc-mode))
+ ("magit" (name . "^magit[:-]"))
+ ("media" (or (mode . image-mode)
+ (mode . doc-view-mode)))
+ ("org" (mode . org-mode))
+ ("REPL" (name . "^\\*.*REPL.*\\*$"))
+ ("slime" (name . "^\\*slime-[^*]*\\*$"))
+ ("tex" (mode . latex-mode))
+ ("web" (or (mode . js2-mode)
+ (mode . js-mode)
+ (mode . html-mode)
+ (mode . css-mode)
+ (mode . mhtml-mode))))))
+
+ (defadvice ibuffer-update-title-and-summary (after remove-column-titles)
+ (with-current-buffer "*Ibuffer*"
+ (read-only-mode -1)
+ (goto-char 1)
+ (search-forward "-\n" nil t)
+ (delete-region 1 (point))
+ (let ((window-min-height 1))
+ ;; save a little screen estate
+ (shrink-window-if-larger-than-buffer))
+ (read-only-mode 1)))
+
+ (ad-activate 'ibuffer-update-title-and-summary)
+
+ (define-ibuffer-column size-h
+ (:name "Size" :inline t)
+ (cond
+ ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
+ ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
+ ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
+ (t (format "%8d" (buffer-size)))))
+
+ (setq ibuffer-formats
+ '((mark modified read-only locked " "
+ (name 18 18 :left :elide)
+ " "
+ (size-h 9 -1 :right)
+ " "
+ (mode 16 16 :left :elide)
+ " "
+ filename-and-process))))
diff --git a/emacs/inits/14-movement.el b/emacs/inits/14-movement.el
new file mode 100644
index 0000000..a1b27f6
--- /dev/null
+++ b/emacs/inits/14-movement.el
@@ -0,0 +1,170 @@
+;; Time-stamp: <2019-08-14 11:59:46 (tslil@basingstoke)>
+
+;; (eval-after-load "tiny-menu"
+;; (progn
+;; (defun hexl-input-smart ()
+;; (hexl-insert-char (0xc-string-to-number (read-string "Input: ")) 1))
+
+;; (setq tiny-menu-forever t
+;; tiny-menu-items '(("hexl-menu"
+;; ("hexl"
+;; ((?i "Insert" hexl-input-smart)
+;; (?b "Byte" hexl-forward-char)
+;; (?e "bytE" hexl-backward-char)
+;; (?s "Short" hexl-forward-short)
+;; (?t "shorT" hexl-backward-short))))
+;; ))))
+
+;; (add-hook 'hexl-mode-hook
+;; (lambda ()
+;; (require '0xc)
+;; (require 'tiny-menu)
+;; (define-key hexl-mode-map (kbd "M-l")
+;; (lambda () (interactive) (tiny-menu "hexl-menu")))))
+
+;; -------------------------------------------------------------------
+;; Repeated key presses for region, deletion, and movement
+
+(use-package expand-region :ensure t
+ :bind ("C-r" . er/expand-region)
+ :config
+ (setq expand-region-fast-keys-enabled t
+ expand-region-contract-fast-key "c"
+ expand-region-reset-fast-key "e"
+ expand-region-autocopy-register "i"))
+
+(use-package viking-mode
+ :disabled
+ :after expand-region
+ :bind (:map viking-mode-map
+ ("C-d" . nil)
+ ("C-c d" . viking-kill-thing-at-point))
+ :config
+ (setq viking-use-expand-region-when-loaded t
+ viking-really-delete nil)
+ (viking-global-mode))
+
+;; (defun goto-begin-dwim ()
+;; "Read the source."
+;; (interactive)
+;; (let ((iter (viking-last-key-repeats))
+;; (lisp (memq major-mode '(emacs-lisp-mode
+;; lisp-mode
+;; scheme-mode
+;; slime-repl-mode))))
+;; (if lisp
+;; (cond
+;; ((= iter 1) (back-to-indentation))
+;; ((= iter 2) (backward-sexp))
+;; ((= iter 3) (beginning-of-defun))
+;; (t (beginning-of-defun 1)))
+;; (cond
+;; ((= iter 1) (back-to-indentation))
+;; ((= iter 2) (beginning-of-line))
+;; ((= iter 3) (backward-paragraph))
+;; (t (goto-char (point-min)))))))
+
+;; (defun goto-end-dwim ()
+;; "Read the source."
+;; (interactive)
+;; (let ((iter (viking-last-key-repeats))
+;; (lisp (memq major-mode '(emacs-lisp-mode lisp-mode scheme-mode slime-repl-mode))))
+;; (if lisp
+;; (cond
+;; ((= iter 1) (end-of-line))
+;; ((= iter 2) (end-of-defun))
+;; (t (end-of-defun 1)))
+;; (if (< (point) (point-at-eol)) (end-of-line)
+;; (forward-paragraph)))))
+
+;; (global-set-key (kbd "C-a") 'goto-begin-dwim)
+;; (global-set-key (kbd "C-e") 'goto-end-dwim)
+
+;; -------------------------------------------------------------------
+;; Window switching
+(use-package switch-window :ensure t
+ :bind (("C-x o" . switch-window)
+ ("C-x C-o" . other-frame)
+ ("C-c o" . switch-window)
+ ("C-c n" . switch-window-then-maximize)
+ :map switch-window-extra-map
+ ("u" . switch-window-mvborder-up)
+ ("e" . switch-window-mvborder-down)
+ ("n" . switch-window-mvborder-left)
+ ("o" . switch-window-mvborder-right)
+ ("i" . nil)
+ ("j" . nil)
+ ("k" . nil)
+ ("l" . nil))
+ :config
+ (setq switch-window-input-style 'minibuffer
+ switch-window-shortcut-style 'qwerty
+ switch-window-multiple-frames nil
+ switch-window-qwerty-shortcuts
+ '("a" "s" "t" "h" "n" "e" "o" "i" "d" "r" "w" "f" "u" "p")))
+
+;; -------------------------------------------------------------------
+;; Character jumping
+(use-package avy
+ :ensure t
+ :demand
+ :bind (("C-," . avy-goto-char-timer)
+ ("C-." . avy-goto-char-in-line)
+ ("M-g s" . avy-goto-word-or-subword-1)
+ ("M-g w" . avy-goto-word-1)
+ ("M-g a" . avy-goto-word-0)
+ ("M-g M-g" . avy-goto-line))
+ :config
+ (setq avy-keys '(?a ?s ?t ?h ?n ?e ?o ?i ?d ?r ?u ?p)
+ avy-dispatch-alist '((?w . avy-action-kill-move)
+ (?W . avy-action-kill-stay)
+ (?j . avy-action-teleport)
+ (?m . avy-action-mark)
+ (?c . avy-action-copy)
+ (?y . avy-action-yank)
+ (?i . avy-action-ispell)
+ (?z . avy-action-zap-to-char))))
+
+;; -------------------------------------------------------------------
+;; General stuff
+
+(global-set-key (kbd "C-M-e") 'end-of-buffer)
+(global-set-key (kbd "C-M-a") 'beginning-of-buffer)
+
+(global-set-key (kbd "M-h") 'backward-kill-word)
+
+(global-set-key (kbd "M-z") 'zap-up-to-char)
+
+;; Fast movement
+(global-set-key (kbd "M-n") 'scroll-up-command)
+(global-set-key (kbd "M-p") 'scroll-down-command)
+
+(global-set-key (kbd "C-S-n")
+ (lambda () (interactive) (ignore-errors (forward-line 5))))
+
+(global-set-key (kbd "C-S-p")
+ (lambda () (interactive) (ignore-errors (forward-line -5))))
+
+(global-set-key (kbd "C-S-f")
+ (lambda () (interactive) (ignore-errors (forward-char 5))))
+
+(global-set-key (kbd "C-S-b")
+ (lambda () (interactive) (ignore-errors (backward-char 5))))
+
+;; Hardcore mode
+(defconst hardcore-nav-mode t)
+(when hardcore-nav-mode
+ (global-set-key (kbd "<right>") nil)
+ (global-set-key (kbd "<left>") nil)
+ (global-set-key (kbd "<up>") nil)
+ (global-set-key (kbd "<down>") nil)
+ (global-set-key (kbd "S-<right>") nil)
+ (global-set-key (kbd "S-<left>") nil)
+ (global-set-key (kbd "S-<up>") nil)
+ (global-set-key (kbd "C-<down>") nil)
+ (global-set-key (kbd "C-<right>") nil)
+ (global-set-key (kbd "C-<left>") nil)
+ (global-set-key (kbd "C-<up>") nil)
+ (global-set-key (kbd "C-<down>") nil)
+ (global-set-key (kbd "<Home>") nil)
+ (global-set-key (kbd "<End>") nil))
diff --git a/emacs/inits/15-project-mgmt.el b/emacs/inits/15-project-mgmt.el
new file mode 100644
index 0000000..8197f99
--- /dev/null
+++ b/emacs/inits/15-project-mgmt.el
@@ -0,0 +1,18 @@
+;; Time-stamp: <2019-04-09 23:20:17 (tslil@bison)>
+
+(use-package projectile
+ :ensure t
+ :bind (("C-c p" . projectile-switch-project)
+ ("C-c f" . projectile-find-file-dwim))
+ :config
+ (projectile-mode 1)
+
+ (setq projectile-completion-system 'ivy
+ projectile-mode-line-prefix ""
+ projectile-mode-line-function '(lambda ()
+ (format " ¶[%s]"
+ (projectile-project-name)))))
+
+(use-package magit
+ :ensure t
+ :bind (("C-x g" . magit-status)))
diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el
new file mode 100644
index 0000000..e2e0494
--- /dev/null
+++ b/emacs/inits/20-programming.el
@@ -0,0 +1,121 @@
+;; Time-stamp: <2019-09-11 11:30:39 (tslil@basingstoke)>
+
+;; -----------------------------------------------------------------------------
+;; General setup
+
+(defadvice compile (around split-horizontally activate)
+ (let ((split-width-threshold 0)
+ (split-height-threshold nil))
+ ad-do-it))
+
+(defadvice compile (after resize-window-properly activate)
+ (let ((ww (window-width)))
+ (when (< ww (+ 5 fill-column))
+ (enlarge-window-horizontally (- (+ 5 fill-column) ww)))))
+
+(defun programming-setup ()
+ (subword-mode 1)
+ (electric-pair-local-mode)
+ ;; Emacs25 compat
+ (if (fboundp 'display-line-numbers-mode)
+ (display-line-numbers-mode)
+ (linum-mode))
+ (setq auto-hscroll-mode t))
+
+(add-hook 'prog-mode-hook #'programming-setup)
+
+;; -----------------------------------------------------------------------------
+;; Specific packages
+
+(use-package shift-number
+ :ensure t
+ :bind (("C-c S-i" . shift-number-up)
+ ("C-c S-d" . shift-number-down)))
+
+(use-package comment-dwim-2
+ :ensure t
+ :bind (("M-;" . comment-dwim-2)))
+
+(use-package aggressive-indent
+ :ensure t
+ :defer t)
+
+(use-package yasnippet
+ :ensure t
+ :defer t)
+
+(use-package elec-pair
+ :defer t
+ :config
+ (setq electric-pair-delete-adjacent-pairs t
+ electric-pair-skip-self t
+ electric-pair-preserve-balance t
+ electric-pair-skip-whitespace t))
+
+(use-package js-comint
+ :ensure t
+ :defer t
+ :config
+ (setq js-comint-program-command "node"
+ js-comint-program-arguments nil))
+
+(use-package js2-mode
+ :ensure t
+ :defer t
+ :after js-comint
+ :mode "\\.js$"
+ :bind (:map js2-mode-map
+ ("TAB" . js2-indent-line)
+ ("C-x C-e" . js-send-last-sexp)
+ ("C-c C-b" . js-send-buffer)
+ ("C-c C-l" . js-load-file))
+ :hook (js2-mode . (lambda ()
+ (auto-revert-mode -1)
+ (yas-minor-mode-on))))
+
+;; What are these?
+;; (setq gdb-show-threads-by-default nil
+;; gdb-many-windows nil
+;; gdb-show-main nil)
+
+
+(use-package flycheck
+ :defer t
+ :ensure t)
+
+(use-package irony
+ :ensure t
+ :defer t
+ :hook (lambda ()
+ (irony-cdb-autosetup-compile-options)
+ (company-irony-setup-begin-commands)))
+
+(use-package cc-mode
+ :defer t
+ :config
+ (c-set-offset 'case-label '+)
+ (setq-default c-basic-offset 2))
+
+(add-hook 'c-mode-hook
+ (lambda ()
+ (irony-mode)
+ (abbrev-mode 0)
+ (flycheck-mode)
+ (flycheck-irony-setup)
+ (c-toggle-hungry-state 1)
+ (c-toggle-electric-state 1)
+ (c-toggle-syntactic-indentation 1)))
+
+(use-package flycheck-rust
+ :after flycheck
+ :ensure t
+ :defer t)
+
+(use-package rust-mode
+ :ensure t
+ :defer t
+ :bind (:map rust-mode-map
+ ("C-c C-c" . rust-compile))
+ :hook (rust-mode . (lambda ()
+ (flycheck-mode)
+ (flycheck-rust-setup))))
diff --git a/emacs/inits/21-functional.el b/emacs/inits/21-functional.el
new file mode 100644
index 0000000..90d0fba
--- /dev/null
+++ b/emacs/inits/21-functional.el
@@ -0,0 +1,75 @@
+;; Time-stamp: <2019-06-03 17:36:44 (tslil@basingstoke)>
+
+;; -----------------------------------------------------------------------------
+;; Haskell
+
+(use-package haskell-mode
+ :ensure t
+ :defer t)
+
+(use-package intero
+ :ensure t
+ :defer t
+ :hook (haskell-mode . (lambda ()
+ (intero-mode)
+ (flycheck-mode -1)))
+ )
+
+;; (use-package ghc :ensure t :defer t)
+
+;; (use-package company-ghc :ensure t :defer t)
+
+;; (use-package company-ghci :ensure t :defer t)
+
+;; (use-package shm :ensure t
+;; :functions structured-haskell-mode
+;; :bind (:map shm-map
+;; ("C-c C-s" . shm/case-split)))
+
+;; (use-package haskell-mode
+;; :ensure t
+;; :after (company-ghc company-ghci shm)
+;; :bind (:map haskell-mode-map
+;; ("[f8]". haskell-navigate-imports)
+;; ("C-c C-c" . haskell-compile)
+;; ("C-c C-z" . haskell-interactive-switch)
+;; ("C-c C-l" . haskell-process-load-file)
+;; ("C-c C-b" . haskell-interactive-switch)
+;; ("C-c C-t" . haskell-process-do-type)
+;; ("C-c C-i" . haskell-process-do-info)
+;; ("C-x C-d" . nil)
+;; ("C-c M-." . nil)
+;; ("C-c C-d" . nil))
+;; :hook ((haskell-interactive-mode . visual-line-mode)
+;; (haskell-mode . (lambda ()
+;; (subword-mode 1)
+;; (aggressive-indent-mode -1)
+;; (require 'shm)
+;; (require 'shm-case-split)
+;; (require 'ghc)
+;; (ghc-init)
+;; (structured-haskell-mode)
+;; ;; (haskell-indentation-mode)
+;; (interactive-haskell-mode)
+;; (turn-on-haskell-doc-mode)
+;; (turn-on-haskell-decl-scan)
+;; (add-to-list 'company-backends 'company-ghc)
+;; (add-to-list 'company-backends 'company-ghci)
+;; ;; (turn-on-haskell-unicode-input-method)
+;; ;; (haskell-mode-stylish-buffer)
+;; )))
+;; :config
+;; (setq haskell-doc-show-global-types t
+;; haskell-doc-show-prelude t
+;; haskell-doc-show-user-defined t
+;; haskell-doc-show-reserved t
+;; haskell-interactive-mode-eval-pretty t
+;; haskell-process-type 'cabal-repl
+;; company-ghc-show-info t
+;; company-ghc-autoscan t
+;; company-ghc-show-module t
+;; haskell-stylish-on-save t
+;; haskell-process-use-presentation-mode t
+;; haskell-process-suggest-imports t
+;; haskell-process-suggest-hoogle-imports t
+;; haskell-process-show-debug-tips nil))
diff --git a/emacs/inits/22-lisp.el b/emacs/inits/22-lisp.el
new file mode 100644
index 0000000..872fe9a
--- /dev/null
+++ b/emacs/inits/22-lisp.el
@@ -0,0 +1,132 @@
+;; Time-stamp: <2019-03-20 17:11:15 (tslil@basingstoke)>
+
+;; ----------------------------------------------------------------------------
+;; Lisp helpers
+
+(defvar lh-pairs '(("(" . ")")
+ ("[" . "]")
+ ("{" . "}")
+ ("<" . ">")
+ ("\"" . "\"")))
+
+(defun lh-forward-delim ()
+ (interactive)
+ (save-match-data
+ (re-search-forward
+ (regexp-opt (mapcar #'cdr lh-pairs)))))
+
+(defun lh-backward-delim ()
+ (interactive)
+ (save-match-data
+ (re-search-backward
+ (regexp-opt (mapcar #'car lh-pairs)))))
+
+(defun lh-matching-delim ()
+ (interactive)
+ (cond
+ ((looking-at (regexp-opt (mapcar #'car lh-pairs)))
+ (forward-sexp))
+ ((looking-back (regexp-opt (mapcar #'cdr lh-pairs)) nil)
+ (backward-sexp))
+ (t (backward-up-list 1 t t))))
+
+(defun lh-slurp-forward ()
+ (interactive)
+ (corral-shift-backward ?\( ?\)))
+
+(defun lh-slurp-backward ()
+ (interactive)
+ (corral-shift-forward ?\( ?\)))
+
+(defun lh-open-parentheses-dwim (arg)
+ (interactive "P")
+ (if (or (= (line-beginning-position) (point))
+ (looking-at "\\Sw")) (insert-parentheses arg)
+ (backward-sexp)
+ (insert-parentheses 1)))
+
+(defun lh-end-of-defun (arg)
+ (interactive "P")
+ (end-of-defun arg)
+ (re-search-backward ")")
+ (forward-char))
+
+(defun lh-avy-open-paren ()
+ (interactive)
+ (avy-goto-char ?\( ))
+
+(defun lh-avy-close-paren ()
+ (interactive)
+ (avy-goto-char ?\) ))
+
+(use-package corral :ensure t)
+(defun make-lisp-bindings ()
+ (let ((map (eval (read (format "%s-map" major-mode)))))
+ (progn
+ (require 'corral)
+ (define-key map (kbd "M-e") 'forward-sexp)
+ (define-key map (kbd "M-a") 'backward-sexp)
+ (define-key map (kbd "M-,") 'lh-backward-delim)
+ (define-key map (kbd "M-.") 'lh-forward-delim)
+ (define-key map (kbd "M-/") 'lh-matching-delim)
+ (define-key map (kbd "C-c (") 'lh-avy-open-paren)
+ (define-key map (kbd "C-c )") 'lh-avy-close-paren)
+ (define-key map (kbd "(") 'lh-open-parentheses-dwim)
+ (define-key map (kbd "C-c r") 'raise-sexp)
+ (define-key map (kbd "C-k") 'kill-sexp)
+ (define-key map (kbd "M-(") 'corral-parentheses-forward)
+ (define-key map (kbd "M-)") 'corral-parentheses-backward)
+ (define-key map (kbd "M-{") 'corral-braces-forward)
+ (define-key map (kbd "M-}") 'corral-braces-backward)
+ (define-key map (kbd "M-[") 'corral-brackets-forward)
+ (define-key map (kbd "M-]") 'corral-brackets-backward)
+ (define-key map (kbd "C-(") 'lh-slurp-forward)
+ (define-key map (kbd "C-)") 'lh-slurp-backward)
+ (define-key map (kbd "M-p") 'beginning-of-defun)
+ (define-key map (kbd "M-n") 'lh-end-of-defun)
+ t)))
+
+;; ----------------------------------------------------------------------------
+;; Mode configurations
+
+(add-hook 'emacs-lisp-mode-hook
+ (lambda ()
+ (eldoc-mode)
+ (aggressive-indent-mode)
+ (make-lisp-bindings)))
+
+(use-package caps-lock-mode
+ :load-path "~/.emacs.d/scripts/")
+
+(use-package slime-company
+ :ensure t :defer t)
+
+(use-package slime
+ :ensure t
+ :after caps-lock-mode
+ :hook ((lisp-mode . (lambda ()
+ (aggressive-indent-mode)
+ (slime-setup '(slime-fancy
+ slime-asdf
+ slime-banner
+ slime-scratch
+ slime-autodoc
+ slime-company))
+ (slime-mode)
+ (require 'caps-lock-mode)
+ (caps-lock-mode)
+ (make-lisp-bindings)))
+ (inferior-lisp-mode-hook . make-lisp-bindings))
+ :config
+ (setq inferior-lisp-program "sbcl")
+
+ (require 'slime-banner)
+ (setq slime-header-line-p nil
+ slime-kill-without-query-p t))
+
+(use-package geiser
+ :ensure t
+ :hook (scheme-mode . (lambda ()
+ (geiser-mode)
+ (aggressive-indent-mode)
+ (make-lisp-bindings))))
diff --git a/emacs/inits/23-text-related.el b/emacs/inits/23-text-related.el
new file mode 100644
index 0000000..8d48795
--- /dev/null
+++ b/emacs/inits/23-text-related.el
@@ -0,0 +1,133 @@
+;; Time-stamp: <2019-07-17 18:18:58 (tslil@basingstoke)>
+
+;; -----------------------------------------------------------------------------
+;; Spelling
+
+(use-package flyspell-correct-ivy
+ :ensure t :defer t)
+
+(use-package flyspell
+ :ensure t
+ :bind (:map flyspell-mode-map
+ ("M-$" . flyspell-correct-wrapper)
+ ("C-," . nil)
+ ("C-." . nil)
+ ("C-\"" . nil))
+ :init
+ (setq ispell-dictionary "british"
+ flyspell-default-dictionary "british"
+ flyspell-correct-interface #'flyspell-correct-ivy))
+
+(setq sentence-end-double-space nil)
+
+(add-hook 'mail-mode-hook (lambda ()
+ (electric-pair-local-mode 1)
+ (turn-on-auto-fill)
+ (flyspell-mode 1)
+ (company-mode 1)))
+
+(add-hook 'text-mode-hook (lambda ()
+ ;; (set-input-method "Adga")
+ (subword-mode 1)
+ (electric-pair-local-mode 1)
+ (turn-on-auto-fill)
+ (siege-mode 1)
+ (flyspell-mode 1)))
+
+(use-package dictionary :ensure t :defer t)
+
+;; -----------------------------------------------------------------------------
+;; Org
+
+(use-package org
+ :defer t
+ :bind (:map org-mode-map
+ ("M-h" . nil))
+ ;; :hook (org-mode . (lambda ()
+ ;; (activate-input-method default-input-method)))
+ :config
+ (setq org-use-sub-superscripts (quote {})
+ org-modules nil))
+
+
+;; -----------------------------------------------------------------------------
+;; Deft
+
+(use-package deft
+ :ensure t
+ :defer t
+ :commands (deft)
+ :bind (("C-z" . deft-take-note)
+ ("C-c C-z" . deft))
+ :config
+ (setq deft-default-extension "org"
+ deft-directory "~/store/notes"
+ deft-use-filename-as-title nil
+ deft-use-filter-string-for-filename t
+ deft-file-naming-rules '((noslash . "_")
+ (nospace . "_")
+ (case-fn . downcase))
+ deft-org-mode-title-prefix t)
+
+ (defvar deft-take-note-pre-grab
+ '((region-thing . (let ((r (if (region-active-p)
+ (buffer-substring (region-beginning) (region-end))
+ (thing-at-point 'line))))
+ (if r (concat r "\n") "")))
+ (bfn . (let ((f (buffer-file-name))
+ (b (buffer-name))) (if f f (concat b " (no file associated)")))))
+ "List of pairs of symbol names and (functions evaluating to)
+ strings evaluated before the buffer is created, and made
+ available for deft-take-note-default-contents.")
+
+ (defvar deft-take-note-post-grab '()
+ "List of pairs of symbol names and (functions evaluating to)
+ strings evaluated after the buffer is created, and made
+ available for deft-take-note-default-contents.")
+
+ (defvar deft-take-note-default-contents '(region-thing bfn "\n")
+ "List with string literals and symbols defined in the pre and
+ post grab lists to be inserted into the buffer.")
+
+ (defun deft-take-note ()
+ (interactive)
+ (let ((pre-alist (mapcar #'(lambda (elt) `(,(car elt) . ,(eval (cdr elt))))
+ deft-take-note-pre-grab)))
+ (let ((bn (concat (format-time-string "%Y%m%d-%H:%M:%S.%N-%Z") "."
+ deft-default-extension)))
+ (switch-to-buffer bn)
+ (set-visited-file-name (expand-file-name
+ (concat deft-directory "/" bn)))
+ (let ((complete-alist
+ (append pre-alist
+ (mapcar #'(lambda (elt) `(,(car elt) . ,(eval (cdr elt))))
+ deft-take-note-post-grab))))
+ (mapc #'(lambda (elt) (if (eq (type-of elt) 'string)
+ (insert elt)
+ (insert (cdr (assoc elt complete-alist)))))
+ deft-take-note-default-contents))))))
+
+;; -----------------------------------------------------------------------------
+;; Useful keybinds
+
+(defun vi-open-line-above ()
+ "Insert a newline above the current line and put point at beginning."
+ (interactive)
+ (unless (bolp)
+ (beginning-of-line))
+ (newline)
+ (forward-line -1)
+ (indent-according-to-mode))
+
+(defun vi-open-line-below ()
+ "Insert a newline below the current line and put point at beginning."
+ (interactive)
+ (unless (eolp)
+ (end-of-line))
+ (newline-and-indent))
+
+(global-set-key (kbd "M-o") 'vi-open-line-below)
+(global-set-key (kbd "C-o") 'vi-open-line-above)
+
+(global-set-key (kbd "M-C-+") 'text-scale-increase)
+(global-set-key (kbd "M-C--") 'text-scale-decrease)
diff --git a/emacs/inits/24-latex.el b/emacs/inits/24-latex.el
new file mode 100644
index 0000000..98eb70c
--- /dev/null
+++ b/emacs/inits/24-latex.el
@@ -0,0 +1,146 @@
+;; Time-stamp: <2019-05-27 11:22:10 (tslil@basingstoke)>
+
+(defvar latex-template-dir (expand-file-name "~/academic/typeset/latex-templates"))
+(defun prompt-latex-file-template ()
+ "Check if tex file does not exist or the command was called
+interactively. If neither, prompt to insert from a template
+populated from the directory *latex-template-dir*"
+ (interactive)
+ (when (and (if (file-exists-p (buffer-file-name))
+ (called-interactively-p 'interactive)
+ t)
+ (yes-or-no-p "Insert template?"))
+ (let* ((tfiles (directory-files latex-template-dir nil "\\.tex"))
+ (template (ivy-read "Select template: " tfiles)))
+ (when template
+ (goto-char (point-min))
+ (insert-file-contents (concat latex-template-dir "/" template))
+ (search-forward "begin{document}")
+ (forward-line)
+ (save-buffer)))))
+
+;; Why does this not work?
+;; (use-package cdm-mode
+;; :functions cdm-mode
+;; :defer t
+;; :load-path "~/.emacs.d/scripts/")
+(autoload 'cdm-mode "cdm-mode" nil t)
+
+(use-package company-auctex :ensure t :defer t)
+
+(use-package latex
+ :ensure auctex
+ :bind (:map LaTeX-mode-map
+ ("'" . better-TeX-insert-single-quote)
+ ("TAB" . LaTeX-indent-line))
+ :hook (LaTeX-mode . (lambda ()
+ (require 'company-auctex)
+ (electric-pair-local-mode -1)
+ (flyspell-mode)
+ (turn-on-auto-fill)
+ (cdlatex-mode t)
+ (company-auctex-init)
+ (siege-mode 1)
+ (cdm-mode)
+ (prompt-latex-file-template)))
+ :init
+ (defun better-TeX-insert-single-quote ()
+ (interactive)
+ (let ((old-open TeX-open-quote)
+ (old-close TeX-close-quote))
+ (unwind-protect (progn
+ (setq TeX-open-quote "`"
+ TeX-close-quote "'")
+ (call-interactively 'TeX-insert-quote))
+ (setq TeX-open-quote old-open
+ TeX-close-quote old-close))))
+
+ :config
+ (add-to-list 'LaTeX-indent-environment-list
+ '("diagram"))
+ (add-to-list 'LaTeX-indent-environment-list
+ '("diagram*"))
+
+
+ (add-to-list 'TeX-command-list '("XeLaTeX" "xelatex %t" TeX-run-TeX nil
+ (latex-mode doctex-mode)
+ :help "Run XeLaTeX"))
+
+ (setq TeX-electric-sub-and-superscript t
+ TeX-electric-math '("$" . "$")
+ TeX-electric-escape nil
+ LaTeX-electric-left-right-brace t)
+
+ (setq-default TeX-master nil)
+ (setq TeX-auto-save t
+ TeX-parse-self t
+ TeX-PDF-mode t
+ TeX-source-correlate-mode nil
+ TeX-view-program-selection '( ((output-dvi style-pstricks) "dvips and gv")
+ (output-dvi "xdvi")
+ (output-pdf "Zathura")
+ (output-html "xdg-open"))))
+
+
+(use-package cdlatex
+ :ensure t
+ :bind (:map cdlatex-mode-map
+ ("(" . nil)
+ ("{" . nil)
+ ("[" . nil)
+ ("|" . nil)
+ ("<" . nil)
+ ("$" . nil)
+ ("'" . nil)
+ ("TAB" . nil)
+ ;; ("TAB" . cdlatex-tab)
+ ("C-c e" . cdlatex-environment)
+ ("~" . cdlatex-math-modify)
+ ("`" . cdlatex-math-symbol))
+ :init
+ (setq cdlatex-math-modify-prefix ?~
+ cdlatex-math-symbol-prefix ?`
+ cdlatex-math-modify-alist '((?a "\\mathbb" nil t nil nil)
+ (?c "\\mathcal" "\\textsc" t nil nil)
+ (?t "\\trm" "\\trm" t nil nil)
+ (?y "\\ty" "\\ty" t nil nil)
+ (?v "\\texttt" "\\texttt" t nil nil)
+ (?u "\\tyu" "\\tyu" t nil nil)
+ (?k "\\mathfrak" nil t nil nil)
+ (?` nil "`'" t nil nil)
+ (?- "\\overline" nil t nil nil)
+ (?_ "\\underline" nil t nil nil))
+ cdlatex-math-symbol-alist '((?% ("\\widehat{?}" "\\hat{?}"))
+ (?' ("^{\\prime}" "\\prime"))
+ (?* ("\\times" "\\otimes" "\\star"))
+ (?+ ("+" "\\oplus"))
+ (?- ("\\vdash" "\\setminus" "\\triangle"))
+ (?. ("\\sq" "\\circ" "\\cdot"))
+ (?0 ("\\emptyset" "\\circ"))
+ (?\; ("\\col"))
+ (?< ("\\leftarrow" "\\leftharpoonup" "\\xleftarrow"))
+ (?> ("\\to" "\\rightharpoonup" "\\xrightarrow"))
+ (?B ("\\bullet"))
+ (?C ("\\widecheck{?}" "\\check{?}"))
+ (?F ("\\Phi" "\\Varphi"))
+ (?M ("\\begin{bsmallmatrix}?\\end{bsmallmatrix}"))
+ (?P ("\\Prod{?}" "\\Pi" "\\partial"))
+ (?S ("\\Sum{?}" "\\Sigma" "\\arcsin"))
+ (?\"("^{\\prime\\prime}" "\\prime\\prime"))
+ (?a ("\\alpha" "\\cap" "\\sqcap"))
+ (?c ("\\cat{?}" "\\catn{?}"))
+ (?e ("\\varepsilon" "\\epsilon" "\\exp{?}"))
+ (?i ("\\iota" "\\in"))
+ (?j ("{\\id^{h}}_{?}" "{\\id^{v}}_{?}"))
+ (?r ("\\rho" "\\varrho" "\\restrict{?}"))
+ (?u ("\\upsilon" "\\cup" "\\sqcup"))
+ (?{ ("\\subseteq" "\\subsetneq"))
+ (?} ("\\supseteq" "\\supsetneq"))
+ )))
+
+(use-package doc-view
+ :defer t
+ :functions doc-view-mode
+ :hook (doc-view-mode . auto-revert-mode)
+ :config (setq doc-view-resolution 300
+ doc-view-continuous t))
diff --git a/emacs/inits/25-theorems.el b/emacs/inits/25-theorems.el
new file mode 100644
index 0000000..ed3619d
--- /dev/null
+++ b/emacs/inits/25-theorems.el
@@ -0,0 +1,124 @@
+;; Time-stamp: <2019-09-11 13:59:30 (tslil@basingstoke)>
+
+;; -----------------------------------------------------------------------------
+;; Coq
+
+;; (defvar pg-inserted-newline nil)
+;; (defconst pg-whitespace-match "[ \\t]")
+;; (defconst pg-subgoal-match "[*+\\-]")
+
+;; (defun pg-move-point-dwim ()
+;; (interactive)
+;; ;; Did we move to a blank new line?
+;; (when (= (point) (point-at-bol))
+;; ;; If there's nothing here, lets add another line below
+;; (when (looking-at-p (concat pg-whitespace-match "*$"))
+;; (save-excursion (newline))
+;; (setq pg-inserted-newline t))
+;; ;; Now let's work out where the point should go
+;; (previous-line)
+;; (beginning-of-line)
+;; ;; Is the previous line essentially a subgoal marker?
+;; (if (looking-at-p (concat pg-whitespace-match "*"
+;; pg-subgoal-match "+"
+;; pg-whitespace-match "*$"))
+;; ;; If so, trim the line and put the point in after the subgoal marker
+;; (progn
+;; (delete-trailing-whitespace (point-at-bol) (point-at-eol))
+;; (end-of-line)
+;; (insert-char ? ))
+;; ;; If not, go back to where we were and indent
+;; (next-line)
+;; (indent-for-tab-command))))
+
+(defconst coq-env '(("UniMath"
+ :topdir "~/theorems/coq/UniMath/"
+ :binary "sub/coq/bin/coqtop"
+ :args ("-coqlib" "/home/tslil/theorems/coq/UniMath/sub/coq/"
+ "-emacs" "-noinit"
+ "-indices-matter"
+ "-type-in-type" "-w" "-notation-overridden"
+ "-Q" "/home/tslil/theorems/coq/UniMath/UniMath" "UniMath"
+ "-Q" "/home/tslil/academic/proof_relevant_cats/formalisation" "wCats"))
+ ("HoTT"
+ :topdir "~/theorems/coq/HoTT/"
+ :binary "hoqtop"
+ :args nil)))
+
+(defvar use-coq-env "UniMath")
+
+(use-package proof-general
+ :ensure t
+ :defer t
+ :functions coq-local-environment
+ :init (setq proof-splash-enable nil
+ proof-follow-mode 'followdown)
+ ;; It's really annoying to have the code truncated due to equal
+ ;; division ratios of the windows. The 5 is to accomodate line
+ ;; numbers and the like
+ (defadvice proof-layout-windows (after resize-window-properly activate)
+ (let ((ww (window-width)))
+ (when (< ww (+ 5 fill-column))
+ (enlarge-window-horizontally (- (+ 5 fill-column) ww)))))
+ (defun coq-local-environment ()
+ (bind-key "C-s" #'isearch-forward proof-mode-map)
+ (let* ((data (alist-get use-coq-env coq-env nil nil #'string-equal))
+ (topdir (expand-file-name (plist-get data :topdir)))
+ (binary (plist-get data :binary))
+ (args (plist-get data :args)))
+ ;; TAGS
+ (visit-tags-table (concat topdir "TAGS"))
+ ;; Formatting
+ (setq fill-column 70)
+ (set-fringe-mode 0)
+ (make-local-variable 'before-save-hook)
+ (add-hook 'before-save-hook 'delete-trailing-whitespace)
+ (setq proof-three-window-mode-policy 'hybrid
+ proof-layout-windows-on-visit-file t
+ proof-shrink-windows-tofit t
+ proof-script-fly-past-comments t)
+ ;; Tweak syntax table
+ ;; (modify-syntax-entry ?' "w")
+ ;; Coq binary related
+ (dolist (var '(coq-use-project-file coq-prog-args coq-prog-name))
+ (make-local-variable var))
+ (setq coq-use-project-file nil
+ coq-prog-args args
+ coq-prog-name (concat topdir binary))
+ (agda-input-setup)
+ (activate-input-method "Agda")))
+ :mode ("\\.v$" . coq-mode)
+ :hook (coq-mode . (lambda ()
+ (programming-setup)
+ (coq-local-environment)
+ (auto-fill-mode)
+ (company-coq-mode))))
+
+(use-package company-coq
+ :after proof-general
+ :ensure t
+ :bind (:map company-coq-map
+ ("M-." . xref-find-references)
+ ("M-*" . pop-tag-mark))
+ :init
+ (setq company-coq-disabled-features '(hello)))
+
+;; -----------------------------------------------------------------------------
+;; Agda
+
+(load-file (let ((coding-system-for-read 'utf-8))
+ (shell-command-to-string "agda-mode locate")))
+
+(add-hook 'agda2-mode
+ (lambda ()
+ (subword-mode 1)
+ (auto-fill-mode)
+ (aggressive-indent-mode -1)))
+
+;; -----------------------------------------------------------------------------
+;; Lean
+
+;; (use-package lean-mode
+;; :ensure t
+;; :defer t
+;; :mode ("\\.lean$" . lean-mode))
diff --git a/emacs/inits/30-irc.el b/emacs/inits/30-irc.el
new file mode 100644
index 0000000..7d3566f
--- /dev/null
+++ b/emacs/inits/30-irc.el
@@ -0,0 +1,45 @@
+;; Time-stamp: <2019-01-26 12:55:41 (tslil@winslow)>
+
+(use-package rcirc
+ :ensure t
+ :defer
+ :hook (rcirc-mode . (lambda ()
+ (rcirc-track-minor-mode)
+ (flyspell-mode-on)
+ (set (make-local-variable 'scroll-conservatively) 8192)))
+ :config
+ (use-package rcirc-color
+ :ensure t
+ :if (window-system))
+
+ (require 'auth-source)
+
+ (defadvice rcirc (before rcirc-read-from-authinfo activate)
+ (unless arg
+ (dolist (p (auth-source-search :port '("nickserv"
+ "bitlbee"
+ "quakenet")
+ :require '(:port :user :secret)))
+ (let ((secret (plist-get p :secret))
+ (method (intern (plist-get p :port))))
+ (add-to-list 'rcirc-authinfo
+ (list (plist-get p :host)
+ method
+ (plist-get p :user)
+ (if (functionp secret)
+ (funcall secret)
+ secret)))))))
+
+ (setq rcirc-default-full-name "tslil"
+ rcirc-default-nick "maximum_yellow"
+ rcirc-default-user-name "maximum_yellow"
+ rcirc-time-format "%Y-%m-%d %H:%M "
+ rcirc-log-directory "~/irc/"
+ rcirc-fill-column 80
+ rcirc-log-flag t
+ rcirc-server-alist
+ '(("irc.freenode.net"
+ :port 6697
+ :encryption tls
+ :channels ("#emacs" "#guix")
+ ))))
diff --git a/emacs/inits/50-file-assocs.el b/emacs/inits/50-file-assocs.el
new file mode 100644
index 0000000..0024f1a
--- /dev/null
+++ b/emacs/inits/50-file-assocs.el
@@ -0,0 +1,20 @@
+;; Time-stamp: <2019-09-11 11:29:16 (tslil@basingstoke)>
+
+(use-package gnuplot-mode
+ :ensure t
+ :mode "\\.gnp$")
+
+(use-package scad-mode
+ :ensure t
+ :mode "\\.scad$")
+
+(setq auto-mode-alist
+ (append
+ '(("\\.emacs$" . emacs-lisp-mode)
+ ("\\.scm$" . scheme-mode)
+ ("\\.sch$" . scheme-mode)
+ ("\\.sc$" . scheme-mode)
+ ("\\.cl$" . lisp-mode)
+ ("\\.py$" . python-mode)
+ ("\\.pg$" . perl-mode)
+ ) auto-mode-alist))
diff --git a/emacs/inits/60-misc-configs.el b/emacs/inits/60-misc-configs.el
new file mode 100644
index 0000000..dd51a20
--- /dev/null
+++ b/emacs/inits/60-misc-configs.el
@@ -0,0 +1,22 @@
+;; Time-stamp: <2019-03-11 11:02:27 (tslil@basingstoke)>
+
+(use-package dired
+ :defer t
+ :config
+ (setq dired-listing-switches "--group-directories-first -alh"
+ dired-auto-revert-buffer t
+ dired-dwim-target t
+ ;; ???
+ ;; dired-guess-shell-alist-user '(("\\.djvu\\'" "zathura")
+ ;; ("\\.pdf\\'" "zathura")
+ ;; ("\\.ps\\'" "zathura"))
+ ))
+
+(use-package browse-url
+ :defer t
+ :config
+ (setq browse-url-generic-program "firefox-esr"
+ browse-url-browser-function '(("." . browse-url-generic))))
+
+(setq backup-directory-alist `((".*" . ,temporary-file-directory))
+ auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
diff --git a/emacs/inits/70-global-keybinds.el b/emacs/inits/70-global-keybinds.el
new file mode 100644
index 0000000..92ae2fe
--- /dev/null
+++ b/emacs/inits/70-global-keybinds.el
@@ -0,0 +1,32 @@
+;; Time-stamp: <2019-08-25 21:44:55 (tslil@basingstoke)>
+
+(setq time-stamp-active t
+ time-stamp-line-limit 3
+ time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u@%s)")
+
+(add-hook 'before-save-hook #'time-stamp)
+
+(defun insert-timestamp ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (unless (search-forward "Time-stamp: "
+ (line-beginning-position (1+ time-stamp-line-limit))
+ t)
+ (goto-char (point-min))
+ (newline)
+ (beginning-of-line 0)
+ (comment-dwim nil)
+ (insert (concat "Time-stamp: " "<>"))
+ (newline))
+ (time-stamp)))
+(global-set-key (kbd "C-x t") 'insert-timestamp)
+
+(global-set-key (kbd "<f11>") 'notmuch)
+(global-set-key (kbd "C-x m") 'eshell)
+(global-set-key (kbd "C-c c") 'shell)
+(global-set-key (kbd "C-x e") 'eval-expression)
+
+(global-set-key (kbd "M-i") 'indent-region)
+
+(global-set-key (kbd "C-v") 'delete-indentation)
diff --git a/emacs/inits/99-last.el b/emacs/inits/99-last.el
new file mode 100644
index 0000000..dc6db7d
--- /dev/null
+++ b/emacs/inits/99-last.el
@@ -0,0 +1,7 @@
+;; Time-stamp: <2019-01-26 12:56:04 (tslil@winslow)>
+
+(add-hook 'after-init-hook
+ (lambda ()
+ (run-with-idle-timer 20 nil (lambda () (setq gc-cons-threshold 8000000)))))
+
+(setq file-name-handler-alist old-file-name-handler-alist)
diff --git a/emacs/notmuch-config.el b/emacs/notmuch-config.el
new file mode 100644
index 0000000..d916c3d
--- /dev/null
+++ b/emacs/notmuch-config.el
@@ -0,0 +1,244 @@
+;; ===================================================================
+;; Generic mail stuff
+(setq user-full-name "tslil clingman"
+ user-mail-address "email"
+ mail-signature-file "~/.signature")
+
+(setq notmuch-fcc-dirs '(("email" . "folder")))
+
+;; ===================================================================
+;; SMTP server configuration
+(setq message-send-mail-function 'smtpmail-send-it
+ send-mail-function 'smtpmail-send-it
+ mail-user-agent 'message-user-agent
+ smtpmail-auth-credentials "~/.authinfo.gpg"
+ smtpmail-smtp-server "server"
+ smtpmail-smtp-service 465
+ smtpmail-stream-type 'ssl)
+
+(defconst smtp-from-server-alist '(("account" . "server")))
+
+(defun set-smtp-server ()
+ (let ((server (or (cdr (assoc (save-restriction
+ (message-narrow-to-headers)
+ (message-fetch-field "from"))
+ smtp-from-server-alist))
+ "posteo.de")))
+ (setq smtpmail-smtp-server server
+ smtpmail-stream-type 'ssl
+ smtpmail-smtp-service 465)
+ (when (string-equal server "smtp.office365.com")
+ (setq smtpmail-stream-type 'starttls
+ smtpmail-smtp-service 587))
+ (message "SMTP server changed to %s" server)))
+
+;; ===================================================================
+;; Crypto and related
+(setq gnutls-min-prime-bits 2048
+ mm-verify-option 'always
+ mm-decrypt-option 'always
+ mml-secure-method "pgpmime"
+ mml-default-sign-method "pgpmime"
+ notmuch-crypto-process-mime t)
+
+(defmacro secure-or-send (&rest body)
+ `(quote (lambda ()
+ (interactive)
+ (set-smtp-server)
+ ,@(mapcar #'list body)
+ (notmuch-mua-send-and-exit))))
+
+(define-key notmuch-message-mode-map (kbd "C-c C-S-c") 'message-send-and-exit)
+(define-key notmuch-message-mode-map (kbd "C-c C-c") (secure-or-send mml-secure-sign))
+(define-key notmuch-message-mode-map (kbd "C-c M-c") (secure-or-send mml-secure-encrypt))
+
+;; ===================================================================
+;; bbdb stuff
+;; (require 'bbdb)
+;; (bbdb-initialize)
+
+;; (setq bbdb-file "~/.bbdb"
+;; bbdb-completion-list t
+;; bbdb-complete-mail t
+;; bbdb-mail-user-agent 'message-user-agent
+;; bbdb-complete-mail-allow-cycling t
+;; bbdb-mua-pop-up nil
+;; bbdb-mua-auto-update-p t)
+
+;; (add-hook 'notmuch-message-mode-hook (lambda ()
+;; (add-to-list 'company-backends 'company-bbdb)))
+
+;; ===================================================================
+;; notmuch-hello bindings
+(setq notmuch-saved-searches '(list-of-things))
+
+(defvar notmuch-hello-tree-searches '(("u" . "tag:unread")
+ ("s" . "tag:sent")
+ ("f" . "tag:flagged")
+ ("i" . "tag:inbox")
+ ("*" . "*"))
+ "List of (key . query) pairs to bind in notmuch-hello.")
+
+(defvar notmuch-tag-keys '(("d" . '("+deleted"))
+ ("u" . '("-deleted"))
+ ("t" . nil))
+ "List of (key . '(tags list)) pairs to bind in tree and search modes.")
+
+(defmacro make-binds (mode-map binds argfunc &rest body)
+ "Create keybindings in `mode-map' using a list of (keystr . arg)
+pairs in `binds' of the form ( ... (argfunc arg) body)."
+ `(progn ,@(mapcar (lambda (pair)
+ `(define-key ,mode-map (kbd ,(car pair))
+ (lambda () (interactive) (,argfunc ,(cdr pair)) ,@body)))
+ (eval binds))))
+
+;;(define-key notmuch-show-mode-map (kbd "R") 'notmuch-show-reply)
+;;(define-key notmuch-show-mode-map (kbd "r") 'notmuch-show-reply-sender)
+(define-key notmuch-search-mode-map (kbd "R") 'notmuch-search-reply-to-thread)
+(define-key notmuch-search-mode-map (kbd "r") 'notmuch-search-reply-to-thread-sender)
+(define-key notmuch-tree-mode-map (kbd "R") (lambda ()
+ (interactive)
+ (notmuch-tree-close-message-window)
+ (notmuch-show-reply)))
+(define-key notmuch-tree-mode-map (kbd "r") (lambda ()
+ (interactive)
+ (notmuch-tree-close-message-window)
+ (notmuch-show-reply-sender)))
+
+
+(define-key notmuch-hello-mode-map (kbd "q")
+ (lambda ()
+ (interactive)
+ (when (timerp offlineimap--timer)
+ (cancel-timer offlineimap--timer))
+ (notmuch-bury-or-kill-this-buffer)))
+
+(make-binds notmuch-hello-mode-map
+ notmuch-hello-tree-searches
+ notmuch-tree)
+
+(make-binds notmuch-show-mode-map
+ notmuch-tag-keys
+ notmuch-show-tag
+ (notmuch-show-next-message))
+
+(make-binds notmuch-tree-mode-map
+ notmuch-tag-keys
+ notmuch-tree-tag
+ (notmuch-tree-next-message))
+
+;; ===================================================================
+;; notmuch-hello widgets and offlineimap integration
+(defun notmuch-hello-header-new ()
+ (setq fill-column (window-width))
+ (let ((widget-link-prefix "")
+ (widget-link-suffix "")
+ (unread (string-to-number (car (process-lines
+ notmuch-command "count" "tag:unread"))))
+ (total (string-to-number (car (process-lines
+ notmuch-command "count")))))
+ (widget-insert "You have ")
+ (widget-create 'link :notify (lambda (&rest nope) (notmuch-hello-update))
+ :help-echo "Update notmuch view"
+ (notmuch-hello-nice-number total))
+ (widget-insert " emails,")
+ (center-line) (widget-insert "\n")
+ (widget-create 'link :notify (lambda (&rest nope) (notmuch-tree "tag:unread"))
+ :help-echo "View unread emails"
+ (notmuch-hello-nice-number unread))
+ (widget-insert (format " of which %s unread."
+ (if (= 1 unread) "is" "are")))
+ (center-line) (widget-insert "\n")))
+
+(defun check-and-notify-new-mail ()
+ (notmuch-hello-update t)
+ (let ((num (string-to-number (car (process-lines
+ notmuch-command "count" "tag:unread")))))
+ (when (< 0 num)
+ (message (format "New mail! (%s)" num)))))
+
+(defun offlineimap-output-filter (process string)
+ "Handle output from offlineimap process."
+ (let ((buff (process-buffer process)))
+ (when (buffer-live-p buff)
+ (with-current-buffer buff
+ (save-excursion
+ (goto-char (point-max))
+ (insert string)))
+ (let ((lines (split-string string "\n+" t)))
+ (cl-loop for line in lines do
+ (when (string-match-p "added to the database" line)
+ (check-and-notify-new-mail)))))))
+
+(defun offlineimap-sentinal (process string)
+ "Handle the termination of the offlineimap process."
+ (when (string-equal "finished\n" string)
+ (let ((buff (process-buffer process)))
+ (when (buffer-live-p buff)
+ (with-current-buffer buff
+ (save-excursion
+ (goto-char (point-max))
+ (insert (format-time-string "--- %d.%m.%y/%H:%M:%S ---\n\n\n"))))))
+ (check-and-notify-new-mail)))
+
+(defun offlineimap-run ()
+ "Run offlineimap and report on results."
+ (let ((proc (start-process "offlineimap-process"
+ "*offlineimap*"
+ "offlineimap")))
+ (set-process-filter proc 'offlineimap-output-filter)
+ (set-process-sentinel proc 'offlineimap-sentinal)))
+
+(defun notmuch-hello-offlineimap ()
+ "Widget to run offlineimap async."
+ (setq fill-column (window-width))
+ (widget-create 'push-button :help-echo "Run offlineimap"
+ :notify (lambda (&rest nope)
+ (offlineimap-run))
+ "Fetch mail")
+ (center-line)
+ (widget-insert "\n"))
+
+(setq notmuch-hello-sections '(notmuch-hello-header-new
+ notmuch-hello-offlineimap
+ notmuch-hello-insert-saved-searches
+ notmuch-hello-insert-search
+ notmuch-hello-insert-alltags))
+
+(add-hook 'notmuch-hello-refresh-hook
+ (lambda ()
+ (goto-char (point-min))
+ (search-forward "You have" nil t)
+ (forward-word)))
+
+(defvar offlineimap--timer nil "Timer for running offlineimap.")
+(defvar offlineimap-use-timer nil "Whether to use a timer for
+running offlineimap (t) or manual (nil).")
+
+(add-hook 'notmuch-hello-mode-hook
+ (lambda ()
+ (when offlineimap-use-timer
+ (when (timerp offlineimap--timer)
+ (cancel-timer offlineimap--timer))
+ (setq offlineimap--timer
+ (run-with-timer 0 300 'offlineimap-run)))))
+
+;; ===================================================================
+;; Message displaying and so on
+(add-to-list 'mm-discouraged-alternatives "text/html")
+(add-to-list 'mm-discouraged-alternatives "text/richtext")
+
+;; I don't actually want w3m anymore
+(setq mm-text-html-renderer 'shr)
+
+(add-hook 'message-mode-hook (lambda ()
+ (turn-on-auto-fill)
+ (flyspell-mode)
+ (company-mode)))
+
+(setq notmuch-tree-result-format '(("date" . "%12s | ")
+ ("authors" . "%-20s")
+ ((("tree" . "%s")
+ ("subject" . "%-10s"))
+ . " | %-54s")
+ ("tags" . "(%s)")))
diff --git a/emacs/scripts/acquiesce.el b/emacs/scripts/acquiesce.el
new file mode 100644
index 0000000..0dcf9fc
--- /dev/null
+++ b/emacs/scripts/acquiesce.el
@@ -0,0 +1,351 @@
+(require 'cl)
+
+(defmacro default (expr default)
+ "If `expr' evaluates to non-null then return the result, otherwise give `default'."
+ (let ((e (gensym)))
+ `(let ((,e ,expr))
+ (if ,e ,e ,default))))
+
+;; =============================================================================
+;; File stuff
+(defun acme--file-p (str)
+ (and (file-exists-p str)
+ (file-readable-p str)
+ (not (car (file-attributes str)))))
+
+(defun acme--recursive-locate-file (regexp start-dir depth)
+ (let ((dirs (list start-dir)) found)
+ (cl-loop
+ while (and (not found) (/= depth 0)) do
+ (let (ndirs)
+ (cl-loop for dir in dirs unless found do
+ (let ((candidates (directory-files-and-attributes
+ dir t
+ directory-files-no-dot-files-regexp)))
+ (cl-loop for file in candidates unless found do
+ (let ((name (nth 0 file))
+ (is-dir (nth 1 file)))
+ (if is-dir (add-to-list 'ndirs name nil nil)
+ (when (string-match-p regexp name)
+ (setq found name) nil))))))
+ (setq depth (1- depth))
+ (setq dirs ndirs)))
+ found))
+
+(defun acme--as-pos-natural (arg)
+ (when arg
+ (if (stringp arg)
+ (unless (string-match-p "[^0-9]" arg)
+ (let ((n (string-to-number arg)))
+ (when (and (> n 0) (integerp n)) n)))
+ (when (and (integerp arg) (> arg 0)) arg))))
+
+(defun acme--parse-as-file (str dir)
+ "Attempt to interpret a string as <head>[:<line>[:<column>]] or
+:[<line>][:<column>] where at least one of <line> or <column> is
+given, and find a file that best represents the string by processing the
+following in order:
+
+ 0. if <head> is not given, assume current file
+ 1. <head> as a file in dir
+ 2. <head> as an absolute path to a file
+ 3. If at least <line> is given, take <head> as a regexp against
+ which to match a file in dir, of which the first match
+ (alphabetically) is taken"
+ (let* ((spl (split-string str ":+?" nil))
+ (line-s (nth 1 spl)) (col-s (nth 2 spl))
+ (line (if line-s (acme--as-pos-natural line-s) 1))
+ (col (if col-s (acme--as-pos-natural col-s) 1))
+ (fn (nth 0 spl)))
+ (when (and line col (> 4 (length spl))
+ (not (string-match-p ".*/$" fn)))
+ (cl-flet ((found (f) (when f (list :LINE line :COL col :FILE f))))
+ (let ((rfn (concat dir fn)))
+ (cond
+ ((or (and line-s line) (and col-s col)) (list :LINE line :COL col :FILE nil))
+ ((acme--file-p rfn) (found rfn))
+ ((acme--file-p fn) (found fn))
+ ((or col-s line-s) (found (acme--recursive-locate-file
+ fn dir
+ acme-find-file-recursive-depth)))
+
+ ))))))
+
+(defun acme--process-file (file)
+ (let ((fname (plist-get file :FILE))
+ (line (plist-get file :LINE))
+ (col (plist-get file :COL)))
+ (when fname (find-file fname))
+ (when line (goto-line line))
+ (when col (forward-char col))))
+
+;; =============================================================================
+;; General magic
+(defmacro return-first (first &rest body)
+ "Execute `first' first, then `body', return whatever `first' did."
+ (let ((val (gensym)))
+ `(let ((,val ,first))
+ ,@body
+ ,val)))
+
+(defun acme--extract-string (&optional count)
+ "Extract a string from the buffer as follows:
+1. If there is a region, use it
+2. If point is at the start of the line, then use the whole line.
+3. Take the previous (count)?count:1 words
+After this, place the point at the end of the appropriate block"
+ (let ((n (default count 1))
+ (p (point))
+ (b (line-beginning-position))
+ (e (line-end-position)))
+ (assert (/= n 0) t)
+ (cond
+ ((use-region-p)
+ (return-first
+ (buffer-substring-no-properties (region-beginning) (region-end))
+ (goto-char (region-end))))
+ ((= p b) (return-first
+ (buffer-substring-no-properties b e)
+ (end-of-line)))
+ (t (let* ((re (default (search-forward " " e t) e))
+ (rs (default (search-backward " " b t n) b)))
+ (return-first
+ (buffer-substring-no-properties rs re)
+ (goto-char re)))))))
+
+;; =============================================================================
+;; Tag window and buffers
+(defun* acme--load-tags (&key (buffer nil) (init nil))
+ "Retrieve or create the tags associated to `buffer' (or
+current-buffer), saving the old tags if we are _changing_
+buffers."
+ (assert (window-live-p acme--tag-window))
+ (assert (buffer-live-p acme--tag-buffer))
+ (let* ((cur-buff (current-buffer))
+ (new-buff (default buffer cur-buff))
+ (existing-tags (assoc new-buff acme--tag-buffers-alist))
+ )
+ (set-buffer acme--tag-buffer)
+ (if (and existing-tags (not init))
+ (setf (cdr (assoc cur-buff acme--tag-buffers-alist))
+ (buffer-string)))
+ (erase-buffer)
+ (if existing-tags (insert (cdr existing-tags))
+ (let ((new-tags (concat default-directory " "
+ (buffer-name new-buff)
+ acme-tag-default-string)))
+ (insert new-tags)
+ (add-to-list 'acme--tag-buffers-alist
+ `(,new-buff . ,new-tags))))))
+
+(defun acme--init-tag-window ()
+ "Initialise the tag window and tag buffer."
+ (when acme--tag-buffer
+ (unless (buffer-live-p acme--tag-buffer)
+ (setq acme--tag-buffer nil)))
+ (when acme--tag-window
+ (unless (window-live-p acme--tag-window)
+ (setq acme--tag-window nil)))
+ (when acme-delete-other-windows (delete-other-windows))
+ (let* ((tag-win (selected-window))
+ (content-win (split-window-vertically 2)))
+ (setq acme--tag-window tag-win
+ ;;window-size-fixed t
+ acme--tag-buffer (find-file acme-tag-buffer-name))
+ (set-window-dedicated-p acme--tag-window t)
+ (select-window content-win)))
+
+(defun acme--get-nth-from-tag (n)
+ "Get the n'th field from the tag, only really useful n<3."
+ (save-current-buffer
+ (set-buffer (cdr (acme--get-tag-buffer)))
+ (nth n (split-string-and-unquote (buffer-string)))))
+
+(defun acme--get-directory-from-tag ()
+ (acme--get-nth-from-tag 0))
+
+(defun acme--get-buffer-name-from-tag ()
+ (acme--get-nth-from-tag 1))
+
+;; =============================================================================
+;; Marking input and output locations
+(defun acme-mark-input (&optional arg)
+ "When the region is active, mark it as the ACME input field,
+otherwise take the current buffer as input. Any argument causes
+the input to be marked as blank."
+ (interactive "P")
+ (setq acme--input-pointer
+ (if arg 'EMPTY
+ (if (region-active-p)
+ (list :BUFFER (current-buffer)
+ :START (region-beginning)
+ :END (region-end))
+ (list :BUFFER (current-buffer)
+ :START 0
+ :END (buffer-size))))))
+
+(defun acme-mark-output (&optional arg)
+ "When the region is active, mark it as the ACME output
+field (thereby consigning it to be replaced by any output),
+otherwise take the current buffer as output. Any argument causes
+the output to be sent to `acme-error-buffer-name' for the
+current directory."
+ (interactive "P")
+ (setq acme--output-pointer
+ (if arg 'EMPTY
+ (if (region-active-p)
+ (list :BUFFER (current-buffer)
+ :START (region-beginning)
+ :END (region-end))
+ (list :BUFFER (current-buffer)
+ :START (point)
+ :END nil)))))
+
+(defun acme-mark-io ()
+ "Mark the current buffer/region as a location for ACME
+I/O (useful for piping through commands, for example)."
+ (interactive)
+ (acme-input-mark)
+ (acme-output-mark))
+
+;; TODO: Overlays so you can see what is what?
+
+(defun acme--execute-command (command)
+ (let* ((list (split-string command))
+ (cmd (car list))
+ (args (combine-and-quote-strings (cdr list)))
+ (out-file (make-temp-file "acme--execute-command-output")))
+ (save-excursion
+ (if (eq acme--input-pointer 'EMPTY)
+ (call-process cmd nil `(:file ,out-file) nil args)
+ (let ((in-file (make-temp-file "acme--execute-command-input")))
+ (set-buffer (plist-get acme--input-pointer :BUFFER))
+ (write-region (plist-get acme--input-pointer :START)
+ (plist-get acme--input-pointer :END)
+ in-file)
+ (call-process cmd in-file `(:file ,out-file) nil args)
+ (delete-file in-file)))
+ (if (eq acme--output-pointer 'EMPTY)
+ (progn
+ (find-file (concat default-directory acme-error-buffer-name))
+ (end-of-buffer))
+ (let ((out-buffer (plist-get acme--output-pointer :BUFFER))
+ (s (plist-get acme--output-pointer :START))
+ (e (plist-get acme--output-pointer :END)))
+ (set-buffer out-buffer)
+ (beginning-of-buffer)
+ (when e (delete-region s e))
+ (goto-char s)))
+ (insert-file out-file)
+ (delete-file out-file))))
+
+$date +%H/%M
+$ls .
+;; Output should start here:
+;; 2
+;; 1
+;; 4
+;; 3
+;; 5
+;; 9
+;; $sort
+$sort
+
+;; =============================================================================
+;; General interface
+(defun acme-do ()
+ "A generic wrapper around opening files, directories, man-pages,
+URLS and other things"
+ (interactive)
+ ;; For now,
+ (acme--process-file
+ (acme--parse-as-file
+ (acme--extract-string)
+ (acme--get-directory-from-tag)))
+ )
+
+(defun acme-execute ()
+ "A DWIM executor. The command to execute is retrieved with
+ `acme--extract-string'.
+
+If the command begins with a $, then it is interpreted as a shell
+command in the following ways:
+
+1. If there is neither input nor output marked then it is
+ executed and the output and errors sent to the buffer
+ `acme-error-buffer-name' for the current directory.
+
+2. Using whatever input is marked (whole buffer or region)
+
+ a. If output is marked as a region, is it overwritten with the
+ result of the command on the input
+
+ b. If output is marked as a buffer, then the result of command
+ on the input is inserted in that buffer at the marked
+ position.
+
+NOTE: When input and output buffers are set to be the same, the
+input region is first sent to the command, and then the output
+region is overwritten.
+
+If the command does not start with a $, then it shipped off to
+eshell where more magic happens.
+"
+
+ (interactive)
+ (let ((str (acme--extract-string)))
+ (if (string-prefix-p "$" str)
+ (acme--execute-command (subseq str 1))
+ (eshell-command str))))
+
+
+(defun acme-init ()
+ ;; TODO: Potentially advise window-deletable-p
+ (acme--init-tag-window)
+ (acme--load-tags :init t)
+ ;;(add-hook 'buffer-list-update-hook 'acme--load-tags)
+ ;;(add-hook 'find-file-hook 'acme--load-tags)
+ )
+
+;; =============================================================================
+;; Variables and customisable stuff
+(defcustom acme-delete-other-windows t
+ "Delete all other windows when starting ACME mode so that the
+tag window is above all others.")
+(defcustom acme-find-file-recursive-depth 3
+ "Maximum folder depth to recursively seek files for `acme-do'")
+(defcustom acme-tag-default-string "Snarf Look Put"
+ "Default tags for new buffers")
+(defcustom acme-tag-buffer-name "+tags"
+ "Name for tags buffer")
+(defcustom acme-error-buffer-name "+errors"
+ "Name for error buffer used for general output")
+
+;; (defvar acme--tag-windows-alist nil)
+(defvar acme--tag-buffers-alist nil)
+(defvar acme--tag-window nil)
+(defvar acme--tag-buffer nil)
+
+(defvar acme--input-pointer nil)
+(defvar acme--output-pointer nil)
+
+;; =============================================================================
+;; Keymap
+(defvar acme-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-c d") 'acme-do)
+ (define-key map (kbd "C-c e") 'acme-execute)
+ (define-key map (kbd "C-c m i") 'acme-mark-input)
+ (define-key map (kbd "C-c m o") 'acme-mark-output)
+ (define-key map (kbd "C-c m b") 'acme-mark-io)
+ map))
+
+;; =============================================================================
+;; Mode definition
+(define-minor-mode acme-mode
+ "ACME-esque magic, but key driven"
+ :lighter " ACME" :keymap acme-mode-map
+ :global t
+ (acme-init))
+
+(provide 'acme-mode)
diff --git a/emacs/scripts/caps-lock-mode.el b/emacs/scripts/caps-lock-mode.el
new file mode 100644
index 0000000..c80883a
--- /dev/null
+++ b/emacs/scripts/caps-lock-mode.el
@@ -0,0 +1,21 @@
+(defvar caps-lock-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [remap self-insert-command] 'upcased-self-insert)
+ map))
+
+(define-minor-mode caps-lock-mode
+ "Caps lock minor mode."
+ nil " CLK" caps-lock-mode-map)
+
+(defun upcased-self-insert (arg)
+ "Insert an uppercase version of the input, unless in a comment or string"
+ (interactive "p")
+ (let* ((syn (syntax-ppss))
+ (comment-or-string (or (nth 4 syn) (nth 3 syn)))
+ (last-command-event (if (and (not comment-or-string)
+ (characterp last-command-event))
+ (upcase last-command-event)
+ last-command-event)))
+ (self-insert-command arg)))
+
+(provide 'caps-lock-mode)
diff --git a/emacs/scripts/cdm-mode.el b/emacs/scripts/cdm-mode.el
new file mode 100644
index 0000000..03fcc76
--- /dev/null
+++ b/emacs/scripts/cdm-mode.el
@@ -0,0 +1,342 @@
+;; Time-stamp: <2019-05-22 19:10:33 (tslil@basingstoke)>
+
+(defvar cdm-arr-type-list '(("arrow" . "a")
+ ("id" . "d")
+ ("proarrow" . "proarrow")
+ ("proid" . "proequal")
+ ("prodotted" . "prodotted")
+ ("2-square" . "sn")
+ ("id-square" . "sd")
+ ("universal" . "u")
+ ("2-cell" . "n")
+ ("3-cell" . "t")
+ ("3-square" . "st")
+ ("parallel" . "p")
+ ("monomorphism" . "m")
+ ("epimorphism" . "e")))
+
+(defvar cdm-parr-dir-list '(("left -> right" . 0)
+ ("right -> left" . 1)
+ ("up -> down" . 2)
+ ("down -> up" . 3)))
+
+(defvar cdm-wrap-list '("diagram" "tikzpicture" "diagram*" "dgrm"))
+
+(defvar cdm--pos-list '("below" "right" "left" "above"
+ "midway" "below right" "below left"
+ "above right" "above left" "none"))
+
+(defvar cdm-cell-len ".3cm")
+
+(defvar cdm--use-helm nil)
+
+(defvar cdm-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-c a") 'cdm-insert-arrow)
+ (define-key map (kbd "C-c n") 'cdm-insert-node)
+ (define-key map (kbd "C-c d") 'cdm-insert-square)
+ (define-key map (kbd "C-c r") 'cdm-square-reset)
+ map))
+
+(defvar cdm--node-list nil)
+(defvar cdm--pos-helm-source nil)
+(defvar cdm--node-helm-source nil)
+(defvar cdm--parr-dir-helm-source nil)
+(defvar cdm--arr-type-helm-source nil)
+
+(defvar cdm--strip-label t)
+
+(defvar cdm--square-progress 0)
+(defvar cdm--square-nodes nil)
+
+(defun cdm--find-enclosing-pair ()
+ (let* ((p (point)) s e
+ (lst (cl-loop
+ for delim in cdm-wrap-list collect
+ (save-excursion
+ (when (and
+ (setq s (search-backward (concat "\\begin{" delim "}") 0 t))
+ (setq e (search-forward (concat "\\end{" delim "}") nil t))
+ (<= s p) (<= p e))
+ (list s e))))))
+ (cl-flet
+ ((nearest (best curr)
+ (if (or (not best)
+ (and curr
+ (> (car curr) (car best))
+ (< (cadr curr) (cadr best))))
+ curr best)))
+ (reduce #'nearest lst :initial-value nil))))
+
+(defun cdm--is-natural (str)
+ (when (and str (string-match "[0-9]+" str))
+ (string-to-number str)))
+
+(defun cdm--sort-p (s1 s2)
+ (let ((n1 (cdm--is-natural (cdr s1)))
+ (n2 (cdm--is-natural (cdr s2))))
+ (if (and n1 n2) (> n1 n2)
+ (string-lessp (cdr s1) (cdr s2)))))
+
+(defun cdm--strip-label-f (str)
+ (let ((strs (split-string str "$+")))
+ (if (and (= 3 (length strs))
+ (string-blank-p (car strs))
+ (string-blank-p (caddr strs)))
+ (cadr strs) str)))
+
+;; TODO: This will probably pick up nodes in the text of other nodes.
+(defun cdm--scan-for-nodes (start end)
+ (save-excursion
+ (setq cdm--node-list nil)
+ (goto-char start)
+ (let (node-start node-end label-start label-end)
+ (while (setq node-start (search-forward "node(" end t))
+ (setq node-end (search-forward ")" end t)
+ label-start (search-forward "{" end t)
+ label-end (progn (backward-char)
+ (ignore-errors (1+ (forward-list)))))
+ (when (and node-end label-start label-end (< 1 (- node-end node-start)))
+ (let* ((temp (if (and label-end label-start (> label-end label-start))
+ (buffer-substring-no-properties label-start (- label-end 2))
+ "This literal will never appear in the list."))
+ (node (buffer-substring-no-properties node-start (1- node-end)))
+ (label (if (string-blank-p temp) (concat node "\t(no label)")
+ (concat (if cdm--strip-label (cdm--strip-label-f temp) temp)
+ "\t(" node ")"))))
+ (push `(,label . ,node) cdm--node-list))))))
+ cdm--node-list)
+
+(defun cdm--get-nodes ()
+ (let ((enclosing-pair (cdm--find-enclosing-pair)))
+ (if enclosing-pair
+ (progn (apply #'cdm--scan-for-nodes enclosing-pair)
+ (setq cdm--node-list (sort (copy-list cdm--node-list) #'cdm--sort-p))
+ (or cdm--node-list t))
+ (error "Not currently in an enclosing diagram environment."))))
+
+(defun cdm--ivy-complete (prompt list)
+ (cdr (assoc-string (ivy-read prompt list) list)))
+
+(defun cdm--complete-nodes (prompt)
+ (if cdm--use-helm (helm :sources cdm--node-helm-source
+ :prompt prompt
+ :buffer "*helm-node*")
+ (cdm--ivy-complete prompt cdm--node-list)))
+
+(defun cdm--complete-position ()
+ (let* ((prompt "Select relative position: ")
+ (p (if cdm--use-helm (helm :sources cdm--pos-helm-source
+ :prompt prompt
+ :buffer "*helm-position*")
+ (ivy-read prompt cdm--pos-list))))
+ (when p
+ (cond
+ ((string-equal "none" p) nil)
+ ((string-equal "midway" p) (concat p ", from= "))
+ (t (concat p " of= "))))))
+
+(defun cdm--complete-arr-type ()
+ (let ((prompt "Select arrow type: "))
+ (if cdm--use-helm (helm :sources cdm--arr-type-helm-source
+ :prompt prompt
+ :buffer "*helm-arrow*"))
+ (cdm--ivy-complete prompt cdm-arr-type-list)))
+
+(defun cdm--not-so-smart-move ()
+ (back-to-indentation)
+ (unless (= (point) (line-end-position))
+ (end-of-line)
+ (newline-and-indent)))
+
+(defun cdm--insert-raw-node (name modifiers content &optional goto)
+ (cdm--not-so-smart-move)
+ (insert "\\node(" name ")[" modifiers "]{" content "};")
+ (when goto (backward-char goto)))
+
+(defun cdm--insert-raw-path (name starting ending modifiers content &optional goto)
+ (cdm--not-so-smart-move)
+ (insert "\\path(" starting ") -- (" ending ")node("
+ name ")[auto=false" modifiers "]{" content "};")
+ (when goto (backward-char goto)))
+
+(defun cdm--next-name ()
+ (when (cdm--get-nodes)
+ (let* ((last-name (cdar cdm--node-list))
+ (last-number (if last-name (string-to-number last-name) 0)))
+ (unless (and (= 0 last-number)
+ last-name)
+ (number-to-string (+ 1 last-number))))))
+
+(defun cdm-insert-node (&optional node-name)
+ (interactive)
+ (let* ((name (or node-name
+ (read-string "New node name: " (cdm--next-name))))
+ (position (cdm--complete-position))
+ (rel-to (when position (cdm--complete-nodes position)))
+ (midway-other (when (and position
+ (string-prefix-p "midway" position))
+ (cdm--complete-nodes "midway, ending="))))
+ (if midway-other
+ (cdm--insert-raw-path name rel-to midway-other ",midway" "$$" 3)
+ (cdm--insert-raw-node name (if rel-to (concat position rel-to) "") "$$" 3))))
+
+(defun cdm--string-good-p (str)
+ (and str (string-or-null-p str) (not (string-blank-p str))))
+
+(defun cdm--insert-arrow-tex (from-node to-node type &optional label-props draw-style misc)
+ (end-of-line)
+ (newline-and-indent)
+ (insert "\\draw[" type
+ (if (cdm--string-good-p draw-style)
+ (concat "," draw-style) "")
+ "]"
+ (if (cdm--string-good-p misc) misc "")
+ "(" from-node ")to"
+ (if label-props
+ (concat " node[" label-props "]{$$}") "")
+ "(" to-node ");")
+ (when label-props (search-backward "$}")))
+
+(defun cdm--insert-arrow-square-tex (from-node to-node type &optional label-props extra)
+ (cdm--insert-arrow-tex "\\p2" "\\p3" type
+ (unless (string-equal type "d")
+ (concat label-props "inner sep=0,swap"))
+ extra
+ (concat "let \\p1 = ($("
+ from-node ")!.5!("
+ to-node ")$), \\p2 = ($(\\p1)!" cdm-cell-len "!("
+ from-node ")$), \\p3 =($(\\p1)!" cdm-cell-len "!("
+ to-node ")$) in ")))
+
+(defun cdm--insert-parallel-arrows (from-node to-node &optional labelled)
+ (let* ((prompt "Select parallel arrow directionality: ")
+ (ty (if cdm--use-helm (helm :sources cdm--parr-dir-helm-source
+ :prompt prompt
+ :buffer "*helm-parr*")
+ (cdm--ivy-complete prompt cdm-parr-dir-list))))
+ (when ty
+ (let ((dirs (case ty
+ (0 '(".east" . ".west" ))
+ (1 '(".west" . ".east" ))
+ (2 '(".south". ".north"))
+ (3 '(".north". ".south"))))
+ (pre-str (concat "[" (if (< ty 2) "y" "x") "shift="))
+ (plus "+0.6ex]")
+ (minus "-0.6ex]")
+ (swaps (if (or (= ty 0) (= ty 2)) '("" . "swap") '("swap" . ""))))
+ (cdm--insert-arrow-tex (concat pre-str plus from-node (car dirs))
+ (concat pre-str plus to-node (cdr dirs))
+ "a" (when labelled (car swaps)))
+ (cdm--insert-arrow-tex (concat pre-str minus from-node (car dirs))
+ (concat pre-str minus to-node (cdr dirs))
+ "a" (when labelled (cdr swaps)))))))
+
+(defmacro let*-unless-null (list &rest body)
+ (if list
+ (let* ((curr (pop list))
+ (dest (car curr))
+ (expr (cadr curr)))
+ `(let ((,dest ,expr))
+ (when ,dest (let*-unless-null ,list ,@body))))
+ `(progn ,@body)))
+
+(defun cdm-insert-arrow (extra-props)
+ (interactive "P")
+ (when (cdm--get-nodes)
+ (unless cdm--node-list
+ (error "Cannot insert an arrow, no nodes found."))
+ (end-of-line)
+ ;; TODO: recast i.t.o let*-unless-null
+ (let ((type (cdm--complete-arr-type)))
+ (when type
+ (let* ((par (string-equal "p" type))
+ (extra (when (and (not par) extra-props)
+ (read-string "Extra properties: ")))
+ (from-node (cdm--complete-nodes "From: "))
+ (to-node (cdm--complete-nodes "To: "))
+ (labelled (unless (string-suffix-p "d" type)
+ (char-equal ?\C-m (read-char "Labelled (Return = yes)?"))))
+ (label-props (when (and (not par) labelled)
+ (read-string "Label properties: "))))
+ (cond
+ (par (cdm--insert-parallel-arrows from-node to-node labelled))
+ ((string-prefix-p "s" type)
+ (cdm--insert-arrow-square-tex from-node to-node
+ (string-remove-prefix "s" type)
+ label-props
+ extra))
+ (t (cdm--insert-arrow-tex from-node to-node type label-props extra))))))))
+
+
+(defun cdm-square-reset ()
+ (interactive)
+ (setq cdm--square-progress 0
+ cdm--square-nodes nil)
+ (message "Square progress reset."))
+
+;; TODO: Orientation? This is broken with swaps if you change orientation...
+(defun cdm--prompt-insert-arrow-square (node-1 node-2 swap)
+ (when (cdm--get-nodes)
+ (let (r d)
+ (dolist (n cdm--node-list)
+ (when (or (string-equal node-1 (cdr n))
+ (string-equal node-2 (cdr n)))
+ (add-to-list 'r n)))
+ (setq cdm--node-list r)
+ (setq d (cdm--complete-nodes "Domain for arrow: "))
+ (if (string-equal d node-1)
+ (cdm--insert-arrow-tex d node-2 "a" swap)
+ (cdm--insert-arrow-tex d node-1 "a" swap)))))
+
+(defun cdm-insert-square ()
+ (interactive)
+ (let ((p cdm--square-progress)
+ (n cdm--square-nodes)
+ (s (cdm--next-name)))
+ ;; Insert stuff
+ (cond
+ ((= p 7) (cdm--prompt-insert-arrow-square (nth 3 n) (nth 1 n) "swap"))
+ ((= p 6) (cdm--prompt-insert-arrow-square (nth 2 n) (nth 0 n) ""))
+ ((= p 5) (cdm--prompt-insert-arrow-square (nth 3 n) (nth 2 n) ""))
+ ((= p 4) (cdm--prompt-insert-arrow-square (nth 1 n) (nth 0 n) "swap"))
+ ((= p 3) (cdm--insert-raw-node s (concat "below of=" (cadr n)) "$$" 3))
+ ((= p 2) (cdm--insert-raw-node s (concat "below of=" (car n)) "$$" 3))
+ ((= p 1) (cdm--insert-raw-node s (concat "right of=" (car n)) "$$" 3))
+ ((= p 0) (cdm-insert-node s)))
+ ;; Adjust state
+ (if (= p 7) (cdm-square-reset)
+ (setq cdm--square-progress (1+ cdm--square-progress))
+ (when (and (<= p 3) (>= p 0))
+ (add-to-list 'cdm--square-nodes s t)))))
+
+(defun cdm--init-helm ()
+ (setq cdm--pos-helm-source (helm-build-sync-source "position"
+ :candidates 'cdm--pos-list
+ :fuzzy-match t
+ :nomark t)
+ cdm--arr-type-helm-source (helm-build-sync-source "arrow-type"
+ :candidates 'cdm-arr-type-list
+ :fuzzy-match t
+ :nomark t)
+ cdm--node-helm-source (helm-build-sync-source "nodes"
+ :candidates 'cdm--node-list
+ :fuzzy-match t
+ :nomark t
+ :multiline t)
+ cdm--parr-dir-helm-source (helm-build-sync-source "parr-dir"
+ :candidates 'cdm-parr-dir-list
+ :fuzzy-match t
+ :nomark t)))
+
+(defun cdm--init ()
+ (require 'subr-x)
+ (require 'cl)
+ (if cdm--use-helm (cdm--init-helm)) )
+
+(define-minor-mode cdm-mode
+ "Minor mode to help with commutative diagrams"
+ :lighter " CDM" :keymap cdm-mode-map
+ (cdm--init))
+
+(provide 'cdm-mode)
diff --git a/emacs/themes/acme-theme.el b/emacs/themes/acme-theme.el
new file mode 100644
index 0000000..ad5baab
--- /dev/null
+++ b/emacs/themes/acme-theme.el
@@ -0,0 +1,148 @@
+;; acme-theme.el -- A theme inspired by the classic colours of the ACME editor.
+;; Copyright (C) 2014 , Tslil Clingman
+
+;; Version: 0.1
+;; Package-Requires: ((emacs "24"))
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;; This file is not part of Emacs.
+
+(deftheme acme
+ "A theme inspired by the classic colours of the ACME editor.")
+
+(let ((bg-yellow "#FFFFCA")
+ (bg-blue "#DAEFEF")
+
+ (lazy "#D1D1C0")
+ (mud "#99994C")
+
+ (yellow "#EAEA9E")
+ (blue "#268BD2")
+ (red "#AA0000")
+ (purple "#8888CC")
+ (green "#508050")
+ (link "#D05000"))
+ (custom-theme-set-faces
+ 'acme
+
+ `(default ((t (:background ,bg-yellow :foreground "black"))))
+ '(cursor ((t (:background "black"))))
+ '(escape-glyph ((t (:foreground "black"))))
+ '(minibuffer-prompt ((t (:foreground "black" :weight bold))))
+ '(highlight ((t (:foreground "grey30"))))
+ `(region ((t (:background ,yellow :foreground "black"))))
+ `(secondary-selection ((t (:background ,red))))
+ '(trailing-whitespace ((t (:background "grey"))))
+
+ '(font-lock-builtin-face ((t (:foreground "black" :slant normal))))
+ '(font-lock-comment-delimiter-face ((default (:inherit (font-lock-comment-face)))))
+ '(font-lock-comment-face ((t (:foreground "black" :slant italic
+ :font "Hack"))))
+ '(font-lock-constant-face ((t (:foreground "black"))))
+ '(font-lock-doc-face ((t (:foreground "black" :slant italic
+ :font "Hack"))))
+ '(font-lock-function-name-face ((t (:foreground "black" :weight bold))))
+ '(font-lock-keyword-face ((t (:foreground "black" :weight bold))))
+ '(font-lock-negation-char-face ((t (:foreground "black"))))
+ '(font-lock-preprocessor-face ((t (:inherit (font-lock-builtin-face)))))
+ '(font-lock-string-face ((t (:foreground "black"))))
+ '(font-lock-type-face ((t (:foreground "black" :underline t))))
+ '(font-lock-variable-name-face ((t (:foreground "black"))))
+ '(font-lock-warning-face ((t (:foreground "black"))))
+
+ '(button ((t (:inherit (link)))))
+ `(link ((t (:underline (:color foreground-color :style line)
+ :foreground ,link))))
+ '(link-visited ((default (:inherit (link)))
+ (((class color) (background light)) (:foreground "magenta4"))
+ (((class color) (background dark)) (:foreground "violet"))))
+
+ `(fringe ((t (:background ,bg-yellow :foreground "black"))))
+ '(header-line ((default (:inherit (mode-line))) (((type tty)) (:underline (:color foreground-color :style line) :inverse-video nil)) (((class color grayscale) (background light)) (:box nil :foreground "grey20" :background "grey90")) (((class color grayscale) (background dark)) (:box nil :foreground "grey90" :background "grey20")) (((class mono) (background light)) (:underline (:color foreground-color :style line) :box nil :inverse-video nil :foreground "black" :background "white")) (((class mono) (background dark)) (:underline (:color foreground-color :style line) :box nil :inverse-video nil :foreground "white" :background "black"))))
+ '(tooltip ((((class color))
+ (:inherit (variable-pitch) :foreground "black" :background "lightyellow"))
+ (t (:inherit (variable-pitch)))))
+
+ `(mode-line ((t (:background ,bg-blue :foreground "black" :box 2))))
+ '(mode-line-buffer-id ((t (:foreground "black" :weight bold))))
+ '(mode-line-emphasis ((t (:foreground "black"))))
+ '(mode-line-highlight ((t (:weight bold :box nil :foreground "black"))))
+ `(mode-line-inactive ((t (:background ,bg-blue :foreground "#393939" :weight normal :box t))))
+
+ `(isearch ((t (:background ,yellow))))
+ `(isearch-fail ((t (:background ,red))))
+ `(lazy-highlight ((t (:foreground "black" :weight bold :background ,bg-blue))))
+ `(match ((t (:background ,yellow))))
+ '(next-error ((t (:inherit (region)))))
+ '(query-replace ((t (:inherit (isearch)))))
+ '(table-cell ((t (:inherit (default)))))
+
+ `(show-paren-match ((t (:weight bold :background ,purple))))
+ `(show-paren-mismatch ((t (:background ,red))))
+ `(sp-show-pair-match-face ((t (:weight bold :background ,purple))))
+ `(sp-show-pair-mismatch-face ((t (:background ,red))))
+
+ '(ivy-modified-buffer ((t (:underline t :inherit (default)))))
+
+ `(company-echo-common ((t (:foreground "black" :background ,bg-blue :weight bold))))
+ `(company-scrollbar-bg ((t (:background "grey"))))
+ `(company-scrollbar-fg ((t (:background ,green))))
+ `(company-tooltip ((t (:foreground "black" :background ,bg-blue))))
+ `(company-tooltip-search ((t (:foreground "black" :background ,yellow))))
+ `(company-tooltip-annotation ((t (:foreground "black" :background "grey" :slant italic))))
+ `(company-tooltip-common ((t (:foreground "black" :weight bold))))
+ `(company-tooltip-common-selection ((t (:foreground "black" :background ,yellow :weight bold))))
+ `(company-tooltip-selection ((t (:background ,yellow :foreground "black"))))
+
+ '(font-latex-bold-face ((t (:weight bold))))
+ '(font-latex-italic-face ((t (:slant italic))))
+ `(font-latex-math-face ((t (:foreground "black"
+ :box (:line-width 2 :color ,lazy
+ :style pressed-button)
+ :foreground "black"))))
+ '(font-latex-string-face ((t (:foreground "black"))))
+ '(font-latex-verbatim-face ((t (:foreground "black"))))
+ '(font-latex-sedate-face ((t (:foreground "black"))))
+ '(font-latex-warning-face ((t (:foreground "black"))))
+ '(font-latex-sectioning-5-face ((t (:foreground "black" :weight normal))))
+
+ `(shm-current-face ((t (:background ,bg-blue))))
+ '(shm-quarantine-face ((t nil)))
+
+ `(avy-goto-char-timer-face ((t (:background ,bg-blue))))
+ `(avy-lead-face ((t (:background ,yellow))))
+ `(avy-lead-face-0 ((t (:background ,green))))
+ `(avy-lead-face-1 ((t (:background ,red))))
+ `(avy-lead-face-2 ((t (:background ,purple))))
+
+ '(company-coq-comment-h1-face ((t (:height 1.8 :slant italic
+ :inherit (default)))))
+ '(company-coq-comment-h2-face ((t (:height 1.4 :slant italic
+ :inherit (default)))))
+ '(company-coq-comment-h3-face ((t (:height 1.2 :slant italic
+ :inherit (default)))))
+ '(company-coq-coqdoc-h1-face ((t (:weight bold :inverse-video t))))
+ '(company-coq-coqdoc-h2-face ((t (:weight bold :underline t))))
+ '(company-coq-coqdoc-h3-face ((t (:underline t))))
+ '(company-coq-coqdoc-h4-face ((t (:inherit (default)))))
+
+ '(company-coq-features/code-folding-bullet-face
+ ((t (:foreground "black" :weight bold))))
+
+ `(coq-solve-tactics-face ((t (:foreground "black" :underline t))))
+ `(proof-tactics-name-face ((t (:foreground "black" :weight bold))))
+ ))
+
+(provide-theme 'acme)
diff --git a/emacs/themes/soothe-theme.el b/emacs/themes/soothe-theme.el
new file mode 100644
index 0000000..d4be92a
--- /dev/null
+++ b/emacs/themes/soothe-theme.el
@@ -0,0 +1,856 @@
+;;; soothe-theme.el --- a dark colorful theme for Emacs24.
+;;; Author: Jason Milkins <jasonm23@gmail.com>
+;;; Changes by Tslil Clingman <tslil.clingman@gmail.com>
+;;; Url: https://github.com/jasonm23/emacs-soothe-theme
+;; Version: 20141104.2213
+;;; X-Original-Version: 0.3.19
+;;; Package-Requires: ((emacs "24.1"))
+;;;
+;;; Change Log:
+;;; 0.3.19 : Filled in some helm stuff and added company tooltips
+;;; 0.3.18 : Added stubs for helm and js3
+;;; 0.3.17 : Added support for which-func face (milkypostman)
+;;; 0.3.16 : Fixed flymake colors; also added Package Requres Emacs 24 by Steve Purcell
+;;; 0.3.15 : update by Sabof; Magit diff settings migrated over to diff
+;;; : (magit will inherit from diff)
+;;; 0.3.14 : Changed main-line colors and style, added powerline colors
+;;; 0.3.13 : Different colors for hl-line and region
+;;; 0.3.12 : Fixed issue #4 - region bg contrast too low.
+;;; 0.3.11 : Added rainbow-mode switch for editing
+;;; 0.3.10 : Themed Mode line emphasis
+;;; 0.3.9 : Slightly improved dired support
+;;; 0.3.8 : Added support for isearch
+;;; : Additional support for mode-line
+;;; : modified main-line colors
+;;; : modified link / link-visited
+;;; : added tooltip face
+;;; 0.3.7 : extended magit support
+;;; : added iedit support
+;;; : added CUA support
+;;; : added AutoComplete support
+;;; : changed rainbow delimiters for better visibility
+;;; 0.3.6 : beginning work on additional mode support
+;;; : added git-gutter
+;;; : added dropdown-list
+;;; : added stubs/extention lists for gnus, rcirc, message
+;;; : ido + magit (more),
+;;; : ac, compilation,
+;;; : dired, diff, iedit,
+;;; : cua, change, Man, woman,
+;;; : commint, info, custom, popup
+;;; : widget, whitespace, w3m, more...
+;;; 0.3.5 : bugfix
+;;; 0.3.4 : added support for main-line and flymake
+;;; 0.3.0 : cleaned up for elpa
+;;; 0.1.0 : initial version
+;;;
+;;; This program is free software: you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, version 3 of the License.
+;;;
+;;; This file is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Emacs.
+;;;
+;;; This file is not a part of Emacs
+;;;
+;;; Commentary: An amalgam of muted color tones and highlighted
+;;; backgrounds. Builtin support for rainbow-delimiters, org-mode,
+;;; whitespace-mode, ECB, flyspell, ido, linum, highlight
+;;; indentation, show-paren-mode, further mode support to come.
+
+(unless (>= 24 emacs-major-version)
+ (error "soothe-theme requires Emacs 24 or later."))
+
+(deftheme soothe
+ "soothe-theme An amalgam of muted color tones and highlighted
+ backgrounds. Has builtin support for rainbow-delimiters,
+ org-mode, whitespace-mode, ECB, flyspell, ido, linum,
+ highlight indentation, show-paren-mode, further mode support
+ to come.")
+
+(let (
+ ;; Palette
+ (foam "#E0E4CC")
+ (snow-code "#ECE5CE")
+ (crem "#F4EAD5")
+ (dirty-crem "#DBD2BF")
+ (dirty-crem-bg "#2B2A26")
+ (gray-1 "#aaaaaa")
+ (gray-2 "#828282")
+ (gray-3 "#333333")
+ (gray-4 "#2a2a2a")
+ (gray-5 "#252525")
+ (gray-6 "#202020")
+ (gray-1bg "#0a0a0a")
+ (gray-2bg "#111111")
+ (gray-3bg "#141414")
+ (gray-4bg "#171717")
+ (gray-5bg "#1a1a1a")
+ (gray-6bg "#1e1e1e")
+ (red-1 "#b13120")
+ (red-2 "#a23f1e")
+ (red-3 "#AA1100")
+ (red-4 "#660000")
+ (red-1bg "#1D1515")
+ (red-2bg "#251c1e")
+ (brown-1 "#8f621d")
+ (brown-1bg "#2a1f1f")
+ (orange-1 "#d94a05")
+ (orange-2 "#FF5211")
+ (orange-1bg "#1F1710")
+ (yellow-1 "#ceae3e")
+ (yellow-1bg "#18140C")
+ (green-1 "#719f34")
+ (green-2 "#3e8f75")
+ (green-3 "#839F5E")
+ (green-1bg "#1a2321")
+ (green-2bg "#1a2321")
+ (turquoise-1 "#01535F")
+ (turquoise-2 "#073E46")
+ (turquoise-1bg "#04181C")
+ (turquoise-2bg "#031316")
+ (blue-1 "#7c9fc9")
+ (blue-2 "#317598")
+ (blue-3 "#009090")
+ (blue-4 "#364e7a")
+ (blue-1bg "#1e252f")
+ (blue-2bg "#1b333e")
+ (blue-3bg "#132228")
+ (blue-4bg "#172028")
+ (purple-1 "#7868b5")
+ (purple-2 "#8A7FB5")
+ (purple-3 "#483E6C")
+ (purple-4 "#342B58")
+ (purple-1bg "#1D1B25")
+ (purple-2bg "#302948")
+ (purple-3bg "#241F36")
+ (selection "#11253a")
+ (hl-line "#11252a")
+ ;; (foreground "#E4DAC5")
+ ;; (background "#110F13")
+ ;; (background-dark "#0F0D11")
+ ;; (alt-background "#111013")
+ (foreground "grey70")
+ (background "#131313")
+ (background-dark "black")
+ (alt-background "#0B0B0E")
+
+ ;; Somewhat stolen from Gotham
+ (base0 "#0c1014")
+ (base1 "#11151c")
+ (base2 "#091f2e")
+ (base3 "#0a3749")
+ (base4 "#245361")
+ (base5 "#599cab")
+ (base6 "grey70")
+ (base7 "grey80")
+
+ )
+
+ ;; Terminal colors - set background to black.
+ ;; TODO: Use defface method (class color) (min-colors ...)
+
+ (unless (window-system)
+ (setq background "#000000")
+ (setq background-dark "#000000")
+ (setq alt-background "#000000")
+ (setq dirty-crem-bg "#000000")
+ (setq gray-1bg "#000000")
+ (setq gray-2bg "#000000")
+ (setq gray-3bg "#000000")
+ (setq gray-4bg "#000000")
+ (setq gray-5bg "#000000")
+ (setq gray-6bg "#000000")
+ (setq red-1bg "#000000")
+ (setq red-2bg "#000000")
+ (setq brown-1bg "#000000")
+ (setq orange-1bg "#000000")
+ (setq yellow-1bg "#000000")
+ (setq green-1bg "#000000")
+ (setq green-2bg "#000000")
+ (setq turquoise-1bg "#000000")
+ (setq turquoise-2bg "#000000")
+ (setq blue-1bg "#000000")
+ (setq blue-2bg "#000000")
+ (setq blue-3bg "#000000")
+ (setq blue-4bg "#000000")
+ (setq purple-1bg "#000000")
+ (setq purple-2bg "#000000")
+ (setq purple-3bg "#000000")
+ )
+
+ (custom-theme-set-faces
+ 'soothe
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Basics
+ `(default ((t (:foreground ,foreground :background ,background ))))
+ `(cursor ((t ( :background ,orange-1 ))))
+ `(region ((t (:foreground nil :background ,selection ))))
+ `(highlight ((t (:foreground ,blue-3 :background ,blue-3bg ))))
+ `(hl-line ((t ( :background ,hl-line ))))
+ `(minibuffer-prompt ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(escape-glyph ((t (:foreground ,red-1 :background ,purple-1bg ))))
+ `(error ((t (:foreground ,red-1 :background ,red-1bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Font-lock stuff
+ `(font-lock-builtin-face ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(font-lock-constant-face ((t (:foreground ,blue-1 :background ,gray-1bg ))))
+ `(font-lock-comment-face ((t (:foreground ,turquoise-2 :background ,alt-background :italic t ))))
+ `(font-lock-comment-delimiter-face ((t (:foreground ,turquoise-1 :background ,alt-background :italic t ))))
+ `(font-lock-doc-face ((t (:foreground ,blue-3 :background ,gray-1bg ))))
+ `(font-lock-doc-string-face ((t (:foreground ,blue-3 :background ,gray-1bg ))))
+ `(font-lock-function-name-face ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(font-lock-keyword-face ((t (:foreground ,orange-2 :background ,orange-1bg ))))
+ `(font-lock-negation-char-face ((t (:foreground ,yellow-1 :background ,yellow-1bg ))))
+ `(font-lock-preprocessor-face ((t (:foreground ,green-1 :background ,green-1bg ))))
+ `(font-lock-string-face ((t (:foreground ,blue-3 :background ,turquoise-2bg ))))
+ `(font-lock-type-face ((t (:foreground ,blue-1 :background ,blue-1bg :bold nil ))))
+ `(font-lock-variable-name-face ((t (:foreground ,green-1 :background ,green-1bg ))))
+ `(font-lock-warning-face ((t (:foreground ,red-2 :background ,red-2bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; UI related
+ `(link ((t (:foreground ,blue-1 :background ,blue-1bg ))))
+ `(link-visited ((t (:foreground ,blue-3 :background ,blue-4bg ))))
+ `(fringe ((t ( :background ,gray-3bg ))))
+ `(vertical-border ((t (:foreground ,gray-4 :background ,background ))))
+ ;; `(mode-line ((t (:foreground ,gray-2 :background ,gray-3bg :box nil :height 120 ))))
+ ;; `(mode-line-inactive ((t (:foreground ,gray-5 :background ,gray-2bg :inherit mode-line ))))
+ ;; `(mode-line-highlight ((t (:foreground ,green-1))))
+ ;; `(mode-line-buffer-id ((t (:foreground ,orange-1))))
+ `(mode-line-emphasis ((t (:bold))))
+ `(which-func ((t (:foreground ,blue-1))))
+
+ `(menu ((t (:background ,base3 :foreground ,base6))))
+ `(header-line ((t (:foreground ,base5 :background ,base2 :weight bold))))
+ `(mode-line ((t (:foreground ,base5 :background ,base2 :box nil))))
+ `(mode-line-inactive ((t (:foreground ,base4 :background ,base1 :box nil))))
+ `(mode-line-highlight ((t (:foreground ,base6))))
+ `(mode-line-buffer-id ((t (:weight bold))))
+
+ ;;`(minibuffer-prompt ((t (:foreground ,orange-1 :background ,orange-1bg :box t))))
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; isearch
+ `(isearch ((t (:foreground ,orange-1 :background ,blue-2bg :underline t))))
+ `(isearch-fail ((t (:foreground ,red-4 :weight bold))))
+ `(lazy-highlight ((t (:foreground ,green-1 :background ,green-1bg :underline t))))
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Compilation mode
+ ;; `(compilation-column-number ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-error ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-info ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-line-number ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-mode-line-exit ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-mode-line-fail ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-mode-line-run ((t (:foreground ,foam :background ,background ))))
+ ;; `(compilation-warning ((t (:foreground ,foam :background ,background ))))
+ ;; `(completions-annotations ((t (:foreground ,foam :background ,background ))))
+ ;; `(completions-common-part ((t (:foreground ,foam :background ,background ))))
+ ;; `(completions-first-difference ((t (:foreground ,foam :background ,background ))))
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Auto Complete
+ ;;
+ `(ac-selection-face ((t (:foreground ,dirty-crem :background ,dirty-crem-bg ))))
+ `(ac-candidate-face ((t (:foreground ,background :background ,dirty-crem ))))
+ `(ac-yasnippet-candidate-face ((t (:foreground ,background :background ,green-2 ))))
+ `(ac-yasnippet-selection-face ((t (:foreground ,foam :background ,dirty-crem-bg ))))
+ `(ac-gtags-candidate-face ((t (:foreground ,background :background ,purple-3 ))))
+ `(ac-gtags-selection-face ((t (:foreground ,dirty-crem :background ,dirty-crem-bg ))))
+ `(ac-candidate-mouse-face ((t (:foreground ,foam :background ,turquoise-1 ))))
+ `(ac-completion-face ((t (:foreground ,snow-code :background ,purple-3bg :underline t ))))
+ ;; used by AC
+ `(popup-tip-face ((t (:foreground ,dirty-crem :background ,dirty-crem-bg ))))
+ `(tooltip ((t (:foreground ,dirty-crem-bg :background ,dirty-crem :height 110 ))))
+
+ ;;; popup-face
+ ;;; popup-isearch-match
+ ;;; popup-menu-face
+ ;;; popup-menu-mouse-face
+ ;;; popup-menu-selection-face
+ ;;; popup-menu-summary-face
+ ;;; popup-scroll-bar-background-face
+ ;;; popup-scroll-bar-foreground-face
+ ;;; popup-summary-face
+
+ ;; ------------------------------------------------------------------------------------------
+ ;; Company
+ `(company-tooltip ((t (:foreground ,blue-1 :background ,blue-4bg))))
+ `(company-tooltip-common-selection ((t (:foreground ,orange-1 :background ,blue-2bg))))
+ `(company-tooltip-selection ((t (:foreground ,orange-1 :background ,blue-2bg))))
+ `(company-tooltip-search ((t (:foreground ,green-1 :background ,green-1bg))))
+ `(company-scrollbar-bg ((t (:background ,blue-1bg))))
+ `(company-scrollbar-fg ((t (:background ,turquoise-1))))
+ `(company-tooltip-common ((t (:foreground ,red-1 :background ,blue-4bg))))
+ `(company-tooltip-annotation ((t (:foreground ,foam :background ,blue-4bg))))
+
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Dired
+ `(dired-directory ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(dired-flagged ((t (:foreground ,red-1 :background ,orange-1bg ))))
+ `(dired-header ((t (:foreground ,orange-1 :background ,background ))))
+ `(dired-ignored ((t (:foreground ,turquoise-1 :background ,background ))))
+ `(dired-mark ((t (:foreground ,orange-2 :background ,background ))))
+ `(dired-marked ((t (:foreground ,green-3 :background ,orange-1bg ))))
+ `(dired-perm-write ((t (:foreground ,foam :background ,background ))))
+ `(dired-symlink ((t (:foreground ,blue-1 :background ,blue-4bg ))))
+ `(dired-warning ((t (:foreground ,red-1 :background ,red-2bg ))))
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Gnus
+
+ ;; gnus-group-mail-1
+ ;; gnus-group-mail-1-empty
+ ;; gnus-group-mail-2
+ ;; gnus-group-mail-2-empty
+ ;; gnus-group-mail-3
+ ;; gnus-group-mail-3-empty
+ ;; gnus-group-mail-low
+ ;; gnus-group-mail-low-empty
+ ;; gnus-group-news-1
+ ;; gnus-group-news-1-empty
+ ;; gnus-group-news-2
+ ;; gnus-group-news-2-empty
+ ;; gnus-group-news-3
+ ;; gnus-group-news-3-empty
+ ;; gnus-group-news-4
+ ;; gnus-group-news-4-empty
+ ;; gnus-group-news-5
+ ;; gnus-group-news-5-empty
+ ;; gnus-group-news-6
+ ;; gnus-group-news-6-empty
+ ;; gnus-group-news-low
+ ;; gnus-group-news-low-empty
+ ;; gnus-splash
+ ;; gnus-summary-cancelled
+ ;; gnus-summary-high-ancient
+ ;; gnus-summary-high-read
+ ;; gnus-summary-high-ticked
+ ;; gnus-summary-high-undownloaded
+ ;; gnus-summary-high-unread
+ ;; gnus-summary-low-ancient
+ ;; gnus-summary-low-read
+ ;; gnus-summary-low-ticked
+ ;; gnus-summary-low-undownloaded
+ ;; gnus-summary-low-unread
+ ;; gnus-summary-normal-ancient
+ ;; gnus-summary-normal-read
+ ;; gnus-summary-normal-ticked
+ ;; gnus-summary-normal-undownloaded
+ ;; gnus-summary-normal-unread
+ ;; gnus-summary-selected
+
+ ;; ------------------------------------------------------------------------------------------
+ ;; helm
+ `(helm-M-x-key ((t (:foreground ,red-1 :background ,red-1bg :underline t))))
+ `(helm-candidate-number ((t (:foreground ,blue-1 :background ,blue-1bg))))
+ `(helm-ff-directory ((t (:foreground ,blue-3 :background nil))))
+ `(helm-ff-executable ((t (:foreground ,green-2 :background nil))))
+ `(helm-ff-file ((t (:foreground ,purple-1 :background nil))))
+ `(helm-ff-invalid-symlink ((t (:foreground ,red-1 :background nil))))
+ `(helm-ff-prefix ((t (:foreground ,turquoise-1 :background nil))))
+ `(helm-ff-symlink ((t (:foreground ,orange-1 :background nil))))
+ `(helm-match ((t (:foreground ,green-1 :background ,green-1bg))))
+ `(helm-selection ((t (:foreground ,orange-2 :background ,blue-4bg :weight bold))))
+ `(helm-source-header ((t (:foreground ,red-1 :background ,red-1bg :box t))))
+ `(helm-buffer-file ((t (:foreground ,purple-1 :background nil))))
+ `(helm-buffer-directory ((t (:foreground ,blue-3 :background nil))))
+ `(helm-buffer-not-saved ((t (:foreground ,red-1 :background nil))))
+ `(helm-buffer-process ((t (:foreground ,orange-1 :background nil))))
+ `(helm-buffer-size ((t (:foreground "salmon" :background nil))))
+ ;; helm-action
+ ;; helm-bookmark-addressbook
+ ;; helm-bookmark-directory
+ ;; helm-bookmark-file
+ ;; helm-bookmark-gnus
+ ;; helm-bookmark-info
+ ;; helm-bookmark-man
+ ;; helm-bookmark-w3m
+ ;; helm-buffer-saved-out
+ ;; helm-buffer-size
+ ;; helm-grep-cmd-line
+ ;; helm-grep-file
+ ;; helm-grep-finish
+ ;; helm-grep-lineno
+ ;; helm-grep-match
+ ;; helm-grep-running
+ ;; helm-header
+ ;; helm-helper
+ ;; helm-history-deleted
+ ;; helm-history-remote
+ ;; helm-moccur-buffer
+ ;; helm-selection-line
+ ;; helm-separator
+ ;; helm-visible-mark
+
+ ;; ------------------------------------------------------------------------------------------
+ ;; JS3 mode
+
+ ;; js3-error-face
+ ;; js3-external-variable-face
+ ;; js3-function-param-face
+ ;; js3-instance-member-face
+ ;; js3-jsdoc-html-tag-delimiter-face
+ ;; js3-jsdoc-html-tag-name-face
+ ;; js3-jsdoc-tag-face
+ ;; js3-jsdoc-type-face
+ ;; js3-jsdoc-value-face
+ ;; js3-magic-paren-face
+ ;; js3-private-function-call-face
+ ;; js3-private-member-face
+ ;; js3-warning-face
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Diff
+ `(diff-added ((t (:foreground ,green-3 :background ,green-2bg ))))
+ `(diff-removed ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(diff-file-header ((t (:foreground ,orange-1 :background ,orange-1bg ))))
+ `(diff-context ((t (:foreground ,foam ))))
+ `(diff-hunk-header ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ ;; diff-changed
+ ;; diff-function
+ ;; diff-header
+ ;; diff-index
+ ;; diff-indicator-added
+ ;; diff-indicator-changed
+ ;; diff-indicator-removed
+ ;; diff-nonexistent
+ ;; diff-refine-added
+ ;; diff-refine-change
+ ;; diff-refine-removed
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; Linum
+ `(linum ((t (:foreground ,gray-3 :background ,alt-background :height 120 ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; show-paren-mode
+ `(show-paren-match ((t (:foreground ,gray-2 :background ,gray-4 ))))
+ `(Show-paren-mismatch ((t (:foreground ,orange-1 :background ,red-2bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; ido
+ `(ido-only-match ((t (:foreground ,green-1 :background ,green-1bg ))))
+ `(ido-subdir ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(ido-first-match ((t (:foreground ,orange-1 :background ,orange-1bg ))))
+ `(ido-incomplete-regexp ((t (:foreground ,red-1 :background ,orange-1bg ))))
+ `(ido-indicator ((t (:foreground ,turquoise-1 :background ,turquoise-1bg ))))
+ `(ido-virtual ((t (:foreground ,green-3 :background ,turquoise-1bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; whitespace-mode
+ `(whitespace-empty ((t (:foreground ,yellow-1 :background ,turquoise-2bg ))))
+ `(whitespace-hspace ((t (:foreground ,turquoise-2 :background ,turquoise-2bg ))))
+ `(whitespace-indentation ((t (:foreground ,turquoise-2 :background ,turquoise-2bg ))))
+ `(whitespace-line ((t (:foreground ,orange-1 :background ,turquoise-2bg ))))
+ `(whitespace-newline ((t (:foreground ,turquoise-2 :background ,turquoise-2bg ))))
+ `(whitespace-space ((t (:foreground ,turquoise-2 :background ,turquoise-2bg ))))
+ `(whitespace-space-after-tab ((t (:foreground ,turquoise-2 :background ,turquoise-2bg ))))
+ `(whitespace-tab ((t (:foreground ,turquoise-2 :background ,turquoise-2bg ))))
+ `(whitespace-trailing ((t (:foreground ,red-1 :background ,turquoise-2bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; flyspell-mode
+ `(flyspell-incorrect ((t (:underline ,red-2 ))))
+ `(flyspell-duplicate ((t (:underline ,green-2 ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; flymake-mode
+ `(flymake-errline ((t (:underline ,red-2 :background nil :inherit nil ))))
+ `(flymake-warnline ((t (:underline ,green-2 :background nil :inherit nil ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; dropdown-list
+ `(dropdown-list-selection-face ((t (:foreground ,foam :background ,purple-1bg ))))
+ `(dropdown-list-face ((t (:foreground ,background :background ,foam ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; git gutter mode
+ `(git-gutter:added ((t (:foreground ,green-1 :background ,green-2bg ))))
+ `(git-gutter:deleted ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(git-gutter:modified ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(git-gutter:unchanged ((t ( :background ,yellow-1bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; magit
+ `(magit-item-highlight ((t ( :background ,purple-3bg ))))
+ `(magit-branch ((t (:foreground ,green-2 :background ,green-2bg ))))
+ `(magit-whitespace-warning-face ((t (:foreground ,red-3 :background ,red-1bg ))))
+ `(magit-section-title ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(magit-header ((t (:foreground ,orange-1 :background ,orange-1bg ))))
+ `(magit-item-mark ((t (:foreground ,green-1 ))))
+ `(magit-diff-merge-proposed ((t (:foreground ,foam ))))
+ `(magit-diff-merge-current ((t (:foreground ,blue-1 ))))
+ `(magit-diff-merge-separator ((t (:foreground ,blue-2 ))))
+ `(magit-log-author ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(magit-log-graph ((t (:foreground ,blue-2 :background ,blue-2bg ))))
+ `(magit-log-head-label-bisect-good ((t (:foreground ,turquoise-1 :background ,turquoise-1bg ))))
+ `(magit-log-head-label-local ((t (:foreground ,foam :background ,turquoise-1bg ))))
+ `(magit-log-head-label-remote ((t (:foreground ,foam :background ,purple-2bg ))))
+ `(magit-log-message ((t (:foreground ,dirty-crem :background ,background ))))
+ `(magit-log-date ((t (:foreground ,blue-4 :background ,background ))))
+ `(magit-log-head-label-bisect-bad ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(magit-log-head-label-default ((t (:foreground ,foam :background ,turquoise-1bg ))))
+ `(magit-log-head-label-patches ((t (:foreground ,blue-2 :background ,blue-1bg ))))
+ `(magit-log-head-label-tags ((t (:foreground ,orange-1 :background ,orange-1bg ))))
+ `(magit-log-sha1 ((t (:foreground ,turquoise-1 :background ,turquoise-1bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; IEdit
+ `(iedit-occurrence ((t (:foreground ,green-3 :background ,orange-1bg ))))
+ `(iedit-read-only-occurrence ((t (:foreground ,red-1 :background ,orange-1bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; highlight-indentation-mode
+ `(highlight-indentation-face ((t ( :background ,background-dark ))))
+ `(highlight-indentation-current-column-face ((t ( :background ,gray-5 ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; ECB
+ `(ecb-default-general-face ((t (:foreground ,gray-1 :background ,gray-1bg ))))
+ `(ecb-default-highlight-face ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(ecb-method-face ((t (:foreground ,red-1 :background ,red-1bg ))))
+ `(ecb-tag-header-face ((t ( :background ,blue-2bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; org-mode
+ `(org-date ((t (:foreground ,purple-1 :background ,purple-1bg ))))
+ `(org-done ((t (:foreground ,green-1 :background ,green-1bg ))))
+ `(org-hide ((t (:foreground ,gray-3 :background ,gray-1bg ))))
+ `(org-link ((t (:foreground ,blue-1 :background ,blue-1bg ))))
+ `(org-todo ((t (:foreground ,red-1 :background ,red-1bg ))))
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; cua-mode
+ `(cua-global-mark ((t(:foreground ,foam :background ,turquoise-1 ))))
+ `(cua-rectangle ((t(:foreground ,foam :background ,purple-4 ))))
+ `(cua-rectangle-noselect ((t(:foreground ,foam :background ,orange-1 ))))
+
+ ;;-----------------------------------------------------------------------------------------------------------------------
+ ;; smartparens
+ `(sp-show-pair-match-face ((t (:foreground nil :background "grey10"))))
+ )
+
+ (custom-theme-set-variables
+ 'soothe
+
+ `(main-line-color1 ,gray-6bg)
+ `(main-line-color2 ,gray-2bg)
+
+ `(main-line-separator-style
+ 'chamfer
+ )
+
+ `(powerline-color1 ,gray-6bg)
+ `(powerline-color2 ,gray-2bg)
+
+ ;; `(Linum-format "%7i ")
+ `(fringe-mode 4)
+
+ ;; Fill Column Indicator mode
+ `(fci-rule-color ,gray-6)
+ `(fci-rule-character-color ,gray-6)
+
+ `(ansi-color-names-vector
+ ;; black, red, green, yellow, blue, magenta, cyan, white
+ [,background ,red-1 ,green-1 ,yellow-1 ,blue-1 ,purple-1 ,blue-3 ,foreground])
+ `(ansi-term-color-vector
+ ;; black, red, green, yellow, blue, magenta, cyan, white
+ [unspecified ,background ,red-1 ,green-1 ,yellow-1 ,blue-1 ,purple-1 ,blue-3 ,foreground])
+ )
+ )
+
+;; Rainbow delimiters
+(defun soothe-rainbow-delim-set-face ()
+ (set-face-attribute 'rainbow-delimiters-depth-1-face nil :foreground "#2B583D")
+ (set-face-attribute 'rainbow-delimiters-depth-2-face nil :foreground "#2B5858")
+ (set-face-attribute 'rainbow-delimiters-depth-3-face nil :foreground "#2B3C58")
+ (set-face-attribute 'rainbow-delimiters-depth-4-face nil :foreground "#342B58")
+ (set-face-attribute 'rainbow-delimiters-depth-5-face nil :foreground "#4F2B58")
+ (set-face-attribute 'rainbow-delimiters-depth-6-face nil :foreground "#582B45")
+ (set-face-attribute 'rainbow-delimiters-depth-7-face nil :foreground "#58462B")
+ (set-face-attribute 'rainbow-delimiters-depth-8-face nil :foreground "#4E582B")
+ (set-face-attribute 'rainbow-delimiters-depth-9-face nil :foreground "#33582B")
+ (set-face-attribute 'rainbow-delimiters-unmatched-face nil :foreground "#660000"))
+
+
+(eval-after-load "rainbow-delimiters" '(soothe-rainbow-delim-set-face))
+
+;;;###autoload
+(when load-file-name
+ (add-to-list 'custom-theme-load-path
+ (file-name-as-directory (file-name-directory load-file-name))))
+
+(provide-theme 'soothe)
+
+;;; List of themes to include...
+
+;;; Man-overstrike
+;;; Man-reverse
+;;; Man-underline
+
+;;; bold
+;;; bold-italic
+;;; border
+;;; buffer-menu-buffer
+;;; button
+
+;;; c-annotation-face
+
+;;; change-log-acknowledgment
+;;; change-log-conditionals
+;;; change-log-date
+;;; change-log-email
+;;; change-log-file
+;;; change-log-function
+;;; change-log-list
+;;; change-log-name
+
+;;; comint-highlight-input
+;;; comint-highlight-prompt
+
+;;; completions-annotations
+;;; completions-common-part
+;;; completions-first-difference
+
+;;; custom-button
+;;; custom-button-mouse
+;;; custom-button-pressed
+;;; custom-button-pressed-unraised
+;;; custom-button-unraised
+;;; custom-changed
+;;; custom-comment
+;;; custom-comment-tag
+;;; custom-documentation
+;;; custom-face-tag
+;;; custom-group-subtitle
+;;; custom-group-tag
+;;; custom-group-tag-1
+;;; custom-invalid
+;;; custom-link
+;;; custom-modified
+;;; custom-rogue
+;;; custom-saved
+;;; custom-set
+;;; custom-state
+;;; custom-themed
+;;; custom-variable-button
+;;; custom-variable-tag
+;;; custom-visibility
+
+;;; ecb-default-general-face
+;;; ecb-default-highlight-face
+;;; ecb-method-face
+;;; ecb-tag-header-face
+
+;;; error
+;;; escape-glyph
+;;; file-name-shadow
+;;; fixed-pitch
+
+;;; glyphless-char
+
+;;; header-line
+;;; help-argument-name
+
+;;; hi-black-b
+;;; hi-black-hb
+;;; hi-blue
+;;; hi-blue-b
+;;; hi-green
+;;; hi-green-b
+;;; hi-pink
+;;; hi-red-b
+;;; hi-yellow
+
+;;; hideshowvis-hidable-face
+
+;;; highlight
+;;; highlight-changes
+;;; highlight-changes-delete
+;;; highlight-indentation-current-column-face
+;;; highlight-indentation-face
+
+;;; hl-line
+
+;;; hs-face
+;;; hs-fringe-face
+
+;;; info-header-node
+;;; info-header-xref
+;;; info-menu-header
+;;; info-menu-star
+;;; info-node
+;;; info-title-1
+;;; info-title-2
+;;; info-title-3
+;;; info-title-4
+;;; info-xref
+;;; info-xref-visited
+
+;;; italic
+
+;;; lazy-highlight
+
+;;; link
+;;; link-visited
+
+;;; log-edit-header
+;;; log-edit-summary
+;;; log-edit-unknown-header
+
+;;; mac-ts-caret-position
+;;; mac-ts-converted-text
+;;; mac-ts-raw-text
+;;; mac-ts-selected-converted-text
+
+;;; match
+;;; menu
+
+;;; message-cited-text
+;;; message-header-cc
+;;; message-header-name
+;;; message-header-newsgroups
+;;; message-header-other
+;;; message-header-subject
+;;; message-header-to
+;;; message-header-xheader
+;;; message-mml
+;;; message-separator
+
+;;; minibuffer-prompt
+
+
+;;; mouse
+
+;;; next-error
+
+;;; nobreak-space
+
+;;; org-date
+;;; org-done
+;;; org-hide
+;;; org-link
+;;; org-todo
+
+;;; powerline-active1
+;;; powerline-active2
+;;; powerline-inactive1
+;;; powerline-inactive2
+
+;;; proced-mark
+;;; proced-marked
+;;; proced-sort-header
+
+;;; query-replace
+
+;;; rcirc-bright-nick
+;;; rcirc-dim-nick
+;;; rcirc-keyword
+;;; rcirc-my-nick
+;;; rcirc-nick-in-message
+;;; rcirc-nick-in-message-full-line
+;;; rcirc-other-nick
+;;; rcirc-prompt
+;;; rcirc-server
+;;; rcirc-server-prefix
+;;; rcirc-timestamp
+;;; rcirc-track-keyword
+;;; rcirc-track-nick
+;;; rcirc-url
+
+;;; rst-adornment
+;;; rst-block
+;;; rst-comment
+;;; rst-definition
+;;; rst-directive
+;;; rst-emphasis1
+;;; rst-emphasis2
+;;; rst-external
+;;; rst-level-1
+;;; rst-level-2
+;;; rst-level-3
+;;; rst-level-4
+;;; rst-level-5
+;;; rst-level-6
+;;; rst-literal
+;;; rst-reference
+;;; rst-transition
+
+;;; scroll-bar
+
+;;; secondary-selection
+;;; shadow
+
+;;; show-paren-match
+;;; show-paren-mismatch
+
+;;; speedbar-button-face
+;;; speedbar-directory-face
+;;; speedbar-file-face
+;;; speedbar-highlight-face
+;;; speedbar-selected-face
+;;; speedbar-separator-face
+;;; speedbar-tag-face
+
+;;; success
+
+;;; tool-bar
+
+
+;;; trailing-whitespace
+
+;;; underline
+
+;;; variable-pitch
+
+;;; vertical-border
+
+;;; w3m-anchor
+;;; w3m-arrived-anchor
+;;; w3m-bold
+;;; w3m-current-anchor
+;;; w3m-form-button
+;;; w3m-form-button-mouse
+;;; w3m-form-button-pressed
+;;; w3m-header-line-location-content
+;;; w3m-header-line-location-title
+;;; w3m-history-current-url
+;;; w3m-image
+;;; w3m-image-anchor
+;;; w3m-insert
+;;; w3m-italic
+;;; w3m-strike-through
+;;; w3m-tab-background
+;;; w3m-tab-mouse
+;;; w3m-tab-selected
+;;; w3m-tab-selected-background
+;;; w3m-tab-selected-retrieving
+;;; w3m-tab-unselected
+;;; w3m-tab-unselected-retrieving
+;;; w3m-tab-unselected-unseen
+;;; w3m-underline
+
+;;; warning
+
+;;; whitespace-empty
+;;; whitespace-hspace
+;;; whitespace-indentation
+;;; whitespace-line
+;;; whitespace-newline
+;;; whitespace-space
+;;; whitespace-space-after-tab
+;;; whitespace-tab
+;;; whitespace-trailing
+
+;;; widget-button
+;;; widget-button-pressed
+;;; widget-documentation
+;;; widget-field
+;;; widget-inactive
+;;; widget-single-line-field
+
+;;; woman-addition
+;;; woman-bold
+;;; woman-italic
+;;; woman-unknown
+
+;;; yas--field-debug-face
+;;; yas-field-highlight-face
+
+;;; soothe-theme.el ends here