From c2778f0f713cc885087d6302196e421596ff248e Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 21 Aug 2014 00:23:56 +0200 Subject: Add Emacs config --- emacs/.emacs.d/.gitignore | 46 + emacs/.emacs.d/Cask | 86 ++ emacs/.emacs.d/Makefile | 29 + emacs/.emacs.d/eshell/.gitignore | 3 + emacs/.emacs.d/eshell/alias | 9 + emacs/.emacs.d/gtkrc | 19 + emacs/.emacs.d/init.el | 1492 ++++++++++++++++++++ emacs/.emacs.d/init.org | 960 +++++++++++++ emacs/.emacs.d/project.el | 13 + emacs/.emacs.d/site-lisp/.gitignore | 1 + emacs/.emacs.d/site-lisp/Makefile | 5 + emacs/.emacs.d/site-lisp/appt-init.el | 46 + emacs/.emacs.d/site-lisp/avandu-init.el | 35 + emacs/.emacs.d/site-lisp/drd.el | 8 + emacs/.emacs.d/site-lisp/dzen.el | 86 ++ emacs/.emacs.d/site-lisp/eltuki.el | 266 ++++ emacs/.emacs.d/site-lisp/gnus-init.el | 82 ++ emacs/.emacs.d/site-lisp/jabber-init.el | 200 +++ emacs/.emacs.d/site-lisp/metalexpress.el | 80 ++ emacs/.emacs.d/site-lisp/mu4e-init.el | 54 + emacs/.emacs.d/site-lisp/my-smt.el | 123 ++ emacs/.emacs.d/site-lisp/org-init.el | 192 +++ emacs/.emacs.d/site-lisp/pivot.el | 70 + emacs/.emacs.d/site-lisp/pkgbuild.el | 57 + emacs/.emacs.d/site-lisp/quick-edit-mode.el | 74 + emacs/.emacs.d/site-lisp/wm-init.el | 3 + emacs/.emacs.d/snippets/conf-mode/section | 8 + emacs/.emacs.d/snippets/emacs-lisp/face | 5 + emacs/.emacs.d/snippets/html-mode/block | 7 + emacs/.emacs.d/snippets/html-mode/for | 8 + emacs/.emacs.d/snippets/html-mode/generic-block | 8 + emacs/.emacs.d/snippets/html-mode/script | 5 + emacs/.emacs.d/snippets/html-mode/trans-with-cap | 6 + emacs/.emacs.d/snippets/org-mode/codeblock | 7 + emacs/.emacs.d/snippets/org-mode/heading | 9 + emacs/.emacs.d/snippets/org-mode/project | 51 + emacs/.emacs.d/snippets/org-mode/snippet | 14 + emacs/.emacs.d/snippets/php-mode/function | 8 + emacs/.emacs.d/snippets/php-mode/wpheader.php | 13 + emacs/.emacs.d/snippets/python-mode/defm_empty | 7 + emacs/.emacs.d/snippets/python-mode/form | 9 + emacs/.emacs.d/snippets/python-mode/form_valid | 8 + .../snippets/python-mode/form_valid_with_return | 8 + emacs/.emacs.d/snippets/python-mode/import_from | 6 + emacs/.emacs.d/snippets/python-mode/method | 7 + .../.emacs.d/snippets/python-mode/permission_guard | 9 + emacs/.emacs.d/snippets/python-mode/url | 5 + emacs/.emacs.d/snippets/ruby-mode/ProductSeed | 5 + emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW | 5 + .../.emacs.d/snippets/ruby-mode/ProductSeedHWGroup | 8 + 50 files changed, 4265 insertions(+) create mode 100644 emacs/.emacs.d/.gitignore create mode 100644 emacs/.emacs.d/Cask create mode 100644 emacs/.emacs.d/Makefile create mode 100644 emacs/.emacs.d/eshell/.gitignore create mode 100644 emacs/.emacs.d/eshell/alias create mode 100644 emacs/.emacs.d/gtkrc create mode 100644 emacs/.emacs.d/init.el create mode 100644 emacs/.emacs.d/init.org create mode 100644 emacs/.emacs.d/project.el create mode 100644 emacs/.emacs.d/site-lisp/.gitignore create mode 100644 emacs/.emacs.d/site-lisp/Makefile create mode 100644 emacs/.emacs.d/site-lisp/appt-init.el create mode 100644 emacs/.emacs.d/site-lisp/avandu-init.el create mode 100644 emacs/.emacs.d/site-lisp/drd.el create mode 100644 emacs/.emacs.d/site-lisp/dzen.el create mode 100644 emacs/.emacs.d/site-lisp/eltuki.el create mode 100644 emacs/.emacs.d/site-lisp/gnus-init.el create mode 100644 emacs/.emacs.d/site-lisp/jabber-init.el create mode 100644 emacs/.emacs.d/site-lisp/metalexpress.el create mode 100644 emacs/.emacs.d/site-lisp/mu4e-init.el create mode 100644 emacs/.emacs.d/site-lisp/my-smt.el create mode 100644 emacs/.emacs.d/site-lisp/org-init.el create mode 100644 emacs/.emacs.d/site-lisp/pivot.el create mode 100644 emacs/.emacs.d/site-lisp/pkgbuild.el create mode 100644 emacs/.emacs.d/site-lisp/quick-edit-mode.el create mode 100644 emacs/.emacs.d/site-lisp/wm-init.el create mode 100644 emacs/.emacs.d/snippets/conf-mode/section create mode 100644 emacs/.emacs.d/snippets/emacs-lisp/face create mode 100644 emacs/.emacs.d/snippets/html-mode/block create mode 100644 emacs/.emacs.d/snippets/html-mode/for create mode 100644 emacs/.emacs.d/snippets/html-mode/generic-block create mode 100644 emacs/.emacs.d/snippets/html-mode/script create mode 100644 emacs/.emacs.d/snippets/html-mode/trans-with-cap create mode 100644 emacs/.emacs.d/snippets/org-mode/codeblock create mode 100644 emacs/.emacs.d/snippets/org-mode/heading create mode 100644 emacs/.emacs.d/snippets/org-mode/project create mode 100644 emacs/.emacs.d/snippets/org-mode/snippet create mode 100644 emacs/.emacs.d/snippets/php-mode/function create mode 100644 emacs/.emacs.d/snippets/php-mode/wpheader.php create mode 100644 emacs/.emacs.d/snippets/python-mode/defm_empty create mode 100644 emacs/.emacs.d/snippets/python-mode/form create mode 100644 emacs/.emacs.d/snippets/python-mode/form_valid create mode 100644 emacs/.emacs.d/snippets/python-mode/form_valid_with_return create mode 100644 emacs/.emacs.d/snippets/python-mode/import_from create mode 100644 emacs/.emacs.d/snippets/python-mode/method create mode 100644 emacs/.emacs.d/snippets/python-mode/permission_guard create mode 100644 emacs/.emacs.d/snippets/python-mode/url create mode 100644 emacs/.emacs.d/snippets/ruby-mode/ProductSeed create mode 100644 emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW create mode 100644 emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup (limited to 'emacs') diff --git a/emacs/.emacs.d/.gitignore b/emacs/.emacs.d/.gitignore new file mode 100644 index 0000000..a16d644 --- /dev/null +++ b/emacs/.emacs.d/.gitignore @@ -0,0 +1,46 @@ +*.dat +*.elc +*~ + +.mc-lists.el +.org-id-locations +.yas-compiled-snippets.el + +abbrev_defs +bookmarks +custom.el* +emms-streams +eww-bookmarks +flycheck[-_]* +flymake.log +geiser-history.guile +history +ido.last +init2.el +places +smex-items +sqliinput +srecode-map.el +todo-* +tramp +type-break + +.*/ +.cask/ +_publish/ +elfeed/ +elnode/ +elpa/ +emms/ +image-dired/ +jabber-hist/ +jabber/ +newsticker/ +packages/ +perso/ +request/ +semanticdb/ +templates/ +themes/ +url/ +vendor-lisp/ diff --git a/emacs/.emacs.d/Cask b/emacs/.emacs.d/Cask new file mode 100644 index 0000000..8516e5b --- /dev/null +++ b/emacs/.emacs.d/Cask @@ -0,0 +1,86 @@ +;; -*- mode: emacs-lisp; -*- +(source gnu) +(source marmalade) +(source melpa) +(source org) + +(depends-on "slime") + +(depends-on "ac-geiser") +(depends-on "ac-slime") +(depends-on "auto-complete") +(depends-on "boxquote") +(depends-on "c-eldoc") +(depends-on "cedit") +(depends-on "clojure-mode") +(depends-on "closure-template-html-mode") +(depends-on "coffee-mode") +(depends-on "colemak-evil" :git "git://github.com/ryuslash/colemak-evil.git") +(depends-on "csharp-mode") +(depends-on "css-eldoc") +(depends-on "deferred") +(depends-on "desktop-registry") +(depends-on "diff-hl") +(depends-on "discover") +(depends-on "dispass") +(depends-on "dockerfile-mode") +(depends-on "e2wm") +(depends-on "elnode") +(depends-on "emms") +(depends-on "eshell-fringe-status") +(depends-on "esxml") +(depends-on "evil") +(depends-on "eww-lnum") +(depends-on "expand-region") +(depends-on "fill-column-indicator") +(depends-on "fiplr") +(depends-on "flx") +(depends-on "flycheck") +(depends-on "flycheck-commit-check" :git "git://github.com/ryuslash/flycheck-commit-check.git") +(depends-on "flycheck-pos-tip") +(depends-on "fuel") +(depends-on "geiser") +(depends-on "git-auto-commit-mode") +(depends-on "git-commit-mode") +(depends-on "git-rebase-mode") +(depends-on "gitignore-mode") +(depends-on "go-mode") +(depends-on "graphviz-dot-mode") +(depends-on "gtags") +(depends-on "haml-mode") +(depends-on "haskell-mode") +(depends-on "hl-sexp") +(depends-on "htmlize") +(depends-on "hy-mode") +(depends-on "hypo" :git "git://github.com/ryuslash/hypo-emacs.git") +(depends-on "ido-ubiquitous") +(depends-on "idomenu") +(depends-on "jabber") +(depends-on "jedi") +(depends-on "js2-mode") +(depends-on "magit") +(depends-on "markdown-mode") +(depends-on "mode-icons") +(depends-on "monokai-theme") +(depends-on "multiple-cursors") +(depends-on "noflet") +(depends-on "org2blog") +(depends-on "paredit") +(depends-on "persistent-outline" :git "git://ryuslash.org/persistent-outline.git") +(depends-on "php-mode") +(depends-on "pony-mode") +(depends-on "popwin") +(depends-on "prodigy") +(depends-on "rainbow-delimiters") +(depends-on "rainbow-mode") +(depends-on "request") +(depends-on "rust-mode") +(depends-on "slime-js") +(depends-on "smex") +(depends-on "svg-mode-line-themes") +(depends-on "tagedit") +(depends-on "upcase-mode" :git "git://github.com/ryuslash/upcase-mode.git") +(depends-on "writegood-mode") +(depends-on "yaml-mode") +(depends-on "yasnippet") +(depends-on "yoshi-theme" :git "git://github.com/ryuslash/yoshi-theme.git") diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile new file mode 100644 index 0000000..c7f593f --- /dev/null +++ b/emacs/.emacs.d/Makefile @@ -0,0 +1,29 @@ +.PHONY: all site-lisp +all: init2.elc init.elc site-lisp/ + +%.elc: %.el + emacs -Q -batch -eval "(byte-compile-file \"$<\")" + +init.el: init2.el +init2.el: init.org + emacs -Q -batch -l "ob-tangle" -eval "(org-babel-tangle-file \"init.org\")" + +%/: % + $(MAKE) -C "$(CURDIR)/$*" + +rudel: + git clone git://github.com/scymtym/rudel.git packages/rudel + emacs -Q --batch --visit packages/rudel/rudel-compile.el \ + --eval "(eval-buffel)" + +clean: + rm -rf _publish/*.* + +export: clean + emacs -L $(CURDIR) -L ~/.emacs.d/vendor-lisp/org/lisp \ + -L ~/.emacs.d/vendor-lisp/org/contrib/lisp -batch -l project.el \ + -f org-publish-all + +publish: export + rsync -avuz --exclude=*~ --delete _publish/ \ + ryuslash.org:public_html/orgweb/dotfiles/emacs diff --git a/emacs/.emacs.d/eshell/.gitignore b/emacs/.emacs.d/eshell/.gitignore new file mode 100644 index 0000000..0990221 --- /dev/null +++ b/emacs/.emacs.d/eshell/.gitignore @@ -0,0 +1,3 @@ +history +lastdir +login diff --git a/emacs/.emacs.d/eshell/alias b/emacs/.emacs.d/eshell/alias new file mode 100644 index 0000000..d98e2f5 --- /dev/null +++ b/emacs/.emacs.d/eshell/alias @@ -0,0 +1,9 @@ +alias hgit hgit --no-pager $* +alias newsbeuter ansi-term newsbeuter newsbeuter +alias d dired $1 +alias o find-file $1 +alias listen eshell-exec-visual mplayer http://usa7-vn.mixstream.net/listen/8248.pls +alias ncmpcpp ansi-term ncmpcpp ncmpcpp +alias sudo *sudo $* +alias rm rm -v $* +alias git git --no-pager $* diff --git a/emacs/.emacs.d/gtkrc b/emacs/.emacs.d/gtkrc new file mode 100644 index 0000000..6b63cd7 --- /dev/null +++ b/emacs/.emacs.d/gtkrc @@ -0,0 +1,19 @@ +gtk-font-name = "Envy Code R 12" + +style "yoshi" +{ + bg[NORMAL] = "#111113" + bg[SELECTED] = "#111113" + bg[INSENSITIVE] = "#111113" + bg[ACTIVE] = "#111113" + bg[PRELIGHT] = "#4a5b73" + + fg[NORMAL] = "#eeeeec" + fg[SELECTED] = "#eeeeec" + fg[INSENSITIVE] = "#a5a5a4" + fg[ACTIVE] = "#eeeeec" + fg[PRELIGHT] = "#eeeeec" +} + +widget "Emacs.*" style "yoshi" +widget_class "*Menu*" style "yoshi" diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el new file mode 100644 index 0000000..29dbbc9 --- /dev/null +++ b/emacs/.emacs.d/init.el @@ -0,0 +1,1492 @@ +;;; init.el --- My Emacs init -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: + +(eval-and-compile + (require 'cask "~/projects/ext/cask/cask.el") + (cask-initialize)) + +(eval-when-compile + (require 'cl) + (require 'dash) + (require 'esh-io) + (require 'esh-proc) + (require 'fill-column-indicator) + (require 'magit) + (require 'yasnippet) + (require 'noflet)) + +(load (concat user-emacs-directory "init2")) + +;;;; Autoloads + +(autoload 'jabber-connect "jabber" nil t) +(autoload 'moz-minor-mode "moz" nil t) +(autoload 'notifications-notify "notifications") +(autoload 'php-mode "php-mode" nil t) +(autoload 'po-mode "po-mode" nil t) +(autoload 'pony-mode "pony-mode" nil t) +(autoload 'sawfish-mode "sawfish" nil t) +(autoload 'server-running-p "server") +(autoload 'tagedit-mode "tagedit" nil t) +(autoload 'tern-mode "tern" nil t) +(autoload 'w3m-bookmark-view "w3m" nil t) +(autoload 'w3m-goto-url "w3m" nil t) +(autoload 'xmodmap-mode "xmodmap-mode" nil t) + +;;;; Macros + +(defmacro auto-init (library) + "Load a file for LIBRARY after loading the library. + +The loaded file should be `LIBRARY-init', either `.el' or `.elc' +will do." + `(with-eval-after-load ',library + (load ,(concat (if (symbolp library) + (symbol-name library) + library) "-init")))) + +;; http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load/ +(defmacro stante-after (feature &rest forms) + "After FEATURE is loaded, evaluate FORMS. + +FEATURE may be an unquoted feature symbol or a file name, see +`eval-after-load'." + (declare (indent 1) (debug t)) + `(,(if (or (not byte-compile-current-file) + (if (symbolp feature) + (require feature nil :noerror) + (load feature :no-message :no-error))) + `progn + (message "stante-after: cannot find %s" feature) + 'with-no-warnings) + (with-eval-after-load ',feature ,@forms))) + +(defmacro oni:add-hooks (hook &rest functions) + "Add to HOOK each function in FUNCTIONS." + (declare (indent 1)) + `(progn + ,@(mapcar (lambda (func) `(add-hook ,hook ,func)) functions))) + +(defmacro oni:add-function-to-hooks (func &rest hooks) + "Add FUNCTION to each hook in HOOKS." + (declare (indent 1)) + `(progn + ,@(mapcar (lambda (hook) `(add-hook ,hook ,func)) hooks))) + +(defmacro oni:email (user at host dot com) + "Turn arguments into an email address. +The resulting email address will look like: USER@HOST.COM, AT and +DOT are intentionally being skipped." + (ignore at dot) + (concat (symbol-name user) "@" (symbol-name host) "." + (symbol-name com))) + +(defmacro oni:eval-after-init (&rest body) + "Defer execution of BODY until after Emacs init." + (declare (indent 0)) + `(add-hook 'emacs-startup-hook #'(lambda () ,@body))) + +(defmacro oni:link-modes (mode1 mode2) + "Whenever MODE1 is started, also start MODE2. Same for stopping. + +If INVERSE is specified, make sure MODE2 is turned off whenever +MODE1 is enabled and vice-versa." + (let* ((mode1-name (symbol-name mode1)) + (mode2-name (symbol-name mode2)) + (function-name (intern (concat "toggle-" mode2-name + "-by-" mode1-name)))) + `(progn + (defun ,function-name () + ,(concat "Toggle `" mode2-name "' according to the variable `" + mode1-name "'.") + (,mode2 (or ,mode1 -1))) + (add-hook ',(intern (concat mode1-name "-hook")) + #',function-name)))) + +(defmacro oni:exclude-modes (mode1 mode2) + "Whenever MODE1 is started, stop MODE2. Switch for stopping." + (let* ((mode1-name (symbol-name mode1)) + (mode2-name (symbol-name mode2)) + (function-name + (intern (concat "toggle-" mode2-name + "-inverse-of-" mode1-name)))) + `(progn + (defvar ,mode1) + (defun ,function-name () + ,(concat "Toggle `" mode2-name + "' according to the inverse of `" mode1-name "'.") + (,mode2 (or (not ,mode1) -1))) + (add-hook ',(intern (concat mode1-name "-hook")) + #',function-name)))) + +;;;;; Vacuous + +(defvar elnode-do-init) +(defvar eshell-prompt-regexp) +(defvar gnus-init-file) +(defvar sql-product) +(defvar sql-prompt-regexp) +(defvar whitespace-style) +(defvar *jabber-connected*) +(defvar *jabber-current-status*) + +;;;; Functions + +(defun oni:add-import-from (package import) + (interactive + (list (completing-read "From package: " (oni:collect-from-imports)) + (read-string "Import: "))) + (save-excursion + (goto-char (point-min)) + (search-forward (concat "from " package " import (")) + (insert "\n " import ",") + (oni:sort-imports))) + +(defun oni:after-save-func () + "Function for `after-save-hook'." + (executable-make-buffer-file-executable-if-script-p) + (let* ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")) + (TAGSp (not (string= "" (shell-command-to-string + (concat "grep \"^TAGS:\" " dom-dir "Makefile")))))) + (when (and dom-dir TAGSp) + (shell-command + (concat "make -C " dom-dir " TAGS >/dev/null 2>&1"))))) + +(defun oni:augment-sql-prompt () + "Add the MariaDB prompt to the `sql-prompt-regexp'." + (if (eq sql-product 'mysql) + (setq sql-prompt-regexp + (rx (and line-start + (or "mysql" + (and "MariaDB [" (1+ nonl) "]")) + "> "))))) + +(defun oni:before-save-func () + "Function for `before-save-hook'." + (if (eq major-mode 'html-mode) + (oni:replace-html-special-chars)) + (if (not (eq major-mode 'markdown-mode)) + (delete-trailing-whitespace))) + +(defun oni:c-mode-func () + "Function for `c-mode-hook'." + (local-set-key [f9] 'compile)) + +(defun oni:change-number-at-point (change-func) + "Use CHANGE-FUNC to change the number at `point'." + (let ((num (number-to-string (funcall change-func (number-at-point)))) + (bounds (bounds-of-thing-at-point 'word))) + (save-excursion + (delete-region (car bounds) (cdr bounds)) + (insert num)))) + +(defun oni:change-prev-case (num dir) + (let ((regfunc (if (eq dir 'up) 'upcase-region 'downcase-region)) + (wordfunc (if (eq dir 'up) 'upcase-word 'downcase-word))) + (if (> num 1) + (funcall regfunc (point) (- (point) num)) + (funcall wordfunc -1)))) + +(defun oni:collect-from-imports () + (let (results) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "from \\(.+\\) import" nil :noerror) + (push (buffer-substring-no-properties (match-beginning 1) + (match-end 1)) results))) + results)) + +(defun oni:current-jabber-status () + "Return a string representing the current jabber status." + (or (and (not *jabber-connected*) "Offline") + (and (not (string= *jabber-current-status* "")) + *jabber-current-status*) + "Online")) + +(defun oni:decrease-number-at-point () + "Take the number at `point' and replace it with it decreased by 1." + (interactive) + (oni:change-number-at-point #'1-)) + +(defun oni:diary-display-func () + "Function for `diary-display-hook'." + (diary-fancy-display)) + +(defun oni:downcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'down)) + +(defun oni:enable (functions) + "Set the `disabled' property for each item in FUNCTIONS to nil." + (mapc #'(lambda (f) (put f 'disabled nil)) functions)) + +(defun oni:eshell-handle-url () + (save-excursion + (goto-char eshell-last-output-start) + (while (re-search-forward + "https?://[^ \n]+" eshell-last-output-end :noerror) + (make-button (match-beginning 0) (match-end 0) + 'action (lambda (button) + (browse-url (button-label button))))))) + +(defun oni:eshell-prompt () + "Show a pretty shell prompt." + (concat (if (not (looking-back "\n")) "\n") + (oni:shorten-dir (abbreviate-file-name (eshell/pwd))) + " > ")) + +(defun oni:go-mode-func () + "Function for `go-mode-hook'." + (setq indent-tabs-mode nil)) + +(defun oni:haskell-mode-func () + "Function for `haskell-mode-hook'." + (turn-on-haskell-indentation)) + +(defun oni:increase-number-at-point () + "Take the number at `point' and replace it with it increased by 1." + (interactive) + (oni:change-number-at-point #'1+)) + +(defun indent-defun () + "Indent the current defun." + (interactive) + (save-excursion + (mark-defun) + (indent-region (region-beginning) (region-end)))) + +(defun oni:eshell-C-d () + "Either call `delete-char' interactively or quit." + (interactive) + (condition-case err + (call-interactively #'delete-char) + (error (if (and (eq (car err) 'end-of-buffer) + (looking-back eshell-prompt-regexp)) + (kill-buffer) + (signal (car err) (cdr err)))))) + +(defun oni:level (lst) + "Reduce a 2-level list LST to a flat list." + (let ((lsts (mapcar (lambda (l) (if (listp l) l (list l))) lst))) + (apply #'append lsts))) + +(defun oni:locally-enable-double-spaces () + "Specify that two spaces end a sentence in the current buffer." + (setq-local sentence-end-double-space t)) + +(defun oni:lua-mode-func() + "Function for `lua-mode-hook'." + (local-unset-key (kbd ")")) + (local-unset-key (kbd "]")) + (local-unset-key (kbd "}"))) + +(defun oni:make-import-multiline (from-point to-point) + (interactive (list (line-beginning-position) + (line-end-position))) + (goto-char from-point) + (search-forward "import" to-point) + (insert " (\n") + (delete-horizontal-space) + (let ((imports-start (point)) imports-end) + (while (search-forward "," to-point :noeror) + (insert "\n") + (delete-horizontal-space)) + (end-of-line) + (insert ",\n") + (setf imports-end (point)) + (insert ")") + (python-indent-shift-right imports-start imports-end) + (forward-line -1) + (oni:sort-imports))) + +(defun oni:make-readable () + "Make non-programming buffers a little more readable." + (setq line-spacing .2)) + +(defun oni:markdown-mode-func () + "Function for `markdown-mode-hook'." + (setq-local whitespace-style '(face trailing))) + +(defun oni:maybe-fci-mode () + "Turn on `fci-mode' if there is a filename for the buffer." + (when (buffer-file-name) + (fci-mode))) + +(defun oni:maybe-prettify-symbols-mode (&optional arg) + "See of `prettify-symbols-mode' is bound and call it if so." + (when (fboundp 'prettify-symbols-mode) + (prettify-symbols-mode arg))) + +(defun oni:maybe-switch-to-normal-state () + "Switch the current buffer to normal state. + +Only do this when the mode is not in emacs state by default." + (unless (memql major-mode (oni:modes-starting-in 'emacs)) + (evil-normal-state))) + +(defun oni:mini-fix-timestamp-string (date-string) + "A minimal version of Xah Lee's `fix-timestamp-string'. +Turn DATE-STRING into something else that can be worked with in +code. Found at http://xahlee.org/emacs/elisp_parse_time.html" + (setq date-string (replace-regexp-in-string "Jan" "01" date-string) + date-string (replace-regexp-in-string "Feb" "02" date-string) + date-string (replace-regexp-in-string "Mar" "03" date-string) + date-string (replace-regexp-in-string "Apr" "04" date-string) + date-string (replace-regexp-in-string "May" "05" date-string) + date-string (replace-regexp-in-string "Jun" "06" date-string) + date-string (replace-regexp-in-string "Jul" "07" date-string) + date-string (replace-regexp-in-string "Aug" "08" date-string) + date-string (replace-regexp-in-string "Sep" "09" date-string) + date-string (replace-regexp-in-string "Oct" "10" date-string) + date-string (replace-regexp-in-string "Nov" "11" date-string) + date-string (replace-regexp-in-string "Dec" "12" date-string)) + (string-match + "^\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{4\\}\\)$" + date-string) + (format "%s-%s-%s" + (match-string 3 date-string) + (match-string 2 date-string) + (match-string 1 date-string))) + +(defun oni:mode-line-current-song () + "Extract current song information from a path. + +EMMS only shows me the absolute path of a song, this function +extracts the parts I want to know about." + (let ((song (emms-track-name (emms-playlist-current-selected-track)))) + (if (string-match "\\([^/]+\\)/\\([0-9]\\{4\\}\\) - \\(.+\\)/\\([0-9]\\{2,3\\}\\) - \\(.+\\)\\..\\{3,4\\}$" song) + (let ((band (substring song (match-beginning 1) (match-end 1))) + (title (substring song (match-beginning 5) (match-end 5)))) + (format "[%s - %s]" band title)) + song))) + +(defun oni:modes-starting-in (state) + "Get a list of the modes whose default state is STATE." + (symbol-value (evil-state-property state :modes))) + +(defun oni:move-beginning-of-dwim () + "Move to beginning of line either after indentation or before." + (interactive) + (let ((start (point))) + (back-to-indentation) + (if (= start (point)) + (move-beginning-of-line 1)))) + +(defun oni:move-end-of-dwim () + "Move to end of line, either before any comments or after." + (interactive) + (let ((start (point)) + (eolpos (line-end-position))) + (beginning-of-line) + (if (and comment-start + (not (looking-at (regexp-quote comment-start))) + (comment-search-forward eolpos t)) + (progn + (search-backward-regexp (concat "[^ \t" comment-start "]")) + (forward-char) + + (when (or (bolp) + (= start (point))) + (end-of-line))) + (end-of-line)))) + +(defun oni:myepisodes-formatter (plist) + "Format RSS items from MyEpisodes as org tasks. +PLIST contains all the pertinent information." + (let ((str (plist-get plist :title))) + (string-match + "^\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]$" + str) + (let* ((title (match-string 1 str)) + (episode (match-string 2 str)) + (name (match-string 3 str)) + (date (oni:mini-fix-timestamp-string (match-string 4 str)))) + (format "* ACQUIRE %s %s - %s \n SCHEDULED: <%s>" + title episode name date)))) + +(defun oni:php-mode-func () + "Function for `php-mode-hook'." + (c-set-offset 'arglist-intro '+) + (c-set-offset 'arglist-close '0) + (setq-local fci-rule-column 80)) + +(defun oni:print-keymap (keymap) + "Recursively print KEYMAP with keys as characters." + (mapcar (lambda (itm) + (if (consp itm) + (if (integerp (car itm)) + (cons (format "%c" (car itm)) + (if (listp (cdr itm)) + (oni:print-keymap (cddr itm)) + (cdr itm))) + itm) + itm)) keymap)) + +(defun oni:prog-mode-func () + "Function for `prog-mode-hook'." + (setq-local comment-auto-fill-only-comments t)) + +(defun oni:python-mode-func () + "Function for `python-mode-hook'." + (local-set-key (kbd "C->") 'python-indent-shift-right) + (local-set-key (kbd "C-<") 'python-indent-shift-left) + (set (make-local-variable 'electric-indent-chars) nil) + (setq-local fci-rule-column 79) + (setq-local fill-column 72) + (setq-local whitespace-style '(tab-mark))) + +(defun oni:raise-ansi-term (arg) + "Create or show an `ansi-term' buffer." + (interactive "P") + (let ((buffer (get-buffer "*ansi-term*"))) + (if (and buffer (not arg)) + (switch-to-buffer buffer) + (ansi-term (getenv "SHELL"))))) + +(defun oni:raise-eshell () + "Start or switch back to `eshell'. + +Also change directories to current working directory." + (interactive) + (let ((dir (file-name-directory + (or (buffer-file-name) "~/"))) + (hasfile (not (eq (buffer-file-name) nil))) + (started (and (boundp 'eshell-buffer-name) eshell-buffer-name + (buffer-live-p (get-buffer eshell-buffer-name))))) + (eshell) + (when (and hasfile (eq eshell-process-list nil)) + (eshell/cd dir) + (when started + (eshell-reset))))) + +(defun oni:raise-scratch (&optional mode) + "Show the *scratch* buffer. +If called with a universal argument, ask the user which mode to +use. If MODE is not nil, open a new buffer with the name +*MODE-scratch* and load MODE as its major mode." + (interactive (list (if current-prefix-arg + (read-string "Mode: ") + nil))) + (let* ((bname (if mode + (concat "*" mode "-scratch*") + "*scratch*")) + (buffer (get-buffer bname)) + (mode-sym (intern (concat mode "-mode")))) + + (unless buffer + (setq buffer (generate-new-buffer bname)) + (with-current-buffer buffer + (when (fboundp mode-sym) + (funcall mode-sym)))) + + (select-window (display-buffer buffer)))) + +(defun oni:reload-buffer () + "Reload current buffer." + (interactive) + (revert-buffer nil t nil)) + +(defun oni:replace-html-special-chars () + "Replace special characters with HTML escaped entities." + (oni:replace-occurrences "é" "é")) + +(defun oni:replace-occurrences (from to) + "Replace all occurrences of FROM with TO in the current buffer." + (save-excursion + (goto-char (point-min)) + (while (search-forward from nil t) + (replace-match to)))) + +(defun oni:request-pull () + "Start a mail to request pulling from a git repository." + (interactive) + (let* ((default-directory + (expand-file-name + (or (locate-dominating-file default-directory ".git") + (magit-read-top-dir nil)))) + (refs (magit-list-interesting-refs magit-uninteresting-refs)) + (from (cdr (assoc (completing-read "From: " refs) refs))) + (url (read-from-minibuffer "Pull URL: ")) + (to (symbol-name (read-from-minibuffer "Up to (HEAD): " + nil nil t nil "HEAD"))) + (patchp (and current-prefix-arg (listp current-prefix-arg)))) + (message "Requesting pull for %s from %s to %s at %s with%s patch" + default-directory from to url (if patchp "" "out")) + + (compose-mail + nil (concat + "Requesting pull for " + (file-name-base (directory-file-name default-directory)))) + + (save-excursion + (goto-char (point-max)) + (insert + (shell-command-to-string + (concat "git --git-dir='" default-directory ".git' --work-tree='" + default-directory "' request-pull " (when patchp "-p ") + from " " url " " to)))))) + +(defun oni:reset-default-directory () + "Reset `default-directory' to HOME." + (setq default-directory (getenv "HOME"))) + +(defun oni:scroll-down-or-prev-page (arg) + "Either scroll down or go to the previous page. + +Depending on the value of `buffer-narrowed-p'." + (interactive "^P") + (if (buffer-narrowed-p) + (let ((scroll-error-top-bottom nil)) + (condition-case nil + (scroll-down-command arg) + (beginning-of-buffer + (narrow-to-page -1) + (goto-char (point-min))))) + (scroll-down-command arg))) + +(defun oni:scroll-up-or-next-page (arg) + "Either scroll up or go to the next page. + +Depending on the value of `buffer-narrowed-p'." + (interactive "^P") + (if (buffer-narrowed-p) + (let ((scroll-error-top-bottom nil)) + (condition-case nil + (scroll-up-command arg) + (end-of-buffer + (narrow-to-page 1) + (goto-char (point-min))))) + (scroll-up-command arg))) + +(defun oni:self-insert-dwim () + "Execute self insert, but when the region is active call self +insert at the end of the region and at the beginning." + (interactive) + (if (region-active-p) + (let ((electric-pair-mode nil) + (beginning (region-beginning)) + (end (region-end))) + (goto-char end) + (self-insert-command 1) + (save-excursion + (goto-char beginning) + (self-insert-command 1))) + (self-insert-command 1))) + +(defun oni:set-emacs-lisp-keys () + "Set some keys for `emacs-lisp-mode'." + (local-set-key (kbd "C-.") 'find-function)) + +(defun oni:set-emacs-lisp-symbols () + "Set a few extra UTF-8 symbols for use in emacs-lisp." + (when (boundp 'prettify-symbols-alist) + (setq prettify-symbols-alist + (append prettify-symbols-alist + '(("<=" . ?≤) + (">=" . ?≥) + ("sqrt" . ?√)))))) + + +(defun oni:set-ispell-local-en-dict () + "Set `ispell-local-dictionary' to en." + (setq ispell-local-dictionary "en")) + +(defun oni:set-keys-for-dired () + "Set some keybindings for `dired'." + (local-set-key (kbd "E") #'wdired-change-to-wdired-mode)) + +(defun oni:set-keys-for-eshell () + "Set some keybindings for `eshell'." + (local-set-key (kbd "C-d") #'oni:eshell-C-d)) + +(defun oni:set-keys-for-hy () + "Set some keybindings for `hy-mode'." + (local-set-key (kbd "{") #'paredit-open-curly) + (local-set-key (kbd "}") #'paredit-close-curly)) + +(defun oni:set-keys-for-jabber-chat () + "Set certain keys for `jabber-chat-mode'." + (local-set-key (kbd "M-!") #'shell-command-with-command)) + +(defun oni:set-keys-for-tagedit () + "Set some keybindings for `tagedit-mode'." + (local-set-key (kbd "M-k") #'tagedit-kill-attribute)) + +(defun oni:set-python-imenu-function () + "Set the `imenu-create-index-function' variable. + +For `python-mode' I prefer `python-imenu-create-flat-index'." + (setq imenu-create-index-function #'python-imenu-create-flat-index)) + +(defun oni:set-python-symbols () + "Set a few extra UTF-8 symbols for use in python." + (when (boundp 'prettify-symbols-alist) + (setq prettify-symbols-alist + '(("lambda" . ?λ) + ("<=" . ?≤) + (">=" . ?≥) + ("!=" . ?≠))))) + +(defun oni:set-tab-maybe-toggle-outline () + "Wrap the current function mapped to `TAB'." + (let ((func (or (lookup-key (current-local-map) (kbd "TAB")) + (lookup-key (current-global-map) (kbd "TAB"))))) + (local-set-key (kbd "TAB") + (lambda () + (interactive) + (if (outline-on-heading-p) + (if (outline-invisible-p (line-end-position)) + (show-entry) + (hide-entry)) + (call-interactively func)))))) + +(let (setp) + (defun oni:set-theme (frame) + "Try to set the theme for the current (first) frame." + (ignore frame) + (unless setp + ;; (load-theme 'yoshi t) + (load-theme 'yoshi t) + ;; (smt/enable) + ;; (require 'my-smt) + ;; (smt/set-theme 'my-smt) + ;; (set-face-attribute 'mode-line nil :box nil) + ;; (set-face-attribute 'mode-line-inactive nil :box nil) + ))) + +(if (daemonp) + (add-hook 'after-make-frame-functions + (lambda (frame) + (noflet ((display-graphic-p (&optional display) t)) + (oni:set-theme frame)))) + (oni:eval-after-init (oni:set-theme nil))) + +(defun oni:shell-command-with-command (command &optional output-buffer) + "Print both COMMAND and the output into OUTPUT-BUFFER." + (interactive (list (read-shell-command "Shell command: " nil nil) + current-prefix-arg)) + (when output-buffer + (insert "`" command "':\n")) + (shell-command command output-buffer)) + +(defun oni:shorten-dir (dir) + "Shorten a directory, (almost) like fish does it." + (while (string-match "\\(\\.?[^./]\\)[^/]+/" dir) + (setq dir (replace-match "\\1/" nil nil dir))) + dir) + +(defun oni:show-buffer-position () + "Show the position in the current buffer." + (interactive) + (message (format "%d:%d" (line-number-at-pos) (current-column)))) + +(defun oni:show-org-index () + "Show the index of my org files." + (interactive) + (find-file "~/documents/org/index.org")) + +(defun oni:sort-imports () + "Sort python multiline imports using `()'." + (interactive) + (save-excursion + (sort-lines nil (1+ (search-backward "(")) + (1- (search-forward ")"))))) + +(defun oni:split-window-interactive (dir) + "Split windows in direction DIR. + +Can also delete or switch to another window." + (interactive + (list (read-char "Direction (h,v,q,d,o): "))) + (case dir + ((?v) (split-window-vertically)) + ((?h) (split-window-horizontally)) + ((?q) (delete-other-windows)) + ((?d) (delete-window)) + ((?o) (other-window 1)))) + +(defun oni:split-window-interactively (window) + "Ask for a direction and split WINDOW that way. + +If no direction is given, don't split." + (let ((dir (read-char "Direction (h,v): "))) + (case dir + ((?v) (split-window-vertically)) + ((?h) (split-window-horizontally)) + (t window)))) + +(defun oni:start-python-test-mail-server () + "Run the python test mailserver." + (interactive) + (start-process "python-test-mail-server" "*py-mail-server*" "python" "-m" + "smtpd" "-n" "-c" "DebuggingServer" "localhost:1025")) + +(defun oni:stop-python-test-mail-server () + "Stop the python test mailserver." + (interactive) + (kill-process "python-test-mail-server")) + +(defun oni:switch-to-other-buffer () + "Switch to the most recently viewed buffer." + (interactive) + (switch-to-buffer (other-buffer))) + +(defun oni:term-mode-func () + "Function for `term-mode-hook'." + (setq truncate-lines nil)) + +(defun oni:turn-on-compilation-shell-for-pony () + "Turn on option `compilation-shell-minor-mode' for `pony-minor-mode'." + (add-hook 'pony-minor-mode-hook 'compilation-shell-minor-mode nil t)) + +(defun oni:upcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'up)) + +(defun oni:vala-mode-func () + "Function for `vala-mode-hook'." + (setq indent-tabs-mode nil)) + +(defun oni:write-file-func () + "Function for `write-file-hooks'." + (time-stamp)) + +(defun oni:yas-minor-mode-func () + "Function for `yas-minor-mode-hook'." + (define-key yas-minor-mode-map (kbd "TAB") nil) + (define-key yas-minor-mode-map [(tab)] nil) + (define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand)) + +;;;; Modes + +;; Copied from electric.el, modified from `electric-indent-local-mode'. +(define-minor-mode oni:electric-pair-local-mode + "Toggle `electric-pair-mode' only in this buffer." + :variable (buffer-local-value 'electric-pair-mode (current-buffer)) + (cond + ((eq electric-pair-mode (default-value 'electric-pair-mode)) + (kill-local-variable 'electric-pair-mode)) + ((not (default-value 'electric-pair-mode)) + ;; Locally enabled, but globally disabled. + (electric-pair-mode 1) ; Setup the hooks. + (setq-default electric-pair-mode nil) ; But keep it globally disabled. + ))) + +;;;; Tests + +(stante-after ert + (ert-deftest oni:add-import-from () + (with-temp-buffer + (python-mode) + (insert "from myaethon2.core.administration.models import ( + Client, + Contact, + Individual, + Location, +)") + (oni:add-import-from "myaethon2.core.administration.models" "Debtor") + (should (equal (buffer-substring-no-properties (point-min) (point-max)) + "from myaethon2.core.administration.models import ( + Client, + Contact, + Debtor, + Individual, + Location, +)")))) + + (ert-deftest oni:collect-from-imports () + (with-temp-buffer + (python-mode) + (insert "import calendar as cal +import datetime + +from django.conf import settings +from django.contrib import messages +from django.contrib.auth.decorators import login_required, permission_required +from django.core.context_processors import csrf +from django.core.exceptions import PermissionDenied +from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger +from django.core.urlresolvers import reverse +from django.db import transaction +from django.db.models import Q +from django.shortcuts import get_object_or_404, render +from django.utils import formats +from django.utils.translation import ugettext as _ + +from myaethon2.core.business_units import BU +from myaethon2.core.forms import MultiFormWrapper +from myaethon2.core.models import AUser, Service +from myaethon2.core.planning.models import Booking, JOB_TYPES +from myaethon2.core.util import simplify_timedelta +from myaethon2.core.views import SearchAndSortListView +from myaethon2.jobs import forms, status +from myaethon2.jobs.models import Assignment, Job, JobGroup +from myaethon2.jobs.util import JobFactory +from myaethon2.workers.models import Worker +from myaethon2.export import Exporter, XLSGenerator + +from django.http import ( + HttpResponseForbidden, + HttpResponseNotAllowed, + HttpResponseRedirect, +) + +from django.views.generic import ( + CreateView, + DeleteView, + DetailView, + ListView, + UpdateView, +) + +from myaethon2.core.administration.models import ( + Client, + Contact, + Debtor, + Individual, + Location, +) + +from myaethon2.core.decorators import ( + json_response, + protect_with, + with_help_text, +)") + (should (equal (sort (oni:collect-from-imports) #'string-lessp) + '("django.conf" + "django.contrib" + "django.contrib.auth.decorators" + "django.core.context_processors" + "django.core.exceptions" + "django.core.paginator" + "django.core.urlresolvers" + "django.db" + "django.db.models" + "django.http" + "django.shortcuts" + "django.utils" + "django.utils.translation" + "django.views.generic" + "myaethon2.core.administration.models" + "myaethon2.core.business_units" + "myaethon2.core.decorators" + "myaethon2.core.forms" + "myaethon2.core.models" + "myaethon2.core.planning.models" + "myaethon2.core.util" + "myaethon2.core.views" + "myaethon2.export" + "myaethon2.jobs" + "myaethon2.jobs.models" + "myaethon2.jobs.util" + "myaethon2.workers.models"))))) + + (ert-deftest oni:make-import-multiline () + (with-temp-buffer + (python-mode) + (insert "from myaethon2.core.administration.models import Contact, Individual, Client, Location") + (oni:make-import-multiline (line-beginning-position) (line-end-position)) + (should (equal (buffer-substring-no-properties (point-min) (point-max)) + "from myaethon2.core.administration.models import ( + Client, + Contact, + Individual, + Location, +)"))))) + +;;;; Unconditional settings + +(eval '(setq inhibit-startup-echo-area-message "slash")) + +;;;; Module-specific settings + +(auto-init appt) +(auto-init avandu) + +(stante-after auto-complete + (add-to-list 'ac-modes 'slime-repl-mode) + (setq ac-auto-show-menu nil + ac-use-quick-help nil)) + +(stante-after "bindings" + (setq mode-line-default-help-echo "")) + +(stante-after browse-url + (setq browse-url-browser-function 'browse-url-generic) + (setq browse-url-generic-program "conkeror")) + +(stante-after cc-vars + (setq-default c-basic-offset 4) + (setq c-offsets-alist + '((statement-block-intro . +) + (knr-argdecl-intro . 5) + (substatement-open . +) + (substatement-label . 0) + (label . 0) + (statement-case-open . +) + (statement-cont . +) + (arglist-intro . +) + (arglist-close . 0) + (inline-open . 0) + (brace-list-open . +) + (topmost-intro-cont first c-lineup-topmost-intro-cont + c-lineup-gnu-DEFUN-intro-cont)))) + +(stante-after colemak-evil + (define-key evil-insert-state-map (kbd "C-g") #'evil-normal-state) + (define-key evil-replace-state-map (kbd "C-g") #'evil-normal-state) + (define-key evil-visual-state-map (kbd "C-g") #'evil-normal-state)) + +(stante-after compile + (setq compilation-scroll-output t)) + +(stante-after custom + (setq custom-theme-directory "~/.emacs.d/themes")) + +(stante-after desktop + (setq desktop-restore-frames nil) + (setq desktop-load-locked-desktop t) + (setq desktop-clear-preserve-buffers + (append (list (rx (and bol (or (and "+" (1+ nonl)) + "dailies" "work" "tasks" "org" + (or "bookmarks.org" + "contacts.org")) eol)) + (rx (or "*ielm*" "*-jabber-roster-*" "*eshell*" + "*ansi-term*" "*slime-repl sbcl*" + "*slime-events*")) + (rx (and "*" (or "magit" "scratch-") (1+ nonl) + "*")) + (rx (or "irc.freenode.net:6667" + (and "#" (1+ nonl))))) + desktop-clear-preserve-buffers)) + (setq desktop-files-not-to-save + (rx (or (regexp "\\(^/[^/:]*:\\|(ftp)$\\)") + (and "/" (or "dailies" "tasks" "org" "bookmarks.org" + "contacts.org" "work") eol)))) + (add-to-list 'desktop-globals-to-clear 'desktop-dirname)) + +(stante-after dired + (add-hook 'dired-mode-hook #'oni:set-keys-for-dired)) + +(stante-after eap + (setq eap-music-library "/mnt/music") + (setq eap-playlist-library "~/music/playlists")) + +(stante-after ediff-wind + (setq ediff-window-setup-function 'ediff-setup-windows-plain)) + +(stante-after eltuki + (setq eltuki-blog-dir "~/documents/blog")) + +(stante-after em-prompt + (setq eshell-highlight-prompt nil) + (setq eshell-prompt-function 'oni:eshell-prompt) + (setq eshell-prompt-regexp "^[~/].* > ")) + +(stante-after em-term + (add-to-list 'eshell-visual-commands "unison")) + +(stante-after emms + (emms-minimalistic) + (emms-default-players) + + (require 'emms-player-mpd) + (require 'emms-mode-line)) + +(stante-after emms-mode-line + (setq emms-mode-line-mode-line-function 'oni:mode-line-current-song) + (emms-mode-line 1)) + +(stante-after emms-player-mpd + (add-to-list 'emms-player-list 'emms-player-mpd) + (setq emms-player-mpd-music-directory "/mnt/music/mp3")) + +(stante-after erc + (setq erc-hide-list '("PART")) + (setq erc-nick "ryuslash")) + +(stante-after erc-join + (setq erc-autojoin-channels-alist + '(("freenode.net" "#ninthfloor" "#emacs" "#dispass")))) + +(stante-after erc-stamp + (setq erc-insert-timestamp-function 'erc-insert-timestamp-left) + (setq erc-timestamp-format "[%H:%M] ") + (setq erc-timestamp-only-if-changed-flag nil)) + +(stante-after esh-mode + (add-to-list 'eshell-output-filter-functions #'oni:eshell-handle-url) + (add-to-list 'eshell-output-filter-functions #'eshell-truncate-buffer)) + +(stante-after evil + (evil-define-operator oni:evil-sort-operator (beg end) + "Sort text." + :move-point nil + :type line + (sort-lines nil beg end)) + + (mapc (lambda (mode) (evil-set-initial-state mode 'emacs)) + '(jabber-roster-mode grep-mode avandu-overview-mode + avandu-article-mode gnus-summary-mode + gnus-article-mode gnus-group-mode + magit-status-mode magit-key-mode + sql-interactive-mode Info-mode + jabber-chat-mode diff-mode prodigy-mode + calculator-mode messages-buffer-mode + help-mode)) + (evil-set-initial-state 'git-commit-mode 'normal) + (require 'evil-nerd-commenter) + (define-key evil-normal-state-map ",s" 'oni:evil-sort-operator) + (add-hook 'before-save-hook #'oni:maybe-switch-to-normal-state)) + +(stante-after eww + (setq eww-download-path ; Don't go to ~/Downloads + "~/downloads/")) + +(stante-after files + (setq-default require-final-newline t) + (setq auto-mode-case-fold nil) + (setq auto-save-file-name-transforms + `((".*" "~/.local/share/emacs/autosave/" t))) + (setq backup-directory-alist + `((".*" . "~/.local/share/emacs/backup/"))) + (setq auto-mode-alist + (append '(("/PKGBUILD$" . sh-mode) + (".install$" . sh-mode) + ("\\.jl$" . sawfish-mode) + ("\\.js\\(on\\)?$" . js2-mode) + ("\\.m\\(ark\\)?d\\(?:o?wn\\)?$" . markdown-mode) + ("\\.php[345]?$" . php-mode) + ("\\.po\\'\\|\\.po\\." . po-mode) + ("\\.tm?pl$" . html-mode) + ("^\\.Xmodmap$" . xmodmap-mode)) + auto-mode-alist))) + +(stante-after fill-column-indicator + (setq fci-rule-column 73)) + +(stante-after fiplr + (add-to-list 'fiplr-root-markers ".emacs.desktop") + (push "*.pyc" (cadr (assoc 'files fiplr-ignored-globs))) + (push "*.cache" (cadr (assoc 'files fiplr-ignored-globs))) + (push "*.elc" (cadr (assoc 'files fiplr-ignored-globs))) + (push ".emacs.desktop*" (cadr (assoc 'files fiplr-ignored-globs))) + (push ".cask" (cadr (assoc 'directories fiplr-ignored-globs))) + (push "migrations" (cadr (assoc 'directories fiplr-ignored-globs))) + (push "vendor-lisp" (cadr (assoc 'directories fiplr-ignored-globs)))) + +(stante-after flycheck + (mapc (lambda (c) (delq c flycheck-checkers)) + '(python-pylint python-pyflakes)) + (setf flycheck-highlighting-mode 'columns) + (require 'flycheck-commit-check) + (setq flycheck-display-errors-function + #'flycheck-pos-tip-error-messages)) + +(stante-after geiser-repl + (setq geiser-repl-history-filename "~/.emacs.d/geiser-history")) + +(stante-after gnutls + (add-to-list + 'gnutls-trustfiles + (expand-file-name "~/ssl_20130810/sub.class1.server.ca.pem"))) + +(stante-after grep + (add-to-list 'grep-find-ignored-directories "migrations") + (add-to-list 'grep-find-ignored-directories "vendor") + (add-to-list 'grep-find-ignored-directories "tmp") + (add-to-list 'grep-find-ignored-directories "log") + (add-to-list 'grep-find-ignored-files "TAGS")) + +(stante-after help-at-pt + (setq help-at-pt-display-when-idle t)) + +(stante-after ido + (setq ido-ignore-buffers + (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:" + (rx (or "*-jabber-roster-*" "*Messages*" "*fsm-debug*" + "*magit-process*" "*magit-edit-log*" "*Backtrace*" + "*Ibuffer*")))) + (setq ido-auto-merge-work-directories-length -1) + (setq ido-default-buffer-method 'pop-to-buffer) + (setq ido-max-window-height 1) + (setq ido-save-directory-list-file nil) + (setq ido-enable-flex-matching t) + (setq ido-use-faces nil)) + +(stante-after imenu + (setq imenu-auto-rescan t)) + +(stante-after jabber (load "jabber-init")) + +(stante-after jedi + (setq jedi:tooltip-method nil)) + +(stante-after jit-lock + (setq jit-lock-defer-time 0.2)) + +(stante-after magit + (setq magit-repo-dirs '("~/projects/")) + (setq magit-diff-refine-hunk 'all)) + +(stante-after message + (setq message-send-mail-function 'message-send-mail-with-sendmail) + (setq message-sendmail-extra-arguments '("-a" "ryuslash"))) + +(stante-after minibuf-eldef + (setq minibuffer-eldef-shorten-default t)) + +(stante-after mouse + (setq mouse-yank-at-point t)) + +(stante-after org + (require 'org-init) + (setq org-special-ctrl-a/e t)) + +(stante-after org2blog + (setq org2blog/wp-blog-alist + '(("ryublog" + :url "https://ryuslash.org/blog/xmlrpc.php" + :username "ryuslash")))) + +(stante-after "paragraphs" + (setq sentence-end-double-space nil)) + +(stante-after php-mode + (setq-default php-mode-warn-if-mumamo-off nil) + (setq php-function-call-face 'font-lock-function-name-face) + (setq php-mode-force-pear t)) + +(stante-after prodigy + (prodigy-define-service + :name "Python test mailserver" + :command "python" + :args '("-m" "smtpd" "-n" "-c" "DebuggingServer" "localhost:1025") + :tags '(work mail) + :kill-process-buffer-on-stop t) + + (prodigy-define-service + :name "Picturefix mollie-bank" + :command "bundle" + :args '("exec" "mollie-bank") + :cwd "~/projects/work/photension/picturefix" + :path '("~/.rbenv/shims") + :tags '(work) + :kill-signal 'sigkill) + + (prodigy-define-service + :name "Picturefix" + :command "bundle" + :args '("exec" "rails" "s") + :cwd "~/projects/work/photension/picturefix" + :path '("~/.rbenv/shims") + :tags '(work) + :kill-signal 'sigkill) + + (prodigy-define-service + :name "Picturefix sidekiq" + :command "bundle" + :args '("exec" "sidekiq") + :cwd "~/projects/work/photension/picturefix" + :path '("~/.rbenv/shims") + :tags '(work) + :kill-signal 'sigkill)) + +(stante-after python-environment + (setcar python-environment-virtualenv "virtualenv2")) + +(stante-after scheme + (require 'ac-geiser)) + +(stante-after sendmail + (setq send-mail-function 'sendmail-send-it) + (setq sendmail-program "/usr/bin/msmtp")) + +(stante-after simple + (setq read-mail-command 'gnus) + (define-key special-mode-map "z" #'kill-this-buffer)) + +(with-eval-after-load 'slime + (setq slime-lisp-implementations + '((sbcl ("sbcl" "--noinform") :coding-system utf-8-unix) + (clisp ("clisp") :coding-system utf-8-unix)) + slime-default-lisp 'sbcl)) + +(stante-after smex + (setq smex-key-advice-ignore-menu-bar t) + (setq smex-save-file "~/.emacs.d/smex-items")) + +(stante-after "startup" + (setq inhibit-default-init t) + (setq inhibit-startup-message t) + (setq initial-major-mode 'emacs-lisp-mode) + (setq initial-scratch-message nil)) + +(stante-after tern + (require 'tern-auto-complete) + (tern-ac-setup)) + +(stante-after time-stamp + (setq time-stamp-active t) + (setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)")) + +(stante-after type-break + (setq type-break-good-rest-interval (* 60 10)) + (setq type-break-interval (* 60 50)) + (setq type-break-keystroke-threshold '(nil . nil))) + +(stante-after uniquify + (setq uniquify-buffer-name-style 'post-forward)) + +(stante-after w3m + (setq w3m-fill-column 72)) + +(stante-after "window" + (setq split-height-threshold 40) + (add-to-list + 'display-buffer-alist + '("^\\*\\(?:.+-\\)?scratch\\*$" display-buffer-same-window)) + (add-to-list + 'display-buffer-alist + '("^\\*magit: .*\\*$" display-buffer-same-window))) + +(stante-after woman + (setq woman-fill-column 72)) + +(stante-after yasnippet + (setq yas-fallback-behavior nil) + (setq yas-prompt-functions '(yas-ido-prompt))) + +;;;; Hooks + +(add-hook 'after-save-hook 'oni:after-save-func t) +(add-hook 'before-save-hook 'oni:before-save-func) +(add-hook 'comint-mode-hook #'oni:turn-on-compilation-shell-for-pony) +(add-hook 'css-mode-hook #'rainbow-mode) +(add-hook 'diary-display-hook 'oni:diary-display-func) +(add-hook 'git-commit-mode-hook #'oni:set-ispell-local-en-dict) +(add-hook 'haskell-mode-hook 'oni:haskell-mode-func) +(add-hook 'js-mode-hook #'moz-minor-mode) +(add-hook 'outline-minor-mode-hook #'oni:set-tab-maybe-toggle-outline) +(add-hook 'slime-mode-hook #'set-up-slime-ac) +(add-hook 'sql-interactive-mode-hook #'oni:augment-sql-prompt) +(add-hook 'term-mode-hook 'oni:term-mode-func) +(add-hook 'vala-mode-hook #'oni:vala-mode-func) +(add-hook 'write-file-hooks 'oni:write-file-func) +(add-hook 'yas-global-mode-hook 'oni:yas-minor-mode-func) +(add-hook 'scheme-mode-hook (lambda () (setq ac-sources '(ac-source-geiser)))) +(add-hook 'java-mode-hook #'oni:electric-pair-local-mode) + +(oni:add-function-to-hooks #'flycheck-mode + 'perl-mode-hook 'rst-mode-hook 'rust-mode-hook 'sh-mode-hook + 'git-commit-mode-hook) + +(oni:add-function-to-hooks #'oni:make-readable + 'Info-mode-hook 'gnus-article-mode-hook 'gnus-group-mode-hook + 'org-agenda-mode-hook) + +(oni:add-function-to-hooks #'paredit-mode + 'clojure-mode-hook 'geiser-repl-mode-hook 'sawfish-mode-hook + 'scheme-mode-hook) + +(oni:add-function-to-hooks #'hl-sexp-mode + 'clojure-mode-hook 'geiser-repl-mode-hook 'sawfish-mode-hook + 'scheme-mode-hook) + +(oni:add-hooks 'c-mode-hook + #'oni:c-mode-func #'oni:electric-pair-local-mode) + +(oni:add-hooks 'emacs-lisp-mode-hook + (lambda () + (setf ac-sources '(ac-source-emacs-lisp-features + ac-source-functions + ac-source-variables + ac-source-symbols))) + #'oni:locally-enable-double-spaces #'oni:set-emacs-lisp-symbols + #'paredit-mode #'flycheck-mode #'eldoc-mode #'oni:set-emacs-lisp-keys + #'hl-sexp-mode) + +(oni:add-hooks 'eshell-mode-hook + #'buffer-disable-undo #'oni:set-keys-for-eshell + #'eshell-fringe-status-mode) + +(oni:add-hooks 'gnus-summary-mode-hook + #'oni:make-readable (lambda () + (local-set-key (kbd "M-d") (lambda () + (interactive) + (gnus-summary-delete-article) + (gnus-summary-next-subject 1))))) + +(oni:add-hooks 'go-mode-hook + #'oni:go-mode-func #'flycheck-mode) + +(oni:add-hooks 'html-mode-hook + #'flycheck-mode #'oni:maybe-fci-mode #'tagedit-mode #'turn-off-flyspell + #'turn-off-auto-fill) + +(oni:add-hooks 'hy-mode-hook + #'paredit-mode #'oni:set-keys-for-hy #'hl-sexp-mode) + +(oni:add-hooks 'ielm-mode-hook + #'paredit-mode #'eldoc-mode #'oni:set-emacs-lisp-keys #'hl-sexp-mode) + +(oni:add-hooks 'jabber-chat-mode-hook + #'oni:set-keys-for-jabber-chat #'oni:make-readable + #'oni:reset-default-directory) + +(oni:add-hooks 'js2-mode-hook + #'tern-mode #'moz-minor-mode #'oni:electric-pair-local-mode) + +(oni:add-hooks 'lisp-mode-hook + (lambda () (setf ac-sources '(ac-source-slime-simple))) + #'oni:set-emacs-lisp-symbols #'paredit-mode #'hl-sexp-mode) + +(oni:add-hooks 'lua-mode-hook + #'oni:lua-mode-func #'flycheck-mode #'oni:electric-pair-local-mode) + +(oni:add-hooks 'markdown-mode-hook + #'whitespace-mode #'oni:markdown-mode-func) + +(oni:add-hooks 'php-mode-hook + #'oni:php-mode-func #'flycheck-mode) + +(oni:add-hooks 'prog-mode-hook + #'oni:prog-mode-func #'oni:maybe-fci-mode #'rainbow-delimiters-mode + #'oni:maybe-prettify-symbols-mode) + +(oni:add-hooks 'python-mode-hook + (lambda () (setq ac-sources '(ac-source-jedi-direct))) + #'oni:set-python-symbols #'flycheck-mode #'whitespace-mode + #'oni:python-mode-func #'oni:set-python-imenu-function + #'jedi:setup #'subword-mode #'oni:electric-pair-local-mode) + +(oni:add-hooks 'ruby-mode-hook + #'flycheck-mode #'oni:electric-pair-local-mode) + +(oni:add-hooks 'slime-repl-mode-hook + #'paredit-mode #'set-up-slime-ac #'hl-sexp-mode) + +(oni:add-hooks 'tagedit-mode-hook + #'tagedit-add-experimental-features + #'tagedit-add-paredit-like-keybindings #'oni:set-keys-for-tagedit) + +(oni:add-hooks 'texinfo-mode-hook + #'flycheck-mode #'outline-minor-mode) + +(oni:add-hooks 'text-mode-hook + #'auto-fill-mode #'flyspell-mode #'oni:make-readable) + +;;;; Keybindings + +(global-set-key (kbd "'") 'oni:self-insert-dwim) +(global-set-key (kbd "") 'oni:raise-scratch) +(global-set-key (kbd "") 'gnus) +(global-set-key (kbd "") 'git-project-show-files) +(global-set-key (kbd "") #'oni:reload-buffer) +(global-set-key (kbd "") 'magit-status) +(global-set-key (kbd "") #'oni:raise-eshell) +(global-set-key (kbd "") 'oni:show-org-index) +(global-set-key (kbd "") 'oni:scroll-up-or-next-page) +(global-set-key (kbd "") 'oni:scroll-down-or-prev-page) +(global-set-key (kbd "C-. C-.") #'oni:switch-to-other-buffer) +(global-set-key (kbd "C-<") 'indent-shift-left) +(global-set-key (kbd "C->") 'indent-shift-right) +(global-set-key (kbd "C-M-4") 'split-window-vertically) +(global-set-key (kbd "C-M-SPC") 'er/expand-region) +(global-set-key (kbd "C-M-d") 'kill-word) +(global-set-key (kbd "C-M-w") 'backward-kill-word) +(global-set-key (kbd "C-M-x") 'smex-major-mode-commands) +(global-set-key (kbd "C-M-z") 'indent-defun) +(global-set-key (kbd "C-S-k") 'kill-whole-line) +(global-set-key (kbd "C-c +") #'oni:increase-number-at-point) +(global-set-key (kbd "C-c -") #'oni:decrease-number-at-point) +(global-set-key (kbd "C-c Q") #'delete-other-windows) +(global-set-key (kbd "C-c R") #'delete-window) +(global-set-key (kbd "C-c S") #'split-window-right) +(global-set-key (kbd "C-c a") 'org-agenda) +(global-set-key (kbd "C-c c") 'org-capture) +(global-set-key (kbd "C-c d c") 'desktop-clear) +(global-set-key (kbd "C-c d d") 'desktop-registry-change-desktop) +(global-set-key (kbd "C-c d k") #'desktop-registry-remove-desktop) +(global-set-key (kbd "C-c d s") 'desktop-save-in-desktop-dir) +(global-set-key (kbd "C-c g b") 'magit-checkout) +(global-set-key (kbd "C-c g f") 'magit-fetch) +(global-set-key (kbd "C-c g i") 'magit-init) +(global-set-key (kbd "C-c g s") 'magit-status) +(global-set-key (kbd "C-c h r") 'hypo-region) +(global-set-key (kbd "C-c i p") 'identica-update-status-interactive) +(global-set-key (kbd "C-c m") 'gnus) +(global-set-key (kbd "C-c p") 'oni:show-buffer-position) +(global-set-key (kbd "C-c s") #'split-window-below) +(global-set-key (kbd "C-c t") 'oni:raise-ansi-term) +(global-set-key (kbd "C-c u") #'upcase-transient-mode) +(global-set-key (kbd "C-c w d") 'oni:downcase-prev) +(global-set-key (kbd "C-c w u") 'oni:upcase-prev) +(global-set-key (kbd "C-e") 'oni:move-end-of-dwim) +(global-set-key (kbd "C-x 4 f") #'fiplr-find-file-other-window) +(global-set-key (kbd "C-x 5 f") #'fiplr-find-file-other-frame) +(global-set-key (kbd "C-x 8 e") "€") +(global-set-key (kbd "C-x C-b") 'ibuffer) +(global-set-key (kbd "C-x f") 'fiplr-find-file) +(global-set-key (kbd "M-0") 'delete-window) +(global-set-key (kbd "M-1") 'delete-other-windows) +(global-set-key (kbd "M-2") 'split-window-below) +(global-set-key (kbd "M-3") 'split-window-right) +(global-set-key (kbd "M-4") 'split-window-horizontally) +(global-set-key (kbd "M-n") 'idomenu) +(global-set-key (kbd "M-o") 'other-window) +(global-set-key (kbd "M-x") 'smex) +(global-set-key (kbd "\"") 'oni:self-insert-dwim) +(global-set-key [remap move-beginning-of-line] #'oni:move-beginning-of-dwim) +(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) +(global-set-key (kbd "M-+") 'mc/mark-next-like-this) +(global-set-key (kbd "M--") 'mc/mark-previous-like-this) +(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) + +;;;; Misc modes + +(oni:enable '(downcase-region narrow-to-page narrow-to-region scroll-left + upcase-region)) + +(oni:link-modes outline-minor-mode persistent-outline-mode) +(oni:exclude-modes magit-blame-mode fci-mode) + +(oni:eval-after-init + (require 'auto-complete-config) + (ac-config-default) + + (ido-ubiquitous-mode) + (smex-initialize) + (global-diff-hl-mode) + (mode-icons-mode) + (desktop-registry-auto-register) + (yas-global-mode) + + (require 'popwin) + (popwin-mode) + + (evil-mode) + (require 'colemak-evil) + (global-evil-surround-mode)) + +(when (equal system-name "drd") + (load "eap-autoloads")) + +(auto-insert-mode) +(electric-indent-mode -1) +(ido-mode 1) +(minibuffer-electric-default-mode) +(savehist-mode) +(show-paren-mode) +(winner-mode) + +(help-at-pt-set-timer) +(windmove-default-keybindings) + +(load system-name :noerror) + +;;;; End + +(provide 'init) +;;; init.el ends here diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org new file mode 100644 index 0000000..1031ae2 --- /dev/null +++ b/emacs/.emacs.d/init.org @@ -0,0 +1,960 @@ +#+TITLE: Emacs init +#+PROPERTY: tangle init2.el +#+STARTUP: showall +#+OPTIONS: author:nil num:nil toc:nil +#+MACRO: key @@html:$1@@@@ascii:`$1'@@ +#+HTML_HEAD: + +* About this file + + Inspired by such other projects as the literal Emacs init from [[http://sachac.github.io/.emacs.d/Sacha.html][Sacha + Chua]] and also from [[http://www.wisdomandwonder.com/wordpress/wp-content/uploads/2014/03/C3F.html][Grant Rettke]], here is my Emacs initialization + file. + + *Note:* This is not my entire Emacs initialization file. It's a + work-in-progress. To keep on top of any changes to this file, or any + other part of my Emacs init, I recommend you follow [[http://code.ryuslash.org/dot/tom/emacs/][This project]] + ([[http://code.ryuslash.org/dot/tom/emacs/atom/?h=master][Atom feed]]), which is where I keep my configuration. + +** Preparation + + I could use org-babel to load this file, but I don't like my + initialization file being dependent on too many things, especially + big things, and org is a big thing. It may be strange for you to + read this, as I have placed my entire Emacs configuration in an + org-mode file, but here are the make targets I use to tangle and + subsequently byte-compile my init file: + + #+BEGIN_SRC makefile :tangle no + %.elc: %.el + emacs -Q -batch -eval "(byte-compile-file \"$<\")" + + init.el: init.org + emacs -Q -batch -l "ob-tangle" -eval "(org-babel-tangle-file \"init.org\") + #+END_SRC + + Executing the second target (either through make, or manually) will + get you my Emacs initialization file in plain Emacs Lisp. + + *Note:* If you look at this file in it's org-mode form you will + notice that I actually tangle ~init.org~ into ~init2.el~. This is a + temporary measure so that I can gradually move my configuration + from my existing ~init.el~ file into ~init.org~ without much trouble. + Once I've emptied out my ~init.el~ I will instruct babel to tangle + into ~init.el~, this code already reflects that. + +** The ~oni:~ prefix + + To keep my functions and variables from ever accidentally + interfering with other packages or Emacs internal variables I + prefix all the functions I write and variables I declare with ~oni:~. + You don't have to copy it if you copy anything from this file, as + long as you do it consistently. + +* Use lexical binding + + For some of these functions, and general coolness, lexical binding + is a must. Without it, closures cannot be made. + + #+BEGIN_SRC emacs-lisp :padline no + ;; -*- lexical-binding: t -*- + #+END_SRC + +* Set some personal information + + This information is used by some emacs commands and modules to make + your life easier. + + #+BEGIN_SRC emacs-lisp + (setq user-full-name "Tom Willemse" + user-mail-address "tom@ryuslash.org") + #+END_SRC + +* Clean up some UI elements + + Some elements are only really useful if you use the mouse. Which I + don't, not if I can help it. Only when browsing the web or using the + odd graphical application do I touch the mouse, and even then as + little as I can. + +** Menu bar + + The menu bar is one of the UI elements which work best with mouses. + Sure you can change your toolkit's key bindings to allow you to + more easily navigate, but {{{key(M-x)}}} or {{{key(M-`)}}}[fn:1] + are easier if you don't use the mouse. Long story short: It has got + to go. + + #+BEGIN_SRC emacs-lisp + (menu-bar-mode -1) + #+END_SRC + +** Tool bar + + The toolbar is another such thing, and it takes up quite a bit more + space too. Icons can look pretty cool, but in the end if you're not + going to click them they don't really server much of a purpose. + Again: It has got to go. + + #+BEGIN_SRC emacs-lisp + (tool-bar-mode -1) + #+END_SRC + +** Blinking cursor + + I suppose a blinking cursor doesn't get lost very easily. But on + the other hand, it can induce quite a few more headaches. + + I've noticed that I don't really lose my cursor position all that + much, really, so there doesn't seem to be any point in making it + blink. Here we go again: It has got to go. + + #+BEGIN_SRC emacs-lisp + (blink-cursor-mode -1) + #+END_SRC + +** Line numbers + + As I'm currently using svg-mode-line-themes[fn:2] for my ~mode-line~ I + don't need to show these. Also I didn't really use them much, I + don't often need to know what line I'm on. + + #+BEGIN_SRC emacs-lisp + (line-number-mode -1) + #+END_SRC + +** Tooltips + + Tooltips are another one of those UI elements that aren't quite + keyboard-friendly. As usually this information is shown just as well + in the echo area, this is not necessary. + + #+BEGIN_SRC emacs-lisp + (tooltip-mode -1) + #+END_SRC + +** Cursor type + + I prefer using a bar as a cursor, as opposed to a box. Using a bar + is a better way of representing the location of the cursor, in my + opinion. + + #+BEGIN_SRC emacs-lisp + (setq-default cursor-type 'bar) + #+END_SRC + +** Cursors in inactive windows + + I use a bar cursor that's already pretty thin, so having an even + thinner one in inactive windows is not very clear. Even when I + was using a box cursor I didn't like seeing a hollow box everywhere + my focus /wasn't/. + + #+BEGIN_SRC emacs-lisp + (setq-default cursor-in-non-selected-windows nil) + #+END_SRC + +** Long lines + + Sometimes, very long lines can't help but show up in code. The + default of wrapping lines around to the next line and showing an + image in the fringe is very visually disturbing to me when looking + at code[fn:3]. So I prefer to have it just run off the screen. + + #+BEGIN_SRC emacs-lisp + (setq-default truncate-lines t) + #+END_SRC + +** The default frame + + Usually, most of these settings would be done with functions like + =set-frame-font= or =scroll-bar-mode=, but working with the Emacs + Daemon sometimes creates extra complications, because you might + start a graphical environment at some point (I usually do + immediately), but the startup process isn't. + +*** Internal border + + Set the internal border width to 0. This makes a small difference, + with my current setup it causes my window's width to increase from + 120 to 121. Small, I know, but I'm very greedy when it comes to + screen space. + + #+NAME: default-frame-internal-border + #+BEGIN_SRC emacs-lisp :tangle no + (internal-border-width . 0) + #+END_SRC + +*** A fantastic font + + I've tried several fonts, and all of them were nice, but came up + short on some way. Some didn't have italic variants, some had + dotted zeroes instead of dashed zeroes, some even had entirely + clear zeroes which make them look like ~O~'s, others had + boring-looking parentheses[fn:4]. Not Fantasque Sans + Mono[fn:5][fn:6], it is awesome. If your web browser supports web + fonts you should also see it used in the code blocks here. + + For normal Emacs setups you might use the =set-frame-font= function + like so: + + #+BEGIN_SRC emacs-lisp :tangle no + (set-frame-font "Fantasque Sans Mono 13" nil t) + #+END_SRC + + However, this doesn't work when running Emacs as a Daemon. You + could (especially with lexical binding) add an + =after-make-frame-functions= hook or something similar, but I find + it easier to just specify the font in the =default-frame-alist=. + + #+NAME: default-frame-font + #+BEGIN_SRC emacs-lisp :tangle no + (font . "Fantasque Sans Mono:pixelsize=17") + #+END_SRC + +*** Scroll bar + + The scroll-bar is almost just as informative as the current line + number and buffer position information shown in the (my) mode + line. As I don't usually need to know where I am, other than the + current line number occasionally, and I don't use the mouse, the + scroll bar doesn't add anything and only takes up space. Once + more: It has got to go. + + Normally you would use something along the lines of: + + #+BEGIN_SRC emacs-lisp :tangle no + (scroll-bar-mode -1) + #+END_SRC + + However, this doesn't work when running Emacs as a Daemon. So + instead I specify it in the =default-frame-alist=. + + #+NAME: default-frame-scroll-bar + #+BEGIN_SRC emacs-lisp :tangle no + (vertical-scroll-bars . nil) + #+END_SRC + +*** Setting the option + + So I've explained the reasons for each individual setting, but to + get them to work they have to be put in the =default-frame-alist=. + Here is the final setting: + + #+BEGIN_SRC emacs-lisp :noweb yes + (setq default-frame-alist + `(<> + <> + <>)) + #+END_SRC + +** Frame title + + Show the buffer name in the frame title to make multiple frames + identifiable by the buffer they're showing. + + #+BEGIN_SRC emacs-lisp + (setq frame-title-format '(:eval (concat "GNU Emacs: " (buffer-name)))) + #+END_SRC + +** Don't show dialog boxes + + Unfortunately this doesn't remove /all/ dialog boxes, but at least it + keeps some of them from popping up. According to the docstring it + should only change anything for when the mouse is used, which I + don't ever do, but I still feel safer keeping this in my + configuration. + + #+BEGIN_SRC emacs-lisp + (setq use-dialog-box nil) + #+END_SRC + +** Split windows equally + + When splitting windows, give them all an equal amount of space. For + those very few time that I have more than two windows in my Emacs + frame it is much nicer to have each of them get ~33% space instead + of 50%, 25% and 25%. The way I have my desktop set-up I don't ever + split my windows horizontally. + + #+BEGIN_SRC emacs-lisp + (setq window-combination-resize t) + #+END_SRC + +** Keep the cursor steady when scrolling + + When scrolling through the buffer with, for example, {{{key(C-v)}}} + or {{{key(M-v)}}}, I find it much more intuitive to have the cursor + stay in the relative screen position from before. Otherwise I get + confused every time. + + #+BEGIN_SRC emacs-lisp + (setq scroll-preserve-screen-position t) + #+END_SRC + +** Don't show a mode line for completions + + One of the things I dislike about Emacs is its rigidity concerning + windows and other UI elements. One very simple way to make it + /feel/ less so is to show less of it where possible. A mode line for + completion buffers creates more separation than necessary, and I + can't recall a single time where I've used the completion's mode + line for anything. + + #+BEGIN_SRC emacs-lisp + (add-hook 'completion-list-mode-hook + (lambda () (setq mode-line-format nil))) + #+END_SRC + +* Add org-mode appointments to the diary + + Diary offers reminders, which can be useful when scheduling + appointments. + + #+BEGIN_SRC emacs-lisp + (defadvice org-agenda-redo (after ext:org-agenda-redo-add-appts) + "Pressing `r' on the agenda will also add appointments." + (setq appt-time-msg-list nil) + (org-agenda-to-appt)) + #+END_SRC + +* Close ansi-term buffer after exit + + After the ansi-term process ends it leaves a buffer. I don't use + ansi term in such a way that this has ever been useful, so just kill + the ansi-term buffer after the process quits, no matter the exit + status. Usually this comes about when I press {{{kbd(C-d)}}} at the + command prompt. + + #+BEGIN_SRC emacs-lisp + (defadvice term-handle-exit (after oni:kill-buffer-after-exit activate) + "Kill the term buffer if the process finished." + (kill-buffer (current-buffer))) + #+END_SRC + +* Stumpwm integration + + This variable, macro and function help with integrating Emacs and + Stumpwm. They are used by some other functions to make the two seem + extra connected. + + #+BEGIN_SRC emacs-lisp + (defvar oni:stumpish-program + (expand-file-name + "~/.local/share/quicklisp/local-projects/stumpwm/contrib/util/stumpish/stumpish") + "The location of the stumpish executable.") + + (defmacro oni:stumpwm (&rest body) + "Execute BODY in stumpwm." + (declare (indent 0)) + `(call-process oni:stumpish-program nil nil nil + ,(format "eval '%S'" `(progn ,@body)))) + + (defun oni:stumpwm-command (cmd) + "Execute CMD in stumpwm." + (call-process oni:stumpish-program nil nil nil cmd)) + + (defun oni:stumpwm-echo (message) + (call-process oni:stumpish-program nil nil nil (format "echo %s" message))) + #+END_SRC + +** Fall back on stumpwm when moving around + + Using the function specified in [[Stumpwm integration]] wrap the + =windmove-do-window-select= function and catch any error produced, + hoping it's the error that there's no more window to move to and + then request that stumpwm move the focus in the same direction as + windmove would have. + + #+BEGIN_SRC emacs-lisp + (defadvice windmove-do-window-select + (around oni:windmove-stumpwm activate) + "If no window can be moved to, move stumpwm." + (condition-case err + ad-do-it + (error (oni:stumpwm-command + (format "move-focus %s" (ad-get-arg 0)))))) + #+END_SRC + +* Don't just quit Emacs with {{{key(C-x C-c)}}} in the daemon + + When working with Emacs as a daemon, which I do almost all of the + time, I prefer using {{{key(C-x C-c)}}} to close the current frame + instead of the entire session. Before this change I would + occasionally close my session by mistake. + + #+BEGIN_SRC emacs-lisp + (defun oni:close-client-window () + "Close a client's frames." + (interactive) + (server-save-buffers-kill-terminal nil)) + + (when (daemonp) + (global-set-key (kbd "C-x C-c") 'oni:close-client-window)) + #+END_SRC + +* Don't minimize the frame with {{{key(C-z)}}} + + One of the more annoying things that can happen is accidentally + minimizing the frame you're working with. This doesn't really matter + if you're working on a normal stacking window manager, but with a + tiling window manager and no task bar this just causes the Emacs + frame to hang until it is refocused or disappear with no way to get + it back. + + #+BEGIN_SRC emacs-lisp + (when (or window-system (daemonp)) + (global-unset-key (kbd "C-z"))) + #+END_SRC + +* Use the right dictionary + + One of the caveats of using two (or more) languages in a single + installation of Gnus is that ispell sometimes gets confused. Having + come across a stackoverflow question[fn:7] about just this subject + it was easy to modify the source code posted there to come up with + this. + + *Note:* See my [[Function declarations][note]] on function declarations about the use of + =declare-function=. + + #+BEGIN_SRC emacs-lisp + (declare-function message-narrow-to-headers-or-head "message") + (declare-function message-fetch-field "message") + + (defun oni:switch-ispell-dictionary () + (save-excursion + (message-narrow-to-headers-or-head) + (let ((from (message-fetch-field "From"))) + (ispell-change-dictionary + (if (string-match (rx "@aethon.nl>" eol) from) "nl" "en"))))) + + (add-hook 'message-setup-hook 'oni:switch-ispell-dictionary) + #+END_SRC + +* Don't let shr use background color + + Reading mail in Gnus is very nice, but shr has become a little too + good at its job. Add to this the many occasions when a background is + specified without specifying a foreground, plus a color theme that + is the inverse of what is usually expected, and you can get + hard-to-read HTML messages, gray foreground and gray background. + + I've looked at the other possible renderers, but they don't look + very nice compared to shr. So just remove its ability to add + background colors. + + *Note:* See my [[Function declarations][note]] on function declarations about the use of + =declare-function=. + + #+BEGIN_SRC emacs-lisp + (declare-function shr-colorize-region "shr") + + (defun oni:shr-colorize-remove-last-arg (args) + "If ARGS has more than 3 items, remove the last one." + (if (> (length args) 3) + (butlast args) + args)) + + (with-eval-after-load 'shr + (advice-add #'shr-colorize-region :filter-args + #'oni:shr-colorize-remove-last-arg)) + #+END_SRC + +* Optimized ~with-eval-after-load~ + + First offered [[http://www.lunaryorn.com/2013/05/01/byte-compiling-eval-after-load.html][here]] and then later updated [[http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load.html][here]] (when + ~with-eval-after-load~ was added). Makes for very nice on-demand + settings loading. + + #+BEGIN_SRC emacs-lisp + ;; http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load/ + (defmacro stante-after (feature &rest forms) + "After FEATURE is loaded, evaluate FORMS. + + FEATURE may be an unquoted feature symbol or a file name, see + `eval-after-load'." + (declare (indent 1) (debug t)) + `(,(if (or (not byte-compile-current-file) + (if (symbolp feature) + (require feature nil :noerror) + (load feature :no-message :no-error))) + `progn + (message "stante-after: cannot find %s" feature) + 'with-no-warnings) + (with-eval-after-load ',feature ,@forms))) + #+END_SRC + +* Remember SQL input + + Remembering input between sessions is a good thing. + + #+BEGIN_SRC emacs-lisp + (stante-after sql + (setf sql-input-ring-file-name + (expand-file-name "~/.emacs.d/sqliinput"))) + #+END_SRC + +* Lazily load some buffers + + Don't load all buffers right away. Having a lot of buffers and + switching between projects a lot can take up quite a bit of time. + + *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=. + + #+BEGIN_SRC emacs-lisp + (defvar desktop-restore-eager) + (setq desktop-restore-eager 5) + #+END_SRC + +* Fix some term keybindings + + =ansi-term= passes along a lot of characters correctly, but things + like =forward-delete-word= are not, by default. This is confusing when + you see one thing and another is sent. Passing the correct keys + directly to the terminal fixes this problem. + + *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=. + + *Note:* See my [[Function declarations][note]] on function declarations about the use of + =declare-function=. + + #+BEGIN_SRC emacs-lisp + (defvar term-raw-map) + (declare-function term-send-raw-string "term") + + (defun oni:set-term-keys () + (cl-flet ((zcommand (key) + (lambda () + (interactive) (term-send-raw-string key)))) + (define-key term-raw-map + (kbd "C-") (zcommand "\C-H")))) + + (add-hook 'term-mode-hook #'oni:set-term-keys) + #+END_SRC + +* Ask for a ~y~ or ~n~, not ~yes~ or ~no~. + + Emacs starts out asking for you to type ~yes~ or ~no~ with most + important questions. It is possible that this is used for such + important questions where accidentally saying ~yes~ when you meant ~no~ + would be catastrophic (or at least could be). However, I've never + (so far) had this problem, and I find it quite tedious to have to + write out ~yes~ or ~no~ and then press {{{kbd(RET)}}}, give me a simple + ~y~ or ~n~ with no {{{kdb(RET)}}} required and I'm quite happy. + + #+BEGIN_SRC emacs-lisp + (defalias 'yes-or-no-p 'y-or-n-p) + #+END_SRC + +* Use =hippie-expand=, not =dabbrev-expand= + + I've never actually used =dabbrev-expand=, and only rarely use + =hippie-expand= really, but since =hippie-expand= also includes a + =dabbrev= expander and a lot more than just that, it seems alright to + do this. + + #+BEGIN_SRC emacs-lisp + (defalias 'dabbrev-expand 'hippie-expand) + #+END_SRC + +* Setting up =load-path= + + First, to help, I create a function that takes a path, adds it to + =load-path= and then checks to see if there is a file named + ~loaddefs.el~ in the given path. If there is, it loads it. This + ~loaddefs.el~ file is something that is created from autoload cookies + in the files in some of these paths. + + Since the =load-path= is also important during byte-compilation, this + function should be defined both at run-time and compile-time. + + #+BEGIN_SRC emacs-lisp + (eval-and-compile + (defun oni:loadpath-add-and-autoload (path) + "Add PATH to `load-path' and load a `loaddefs.el' if it exists." + (add-to-list 'load-path path) + (let ((loaddefs (concat path "/loaddefs.el"))) + (when (file-exists-p loaddefs) + (load loaddefs))))) + #+END_SRC + + After that I add some directories to my =load-path= so I can use these + libraries when wanted. One of these is the ~site-lisp~ directory in my + ~.emacs.d~ directory, which is where I keep most of my personal + non-ELPA modules (like module-specific initialization files). There + are also some directories I include in ~vendor-lisp~, which is where I + keep modules that I didn't write myself and, for some reason, can't + or don't want to use ELPA for. Again it is important to realize that + this information is relevant both at run-time and compile-time, so + we wrap it with an =eval-and-compile=. + + #+BEGIN_SRC emacs-lisp + (eval-and-compile + (mapc #'oni:loadpath-add-and-autoload + '("~/.emacs.d/site-lisp" + "~/.emacs.d/vendor-lisp/mozrepl" + "~/.emacs.d/vendor-lisp/eap" "/usr/share/emacs/site-lisp" + "/usr/lib/node_modules/tern/emacs/" + "~/.emacs.d/vendor-lisp/habitrpg.el"))) + #+END_SRC + +* Some unconditional settings + + Here are some settings that either need to be changed before certain + modules load, or that don't belong in any specific module. + +** Gnus init file + + I put my gnus initialization file right where I put all my + module-specific initialization files. Gnus is special, though: It + loads the file every time you start it. That keeps it from using a + simple =(eval-after-load 'gnus '(load "gnus-init"))=. + + *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=. + + #+BEGIN_SRC emacs-lisp + (defvar gnus-init-file) + (setq gnus-init-file "~/.emacs.d/site-lisp/gnus-init") + #+END_SRC + +** Turn off bidirectional text + + To speed things up a little, and because I have no contacts at all + (so far) who use right-to-left text, there is no reason for me to + use bidirectional text. For this reason I tell Emacs to always use + left-to-right by default, instead of checking each paragraph. + + #+BEGIN_SRC emacs-lisp + (setq-default bidi-paragraph-direction 'left-to-right) + #+END_SRC + +** Don't use tabs + + There is a war going on out there. Actually there are several, but + the one I'm talking about here is the one about tabs vs. spaces. I + have been deeply entrenched in the spaces camp for quite a while. + Indentation always gets screwy for me if I don't use the exact same + =tab-width= everyone else uses. I just like the consistency of using + spaces. + + #+BEGIN_SRC emacs-lisp + (setq-default indent-tabs-mode nil) + #+END_SRC + +** Use four spaces for indentation + + I once, long ago, started out with using eight spaces for each + level of indentation. Although I think, technically, I was using + tabs. This means that even just 3 levels of indentation take up a + /huge/ amount of space that can't be used for anything else. Since I + also try to limit the length of the lines in my code, this can make + for very little code per line. + + I also tried (and enjoyed) two spaces, but after a while, looking + at bigger files, I noticed that it all becomes a blur. Two spaces + is not a big-enough visual difference to make code read nicely, in + my opinion. + + So far, I have quite enjoyed four spaces for most code[fn:8]. + + #+BEGIN_SRC emacs-lisp + (setq-default tab-width 4) + #+END_SRC + +** Keep the message buffer from growing too large + + Keep at most one-thousand messages in the ~*Messages*~ buffer. I can + leave my Emacs session running for quite long times, sometimes + days, at a time. If there are a lot of messages it can get a little + tricky to manage/search. + + #+BEGIN_SRC emacs-lisp + (setq message-log-max 1000) + #+END_SRC + +** Don't start =elnode= when Emacs starts + + Elnode is an awesome project and I'm still looking for a moment + where I have the inspiration and time to actually do something with + it. I started at some point, but then I couldn't get the cookies to + work and I switched over to using Common Lisp, only to eventually + stop developing the project because there was not chance of it + seeing any use in the foreseeable future. + + There is one little annoyance, though, and that is the fact that + elnode will start itself up when Emacs starts. I don't want that. + + This bit of code can't be put in an =eval-after-load= or anything + like that because by the time it would be evaluated, elnode would + already have started. + + *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=. + + #+BEGIN_SRC emacs-lisp + (defvar elnode-do-init) + (setq elnode-do-init nil) + #+END_SRC + +* Show python package name instead of file name + + When working with python, knowing which package I'm in usually tells + me more about what I'm doing than the file name, especially when + working with django where almost every app will have a ~tests.py~ and + a ~models.py~. Of course =uniquify= fixes this pretty well too, though + in this case, it's less cool (imo). + + First we define two functions that help us determine the package + name of the current file and the parent package name of the current + file. Finally we define a third function which determines the full + package name of the current buffer. + + #+BEGIN_SRC emacs-lisp + (defun oni:python--get-current-module-name () + "Get the name of the current python module. + + This is very simply just the filename of the current buffer with + the extension and pyath removed." + (file-name-sans-extension + (file-name-nondirectory (buffer-file-name)))) + + (defun oni:python--get-parent-module-name (&optional dir) + "This gets the currend file's parent module. + + This function recursively gathers the parent package name of + either DIR or the current buffer's file name. Any directory where + an `__init__.py' file is found is considered to be a package. + + This function returns either the parent package, with its + parents, or nil if the current directory isn't a python + package.." + (let* ((base (directory-file-name + (file-name-directory (or dir (buffer-file-name))))) + (package (file-name-nondirectory base))) + (if (file-exists-p (concat base "/__init__.py")) + (let ((parent (oni:python--get-parent-module-name base))) + (if parent + (concat parent "." package) + package)) + nil))) + + (defun oni:python-package-name () + (let ((current-module (oni:python--get-current-module-name))) + (if (file-exists-p "__init__.py") + (concat (oni:python--get-parent-module-name) + "." current-module) + current-module))) + #+END_SRC + + After all this we make Emacs show the package name rather than the + file name in the mode-line. + + #+BEGIN_SRC emacs-lisp + (defun oni:python-package-buffer-identification () + "Have `mode-line-buffer-identification' show the python package name." + (setq mode-line-buffer-identification + '(:eval (oni:python-package-name)))) + + (add-hook 'python-mode-hook #'oni:python-package-buffer-identification) + #+END_SRC + +* Add some known symbols for .conkerorrc/init.js to js2-mode + + Conkeror has a lot of functions, and I don't like seeing them all as + unknowns. So add them to known symbols. + + *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=. + + #+BEGIN_SRC emacs-lisp + (defvar js2-additional-externs) + + (defun oni:js2-add-conkeror-symbols () + "Add known/used conkeror symbols to additional externs." + (when (string-suffix-p ".conkerorrc/init.js" (buffer-file-name)) + (setq js2-additional-externs + '( ;; Functions + "add_hook" "check_buffer" "co_return" "content_buffer" + "define_browser_object_class" "define_key" "define_webjump" + "dumpln" "get_current_profile" "get_home_directory" + "get_recent_conkeror_window" + "hints_minibuffer_annotation_mode" "interactive" "load_spec" + "load_spec_uri_string" "load_url_in_new_buffer" "make_file" + "make_uri" "mode_line_adder" + "open_download_buffer_automatically" "prefix_completer" + "read_browser_object" "register_user_stylesheet" + "remove_hook" "require" "send_http_request" "session_pref" + "shell_command_blind" "theme_load" + ;; Variables + "Cc" "Ci" "browser_object_history_url" "browser_object_links" + "buffer_count_widget" "buffer_icon_widget" "content_buffer" + "content_buffer_form_keymap" "content_buffer_normal_keymap" + "content_buffer_text_keymap" "content_policy_accept" + "content_policy_bytype" "content_policy_reject" "cwd" + "default_base_keymap" "default_global_keymap" + "downloads_status_widget" "external_content_handlers" + "hint_digits" "load_paths" "read_buffer_show_icons" + "read_url_handler_list" "session_auto_save_auto_load" + "theme_load_paths" "title_format_fn" "url_remoting_fn" + ;; Keyword argument + "$alternative" "$browser_object" "$completer" "$completions" + "$initial_value" "$options" "$prompt" "$sort_order" + "$use_bookmarks" "$use_history" "$use_webjumps")))) + + (add-hook 'js2-init-hook #'oni:js2-add-conkeror-symbols) + #+END_SRC + +* Teach eww about tags + + Strangely enough, ~eww~ doesn't seem to be aware of == HTML tags. + Luckily it's trivial to teach it. It does know about =
= HTML
+  tags, and basically I just want == tags to be treated almost as
+  =
= tags, so to do that we just have to define a =shr-tag-code=
+  function. I've copied the =shr-tag-pre= function and removed the calls
+  to =ensure-newline=, because == tags are inline tags.
+
+  In order to remain a little future-proof, it should only be done if
+  it doesn't already exist.
+
+  *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=.
+
+  *Note:* See my [[Function declarations][note]] on function declarations about the use of
+  =declare-function=.
+
+  #+BEGIN_SRC emacs-lisp
+    (defvar shr-folding-mode)
+    (declare-function shr-indent "shr")
+    (declare-function shr-generic "shr")
+
+    (with-eval-after-load 'shr
+      (unless (fboundp 'shr-tag-code)
+        (defun shr-tag-code (cont)
+          (let ((shr-folding-mode 'none))
+            (shr-indent)
+            (shr-generic cont)))))
+  #+END_SRC
+
+* Use scheme-mode for scsh interpreted files
+
+  Set the major mode for files interpreted by scsh (for example, by
+  having ~#!/usr/local/bin/scsh~ at the top) to use =scheme-mode=.
+
+  #+BEGIN_SRC emacs-lisp
+    (add-to-list 'interpreter-mode-alist '("scsh" . scheme-mode))
+  #+END_SRC
+
+* Set default scheme implementation
+
+  Set the default implementation for geiser to guile so it doesn't ask
+  which implementation to use every time.
+
+  #+BEGIN_SRC emacs-lisp
+    (defvar geiser-default-implementation)
+
+    (with-eval-after-load 'geiser
+      (setq geiser-default-implementation 'guile))
+  #+END_SRC
+
+* Setup eww-lnum
+
+  As recommended in the [[https://github.com/m00natic/eww-lnum][README]], set the keys in the =eww-mode-map=.
+
+  #+BEGIN_SRC emacs-lisp
+    (defvar eww-mode-map)
+
+    (with-eval-after-load 'eww
+      (define-key eww-mode-map "f" 'eww-lnum-follow)
+      (define-key eww-mode-map "F" 'eww-lnum-universal))
+  #+END_SRC
+
+* Don't compile scss files
+
+  By default =scss-mode= tries compiling a file each time it's saved. I
+  don't have SCSS properly installed globally so this always fails,
+  highly annoying.
+
+  #+BEGIN_SRC emacs-lisp
+    (defvar scss-compile-at-save)
+
+    (with-eval-after-load 'scss-mode
+      (setq scss-compile-at-save nil))
+  #+END_SRC
+
+* Change listings in dired
+
+  The number of bytes a file is doesn't usually tell me much when it's
+  something like ~292837~. I prefer seeing just how many Kb or Mb a
+  certain file is. I also don't need to see the ~.~ and ~..~ directories
+  when I insert directories into the current dired buffer, as there is
+  a great chance that the current and parent directory are already
+  shown in the buffer.
+
+  #+BEGIN_SRC emacs-lisp
+    (defvar dired-subdir-switches)
+
+    (with-eval-after-load 'dired
+      (setq dired-listing-switches "-alh"
+            dired-subdir-switches "-Alh"))
+  #+END_SRC
+
+* Load custom file
+
+  I don't really use the Emacs customization interface much, but I
+  have used it as a kind-of persistent datastore, specifically for
+  desktop-registry[fn:9]. I do very much like the idea of it, it's a
+  very cool thing to have. I also use ~custom.el~ for storing some
+  things that I really can't store in a public viewing location like
+  this file or the git repository it lives in.
+
+  #+BEGIN_SRC emacs-lisp
+    (setq custom-file "~/.emacs.d/custom.el")
+    (load custom-file)
+  #+END_SRC
+
+* Notes
+
+  Here are some random or somewhat general notes about things you may
+  run into when looking through my Emacs init.
+
+** Vacuous defvar
+
+   A =defvar= without a value like =(defvar some-variable)= tells the
+   byte-compiler that the variable will appear, but doesn't give it a
+   value. It should only count for the file where it is used and once
+   the file with the /actual/ =defvar= is loaded it will be populated with
+   its value, contrary to what would happen if you'd given it a value
+   before loading its original file.
+
+** Function declarations
+
+   The function =declare-function= tells the byte-compiler where to find
+   a certain function. This keeps the byte-compiler from complaining
+   about certain functions possibly not being defined at run-time.
+
+* Footnotes
+
+[fn:1] This runs =tmm-menubar=, which lets you navigate the menubar in a
+  text-driven way. I don't ever use it because I know what all my
+  favorite functions are called, but it seems a great deal more
+  efficient than having to click on everything.
+
+[fn:2] https://github.com/sabof/svg-mode-line-themes
+
+[fn:3] It works fine for me with something like jabber chats and the
+  like.
+
+[fn:4] I like to program in Lisp, parentheses are important to me!
+  Parentheses should be nice and round, not almost like bars!
+
+[fn:5] https://github.com/belluzj/fantasque-sans
+
+[fn:6] Used to be Cosmic Sans Neue Mono, the name changed because
+  people misread it as "Comic" (me included, which was the original
+  reason I checked it out, for laughs) and hate Comic Sans, and also
+  because there was already a Cosmic Sans font as well, which could
+  cause confusion.
+
+[fn:7] http://stackoverflow.com/questions/22175214/automatically-switch-language-in-gnus-depending-on-recipient
+
+[fn:8] I still use 2 spaces for some languages, like HTML.
+
+[fn:9] http://code.ryuslash.org/desktop-registry/about/
diff --git a/emacs/.emacs.d/project.el b/emacs/.emacs.d/project.el
new file mode 100644
index 0000000..6ddfad1
--- /dev/null
+++ b/emacs/.emacs.d/project.el
@@ -0,0 +1,13 @@
+(require 'ox-publish)
+
+(setq org-publish-use-timestamps-flag nil
+      org-html-htmlize-output-type 'css
+      org-publish-project-alist
+      '(("org"
+         :base-directory "./"
+         :publishing-directory "_publish/"
+         :recursive nil
+         :base-extension "org"
+         :publishing-function org-html-publish-to-html
+         :html-doctype ""
+         :html-link-home "https://ryuslash.org")))
diff --git a/emacs/.emacs.d/site-lisp/.gitignore b/emacs/.emacs.d/site-lisp/.gitignore
new file mode 100644
index 0000000..813048b
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/.gitignore
@@ -0,0 +1 @@
+rudel/
diff --git a/emacs/.emacs.d/site-lisp/Makefile b/emacs/.emacs.d/site-lisp/Makefile
new file mode 100644
index 0000000..ffa8ad7
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/Makefile
@@ -0,0 +1,5 @@
+.PHONY: all
+all: appt-init.elc jabber-init.elc org-init.elc gnus-init.elc
+
+%.elc: %.el
+	emacs -Q -batch -eval "(byte-compile-file \"$<\")"
diff --git a/emacs/.emacs.d/site-lisp/appt-init.el b/emacs/.emacs.d/site-lisp/appt-init.el
new file mode 100644
index 0000000..95fcc41
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/appt-init.el
@@ -0,0 +1,46 @@
+;;; appt-init.el --- Initialization for appt         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords:
+
+;; 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 .
+
+;;; Commentary:
+
+;; Initialization code for the `appt' library, should get loaded when
+;; `appt' is.
+
+;;; Code:
+
+(require 'appt)
+
+(autoload 'jabber-send-message "jabber-chat")
+(defvar jabber-connections)
+
+(defun oni:appt-display-window-and-jabber (min-to-app new-time appt-msg)
+  "Send a message to my phone jabber account."
+  (let ((fmt "%s%s (in %s minutes)"))
+    (jabber-send-message
+     (car jabber-connections) "phone@ryuslash.org" nil
+     (format fmt new-time appt-msg min-to-app) nil))
+  (appt-disp-window min-to-app new-time appt-msg))
+
+(setq appt-disp-window-function #'oni:appt-display-window-and-jabber
+      appt-display-diary nil)
+
+
+(provide 'appt-init)
+;;; appt-init.el ends here
diff --git a/emacs/.emacs.d/site-lisp/avandu-init.el b/emacs/.emacs.d/site-lisp/avandu-init.el
new file mode 100644
index 0000000..3a80140
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/avandu-init.el
@@ -0,0 +1,35 @@
+;;; avandu-init.el --- Initialization for avandu     -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords:
+
+;; 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 .
+
+;;; Commentary:
+
+;; Initialization code for the `avandu' library, should get loaded
+;; when `avandu' is.
+
+;;; Code:
+
+(require 'avandu)
+
+(setq avandu-user "admin"
+      avandu-tt-rss-api-url "https://ryuslash.org/tt-rss/api/"
+      avandu-html2text-command #'shr-render-region)
+
+(provide 'avandu-init)
+;;; avandu-init.el ends here
diff --git a/emacs/.emacs.d/site-lisp/drd.el b/emacs/.emacs.d/site-lisp/drd.el
new file mode 100644
index 0000000..6639232
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/drd.el
@@ -0,0 +1,8 @@
+(let ((quicklisp-slime-directory
+       "~/.local/share/quicklisp/local-projects/slime/"))
+  (add-to-list 'load-path quicklisp-slime-directory)
+  (require 'slime-autoloads)
+  (setq slime-backend (expand-file-name "swank-loader.lisp"
+                                        quicklisp-slime-directory)
+        slime-path quicklisp-slime-directory)
+  (slime-setup '(slime-fancy)))
diff --git a/emacs/.emacs.d/site-lisp/dzen.el b/emacs/.emacs.d/site-lisp/dzen.el
new file mode 100644
index 0000000..da83099
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/dzen.el
@@ -0,0 +1,86 @@
+;;; dzen.el --- Control DZEN2 from emacs
+
+;; Copyright (C) 2012  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: convenience
+
+;; 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 .
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'newst-backend)
+(require 'sawfish)
+
+(defvar dzen-process nil
+  "Dzen2's process.")
+
+(defvar dzen-timer nil
+  "Timer used to update the dzen line.")
+
+(defun get-mail-count (account)
+  (length (directory-files (concat "/home/slash/documents/mail/"
+                                   account "/inbox/new") nil "^[^.]")))
+
+(defun dzen-update ()
+  (let ((strl "")
+        (strc (if (boundp 'metal-express-radio-currently-playing)
+                  metal-express-radio-currently-playing
+                ""))
+        (strr (format
+               "jabber: %s ryu: %d gm: %d aet: %d 9n: %d rss: %d\n"
+               (oni:current-jabber-status)
+               (get-mail-count "ryuslash.org")
+               (get-mail-count "gmail")
+               (get-mail-count "aethon")
+               (get-mail-count "ninthfloor")
+               (newsticker--stat-num-items-total 'new))))
+    (process-send-string
+     "dzen2" (format "%s^p(_CENTER)^p(-%d)%s^p(_RIGHT)^p(-%d)%s"
+                     strl
+                     (* (floor (/ (length strc) 2)) 8) strc
+                     (+ 8 (* 8 (length strr))) strr))))
+
+(defun dzen-start ()
+  (interactive)
+  (if (or (null dzen-process) (not (process-live-p dzen-process)))
+      (progn
+        (setq dzen-process
+              (start-process "dzen2" "*dzen2*" "dzen2"
+                             "-w" "1920"
+                             "-fn" "Monaco-10"
+                             "-bg" "#222224"
+                             "-fg" "#eeeeec"
+                             "-y" "1060"))
+        (dzen-update)
+        (setq dzen-timer (run-with-timer 1 1 #'dzen-update)))
+    (message "Dzen2 already running")))
+
+(defun dzen-stop ()
+  (interactive)
+  (if (and dzen-process (process-live-p dzen-process))
+      (progn
+        (when dzen-timer
+          (cancel-timer dzen-timer))
+        (kill-process "dzen2"))
+    (message "Dzen2 is not running"))
+  (setq dzen-process nil
+        dzen-timer nil))
+
+(provide 'dzen)
+;;; dzen.el ends here
diff --git a/emacs/.emacs.d/site-lisp/eltuki.el b/emacs/.emacs.d/site-lisp/eltuki.el
new file mode 100644
index 0000000..b64f786
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/eltuki.el
@@ -0,0 +1,266 @@
+;;; eltuki.el --- Tekuti functions
+
+;; Copyright (C) 2012  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: convenience
+
+;; 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 .
+
+;;; Commentary:
+
+;; Tekuti functions.
+
+;;; Code:
+
+(require 'org)
+
+(defgroup eltuki
+  nil
+  "tekuti functions in Emacs."
+  :group 'external)
+
+(defcustom eltuki-blog-dir "~/blog"
+  "Plain blog post directory, not the git repository."
+  :group 'eltuki
+  :type 'string)
+
+(defcustom eltuki-default-status "publish"
+  "Default status to use when status is unknown."
+  :group 'eltuki
+  :type 'string)
+
+(defcustom eltuki-default-comment-status "open"
+  "Default status for comments."
+  :group 'eltuki
+  :type 'string)
+
+(define-skeleton eltuki-post
+  "Create a post template for eltuki."
+  ""
+  "#+TITLE: " (skeleton-read "Title: ") "\n"
+  "#+TIMESTAMP: \n"
+  "#+TAGS: " (skeleton-read "Tags (comma separated): ") "\n"
+  "\n"
+  _)
+
+(defun eltuki-new-post ()
+  (interactive)
+  (switch-to-buffer (get-buffer-create "*eltuki*"))
+  (org-mode)
+  (eltuki-post))
+
+(defun eltuki-get-title ()
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward "^#\\+TITLE: \\(.*\\)$" nil t)
+        (buffer-substring-no-properties
+         (match-beginning 1) (match-end 1))
+      (error "Post has no title."))))
+
+(defun eltuki-set-title (title)
+  (interactive "MTitle: ")
+  (setq title (concat " " title))
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward "^#\\+TITLE:\\(.*\\)$" nil t)
+        (replace-match title t t nil 1)
+      (insert "#+TITLE:" title "\n")
+      (unless (= (char-after) ?\n)
+        (insert-char ?\n)))))
+
+(defun eltuki-get-timestamp ()
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward "^#\\+TIMESTAMP: \\([[:digit:]]+\\)$" nil t)
+        (match-string 1)
+      (format-time-string "%s"))))
+
+(defun eltuki-set-timestamp ()
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((newtime (format-time-string " %s")))
+      (if (re-search-forward "^#\\+TIMESTAMP:\\(.*\\)$" nil t)
+          (replace-match newtime nil t nil 1)
+        (when (search-forward "\n\n" nil t)
+          (backward-char))
+        (insert "#+TIMESTAMP:" newtime "\n")))))
+
+(defun eltuki-get-tags ()
+  (save-excursion
+    (goto-char (point-min))
+    (when (re-search-forward "^#\\+TAGS: \\(.*\\)$" nil t)
+      (buffer-substring-no-properties
+       (match-beginning 1) (match-end 1)))))
+
+(defun eltuki-set-tags (tags)
+  (interactive "MTags: ")
+  (setq tags (concat " " tags))
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward "^#\\+TAGS:\\(.*\\)$" nil t)
+        (replace-match tags t t nil 1)
+      (when (search-forward "\n\n" nil t)
+        (backward-char))
+      (insert "#+TAGS:" tags "\n"))))
+
+(defun eltuki-get-status ()
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward "^#\\+STATUS: \\(draft\\|publish\\)$" nil t)
+        (buffer-substring-no-properties
+         (match-beginning 1) (match-end 1))
+      eltuki-default-status)))
+
+(defun eltuki-toggle-status ()
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((newstatus (if (string= (eltuki-get-status) "draft")
+                         " publish"
+                       " draft")))
+      (if (re-search-forward "^#\\+STATUS:\\(.*\\)$" nil t)
+          (replace-match newstatus t t nil 1)
+        (when (search-forward "\n\n" nil t)
+          (backward-char))
+        (insert "#+STATUS:" newstatus "\n")))))
+
+(defun eltuki-get-comment-status ()
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward
+         "^#\\+COMMENTSTATUS: \\(open\\|closed\\)$" nil t)
+        (buffer-substring-no-properties
+         (match-beginning 1) (match-end 1))
+      eltuki-default-comment-status)))
+
+(defun eltuki-toggle-comment-status ()
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((newstatus (if (string= (eltuki-get-comment-status) "closed")
+                         " open"
+                       " closed")))
+      (if (re-search-forward "^#\\+COMMENTSTATUS:\\(.*\\)$" nil t)
+          (replace-match newstatus t t nil 1)
+        (when (search-forward "\n\n" nil t)
+          (backward-char))
+        (insert "#+COMMENTSTATUS:" newstatus "\n")))))
+
+(defun eltuki-slugify-string (str)
+  (while (string-match "[^a-zA-Z0-9 ]+" str)
+    (setq str (replace-match "" nil t str)))
+  (while (string-match " +" str)
+    (setq str (replace-match "-" nil t str)))
+  (downcase str))
+
+(defun eltuki-get-directory ()
+  (concat
+   eltuki-blog-dir "/"
+   (format-time-string "%Y%%2f%m%%2f%d%%2f")
+   (eltuki-slugify-string (eltuki-get-title))))
+
+(defun eltuki-write-content (dir)
+  (let ((org-export-with-toc nil)
+        (org-export-with-section-numbers nil)
+        (filename (concat dir "/content"))
+        (org-export-show-temporary-export-buffer nil))
+    (org-html-export-as-html nil nil nil t)
+    (with-current-buffer "*Org HTML Export*"
+      (write-region (point-min) (point-max) filename)
+      (kill-buffer))
+    filename))
+
+(defun eltuki-write-metadata (dir)
+  (let ((timestamp (eltuki-get-timestamp))
+        (tags (eltuki-get-tags))
+        (status (eltuki-get-status))
+        (title (eltuki-get-title))
+        (name (eltuki-slugify-string (eltuki-get-title)))
+        (commentstatus (eltuki-get-comment-status))
+        (filename (concat dir "/metadata")))
+  (with-temp-buffer
+    (insert "timestamp: " timestamp "\n"
+            "tags: " tags "\n"
+            "status: " status "\n"
+            "title: " title "\n"
+            "name: " name "\n"
+            "comment_status: " commentstatus)
+    (write-region (point-min) (point-max) filename))
+  filename))
+
+(defun eltuki-save-org (buffer dir)
+  (let ((filename (concat dir "/post.org")))
+    (with-current-buffer buffer
+      (write-file filename))
+    filename))
+
+(defun eltuki-git-add (file)
+  (shell-command (concat "cd " eltuki-blog-dir "; git add '" (expand-file-name file) "'")))
+
+(defun eltuki-commit ()
+  (shell-command (concat "cd " eltuki-blog-dir "; git commit -m \"new post: \\\"" (eltuki-get-title)
+                         "\\\"\"")))
+
+(defun eltuki-finish ()
+  (interactive)
+  (let ((buffer (or (get-buffer "*eltuki*")
+                    (current-buffer)))
+        (dest (eltuki-get-directory)))
+    (unless (file-exists-p dest)
+      (mkdir dest))
+
+    (mapc #'eltuki-git-add
+          (list (eltuki-write-content dest)
+                (eltuki-write-metadata dest)
+                (eltuki-save-org buffer dest)))
+
+    (eltuki-commit)
+    (kill-buffer buffer)))
+
+(defun eltuki-process-sentinel (proc status)
+  "Print PROC's STATUS."
+  (message "git %s" (substring status 0 -1)))
+
+(defun eltuki--passwd-prompt (string)
+  "Decide on what to prompt based on STRING."
+  (cond
+   ((or
+     (string-match "^Enter passphrase for key '\\\(.*\\\)': $" string)
+     (string-match "^\\\(.*\\\)'s password:" string))
+    (format "Password for '%s': " (match-string 1 string)))
+   ((string-match "^[pP]assword:" string)
+    "Password:")))
+
+(defun eltuki-process-filter (proc string)
+  "Check if PROC is asking for a password in STRING."
+  (with-current-buffer (process-buffer proc)
+    (let ((inhibit-read-only t)
+          (ask (eltuki--passwd-prompt string)))
+      (if ask
+          (process-send-string proc (concat (read-passwd ask nil) "\n"))
+        (insert string)))))
+
+(defun eltuki-publish ()
+  "Publish posts."
+  (interactive)
+  (let* ((default-directory (concat eltuki-blog-dir "/"))
+         (proc (start-process "eltuki-publish" "*eltuki-publish*"
+                              "git" "push")))
+    (set-process-sentinel proc 'eltuki-process-sentinel)
+    (set-process-filter proc 'eltuki-process-filter)))
+
+(provide 'eltuki)
+;;; eltuki.el ends here
diff --git a/emacs/.emacs.d/site-lisp/gnus-init.el b/emacs/.emacs.d/site-lisp/gnus-init.el
new file mode 100644
index 0000000..60093c4
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/gnus-init.el
@@ -0,0 +1,82 @@
+(eval-when-compile
+  (require 'gnus)
+  (require 'gnus-start)
+  (require 'gnus-sum)
+  (require 'gnus-art)
+  (require 'gnus-msg))
+
+(defvar gnus-tmp-from)
+
+(defvar oni:mail-adresses
+  (rx (or "tom@ryuslash.org" "ryuslash@ninthfloor.org"
+          "ryuslash@gmail.com")))
+
+(defun gnus-user-format-function-a (headers)
+  (let ((to (gnus-extra-header 'To headers)))
+    (if (string-match oni:mail-adresses to)
+        (if (string-match "," to) "~" "»")
+      (if (or (string-match oni:mail-adresses
+                            (gnus-extra-header 'Cc headers))
+              (string-match oni:mail-adresses
+                            (gnus-extra-header 'BCc headers)))
+          "~"
+        " "))))
+
+(setq gnus-ignored-from-addresses oni:mail-adresses)
+(setq message-alternative-emails oni:mail-adresses)
+(setq message-dont-reply-to-names oni:mail-adresses)
+
+(defvar gnus-face-5 'font-lock-variable-name-face)
+(defvar gnus-face-6 'font-lock-constant-face)
+
+(setq gnus-group-line-format "%P    %(%C%) %B%60=%4y%-2M%S\n")
+(setq gnus-summary-line-format "%U%R%z%ua%I%(%*%[%5{%-23,23f%}%]%) %s\n")
+(setq gnus-summary-mode-line-format "Gnus: %G %Z")
+(setq gnus-select-method '(nntp "news.gmane.org"))
+(setq gnus-secondary-select-methods
+      '((nnmaildir "gmail"
+                   (directory "~/documents/mail/gmail/"))
+        (nnmaildir "ninthfloor"
+                   (directory "~/documents/mail/ninthfloor/"))
+        ;; (nnmaildir "aethon"
+        ;;            (directory "~/documents/mail/aethon/"))
+        (nnmaildir "ryuslash"
+                   (directory "~/documents/mail/ryuslash.org/"))
+        (nntp "news.gwene.org")))
+(setq gnus-auto-subscribed-groups nil)
+(setq gnus-save-newsrc-file nil)
+(setq gnus-read-newsrc-file nil)
+(setq gnus-article-truncate-lines nil)
+(setq gnus-permanently-visible-groups
+      (rx (and (or "gmail" "aethon" "ninthfloor" "ryuslash")
+               ":inbox")))
+(setq gnus-check-new-newsgroups nil)
+(setq gnus-novice-user nil)
+(setq gnus-posting-styles
+      '((".*"
+         (address "tom@ryuslash.org")
+         (eval (setq message-sendmail-extra-arguments '("-a" "ryuslash"))))
+        ("gmail:"
+         (address "ryuslash@gmail.com")
+         (eval (setq message-sendmail-extra-arguments '("-a" "gmail"))))
+        ("ninthfloor:"
+         (address "ryuslash@ninthfloor.org")
+         (eval (setq message-sendmail-extra-arguments '("-a" "ninthfloor"))))
+        ("arch:"
+         (address "tom.willemsen@archlinux.us")
+         (eval (setq message-sendmail-extra-arguments '("-a" "arch"))))
+        ("aethon:"
+         (name "Tom Willemsen")
+         (address "thomas@aethon.nl")
+         (signature-file "~/documents/work/aethon/signature_20131209.txt")
+         (eval (setq message-sendmail-extra-arguments '("-a" "aethon"))))))
+(add-hook 'gnus-select-group-hook
+          (lambda ()
+            (cond
+             ((string-match "aethon"
+                            (gnus-group-real-name gnus-newsgroup-name))
+              (ispell-change-dictionary "nl"))
+             (t (ispell-change-dictionary "en")))))
+(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
+
+(setq message-kill-buffer-on-exit t)
diff --git a/emacs/.emacs.d/site-lisp/jabber-init.el b/emacs/.emacs.d/site-lisp/jabber-init.el
new file mode 100644
index 0000000..fd99a2d
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/jabber-init.el
@@ -0,0 +1,200 @@
+;;; jabber-initel --- Jabber.el initialization
+;;; Commentary:
+;;; Code:
+
+(require 'init (locate-user-emacs-file "init.elc" "init.el"))
+(require 'jabber)
+
+;; (autoload 'jabber-message-libnotify "jabber-libnotify")
+;; (autoload 'jabber-muc-libnotify "jabber-libnotify")
+
+(defun jabber-init-roster-mode-func ()
+  "Function for `jabber-roster-mode-hook'."
+  (setq mode-line-format
+        (list (propertize " %m" 'face 'mode-line-buffer-id))))
+
+(defun jabber-init-show-status-in-buffer (who oldstatus newstatus
+                                              statustext proposed-alert)
+  "Check to see if WHO has a buffer and if so print his new status.
+
+OLDSTATUS, NEWSTATUS and STATUSTEXT are ignored.
+
+Insert PROPOSED-ALERT in the buffer if it is non-nil."
+  (let ((buffer (get-buffer (jabber-chat-get-buffer (symbol-name who)))))
+    (when (and buffer proposed-alert)
+      (with-current-buffer buffer
+        (ewoc-enter-last jabber-chat-ewoc (list :notice proposed-alert
+                                                :time (current-time)))))))
+
+(defun jabber-init-stumpwm-echo (from buffer text title)
+  "Use stumpwm to echo a message has arrived."
+  (oni:stumpwm-echo title))
+
+(defun jabber-init-stumpwm-echo-muc (nick group buffer text title)
+  "Use stumpwm to echo a message has arrived."
+  (oni:stumpwm-echo title))
+
+(setq jabber-account-list
+      (append (mapcar (lambda (str) (list (concat str "/" system-name)))
+                      '("tom@ryuslash.org" "ryuslash@ninthfloor.org"))
+              '("ryuslash@gmail.com"
+                (:network-server . "talk.google.com")
+                (:port . 443)
+                (:connection-type . ssl)))
+
+      jabber-avatar-cache-directory     "~/.emacs.d/jabber-avatars/"
+      jabber-chat-buffer-format         "+%n"
+      jabber-chat-foreign-prompt-format "%t %u"
+      jabber-chat-local-prompt-format   "%t %u"
+      jabber-chat-buffer-show-avatar    nil
+      jabber-chat-fill-long-lines       nil
+      jabber-chat-delayed-time-format   "%H:%M"
+
+      jabber-chatstates-confirm nil
+
+      jabber-muc-colorize-local   t
+      jabber-muc-colorize-foreign t
+
+      jabber-history-enabled    t
+      jabber-use-global-history nil
+      jabber-history-dir        "~/.emacs.d/jabber-hist"
+
+      jabber-groupchat-buffer-format "++%n"
+      jabber-groupchat-prompt-format "%t %u"
+
+      jabber-roster-show-bindings  nil
+      jabber-show-offline-contacts nil
+
+      jabber-vcard-avatars-publish  nil
+      jabber-vcard-avatars-retrieve nil)
+(add-to-list 'jabber-account-list
+             `(,(concat "thomas@aethon.nl/" system-name)
+               (:network-server . "talk.google.com")
+               (:connection-type . ssl)))
+
+;; (add-hook 'jabber-alert-message-hooks  #'jabber-message-libnotify)
+;; (add-hook 'jabber-alert-muc-hooks      #'jabber-muc-libnotify)
+;; (add-hook 'jabber-alert-message-hooks #'jabber-init-stumpwm-echo)
+;; (add-hook 'jabber-alert-muc-hooks #'jabber-init-stumpwm-echo)
+(add-hook 'jabber-chat-mode-hook       #'visual-line-mode)
+(add-hook 'jabber-roster-mode-hook     #'jabber-init-roster-mode-func)
+(add-hook 'jabber-alert-presence-hooks
+          #'jabber-init-show-status-in-buffer)
+
+(remove-hook 'jabber-alert-presence-hooks #'jabber-presence-echo)
+
+(global-set-key (kbd "") 'jabber-switch-to-roster-buffer)
+
+
+;;; Ugly, but works
+
+(defvar *longest-prompt* 0)
+(make-variable-buffer-local '*longest-prompt*)
+
+(defun update-margins (prompt-length)
+  (when (> prompt-length *longest-prompt*)
+    (let ((window (get-buffer-window (current-buffer))))
+      (when (equal window (selected-window))
+        (set-window-margins window prompt-length))
+      (setq left-margin-width prompt-length
+            *longest-prompt* prompt-length))))
+
+
+(defun jabber-chat-self-prompt (timestamp delayed dont-print-nick-p)
+  "Print prompt for sent message.
+TIMESTAMP is the timestamp to print, or nil for now.
+If DELAYED is true, print long timestamp
+\(`jabber-chat-delayed-time-format' as opposed to
+`jabber-chat-time-format').
+If DONT-PRINT-NICK-P is true, don't include nickname."
+  (let* ((state-data (fsm-get-state-data jabber-buffer-connection))
+         (username (plist-get state-data :username))
+         (server (plist-get state-data :server))
+         (resource (plist-get state-data :resource))
+         (nickname username)
+         (prompt (format-spec jabber-chat-local-prompt-format
+                              (list
+                               (cons ?t (format-time-string
+                                         (if delayed
+                                             jabber-chat-delayed-time-format
+                                           jabber-chat-time-format)
+                                         timestamp))
+                               (cons ?n (if dont-print-nick-p "" nickname))
+                               (cons ?u username)
+                               (cons ?r resource)
+                               (cons ?j (concat username "@" server))))))
+    (insert (jabber-propertize
+             " "
+             'display (list '(margin left-margin) prompt)
+             'face 'jabber-chat-prompt-local
+             'help-echo
+             (concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from you")))
+    (update-margins (length prompt))))
+
+(defun jabber-chat-print-prompt (xml-data timestamp delayed dont-print-nick-p)
+  "Print prompt for received message in XML-DATA.
+TIMESTAMP is the timestamp to print, or nil to get it
+from a jabber:x:delay element.
+If DELAYED is true, print long timestamp
+\(`jabber-chat-delayed-time-format' as opposed to
+`jabber-chat-time-format').
+If DONT-PRINT-NICK-P is true, don't include nickname."
+  (let* ((from (jabber-xml-get-attribute xml-data 'from))
+         (timestamp (or timestamp
+                        (car (delq nil (mapcar 'jabber-x-delay (jabber-xml-get-children xml-data 'x))))))
+         (prompt (format-spec jabber-chat-foreign-prompt-format
+                              (list
+                               (cons ?t (format-time-string
+                                         (if delayed
+                                             jabber-chat-delayed-time-format
+                                           jabber-chat-time-format)
+                                         timestamp))
+                               (cons ?n (if dont-print-nick-p "" (jabber-jid-displayname from)))
+                               (cons ?u (or (jabber-jid-username from) from))
+                               (cons ?r (jabber-jid-resource from))
+                               (cons ?j (jabber-jid-user from))))))
+    (insert (jabber-propertize
+             " "
+             'display (list '(margin left-margin) prompt)
+             'face 'jabber-chat-prompt-foreign
+             'help-echo
+             (concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from " from)))
+    (update-margins (length prompt))))
+
+(defun jabber-muc-print-prompt (xml-data &optional local dont-print-nick-p)
+  "Print MUC prompt for message in XML-DATA."
+  (let* ((nick (jabber-jid-resource (jabber-xml-get-attribute xml-data 'from)))
+         (timestamp (car (delq nil (mapcar 'jabber-x-delay (jabber-xml-get-children xml-data 'x)))))
+         (prompt (format-spec jabber-groupchat-prompt-format
+                              (list
+                               (cons ?t (format-time-string
+                                         (if timestamp
+                                             jabber-chat-delayed-time-format
+                                           jabber-chat-time-format)
+                                         timestamp))
+                               (cons ?n (if dont-print-nick-p "" nick))
+                               (cons ?u nick)
+                               (cons ?r nick)
+                               (cons ?j (concat jabber-group "/" nick))))))
+    (if (stringp nick)
+        (insert (jabber-propertize
+                 " "
+                 'display (list '(margin left-margin) prompt)
+                 'face (if local        ;Message from you.
+                           (if jabber-muc-colorize-local ;; If colorization enable...
+                               ;; ...colorize nick
+                               (list ':foreground (jabber-muc-nick-get-color nick))
+                             ;; otherwise, use default face.
+                             'jabber-chat-prompt-local)
+                         ;; Message from other participant.
+                         (if jabber-muc-colorize-foreign ;If colorization enable...
+                             ;; ... colorize nick
+                             (list ':foreground (jabber-muc-nick-get-color nick))
+                           ;; otherwise, use default face.
+                           'jabber-chat-prompt-foreign))
+                 'help-echo (concat (format-time-string "On %Y-%m-%d %H:%M:%S" timestamp) " from " nick " in " jabber-group)))
+      (jabber-muc-system-prompt))
+    (update-margins (length prompt))))
+
+(provide 'jabber-init)
+;;; jabber-init.el ends here
diff --git a/emacs/.emacs.d/site-lisp/metalexpress.el b/emacs/.emacs.d/site-lisp/metalexpress.el
new file mode 100644
index 0000000..619e4e3
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/metalexpress.el
@@ -0,0 +1,80 @@
+;;; metalexpress.el --- Listen to Metal Express Radio
+
+;; Copyright (C) 2012  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: multimedia
+
+;; 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 .
+
+;;; Commentary:
+
+;; Functions for easily listening to Metal Express Radio.
+
+;;; Code:
+
+(defgroup metal-express-radio nil
+  "Group for the Metal Express Radio listening functions."
+  :group 'multimedia)
+
+(defcustom metal-express-radio-playlist-url
+  "http://usa7-vn.mixstream.net/listen/8248.m3u"
+  "The URL of the Metal Express Radio stream."
+  :group 'metal-express-radio
+  :type 'string)
+
+(defcustom metal-express-radio-song-changed-hook nil
+  "Hook run when the currently playing song changes."
+  :type 'hook
+  :group 'metal-express-radio)
+
+(defvar metal-express-radio-currently-playing nil
+  "The currently playing song.")
+
+(defun mer-proc-filter (proc string)
+  (when (string-match "^ICY Info: StreamTitle='\\(.*\\)';StreamUrl='';"
+                      string)
+    (setq metal-express-radio-currently-playing (match-string 1 string))
+    (run-hooks 'metal-express-radio-song-changed-hook)))
+
+(defun metal-express-radio-echo-currently-playing ()
+  (interactive)
+  (message metal-express-radio-currently-playing))
+
+(defun metal-express-radio-notify ()
+  (interactive)
+  (notifications-notify :title "Now playing:"
+                        :body metal-express-radio-currently-playing))
+
+;;;###autoload
+(defun metal-express-radio-start ()
+  "Start listening to Metal Express Radio."
+  (interactive)
+  (let ((proc (start-process "metalexpress" "*Metal Express Radio*"
+                             "mplayer" metal-express-radio-playlist-url)))
+    (set-process-filter proc #'mer-proc-filter)))
+
+(defun metal-express-radio-stop ()
+  "Stop listening to Metal Express Radio."
+  (interactive)
+  (kill-process (get-buffer-process "*Metal Express Radio*"))
+  (setq metal-express-radio-currently-playing nil))
+
+(add-hook 'metal-express-radio-song-changed-hook
+          'metal-express-radio-echo-currently-playing)
+(add-hook 'metal-express-radio-song-changed-hook
+          'metal-express-radio-notify)
+
+(provide 'metalexpress)
+;;; metalexpress.el ends here
diff --git a/emacs/.emacs.d/site-lisp/mu4e-init.el b/emacs/.emacs.d/site-lisp/mu4e-init.el
new file mode 100644
index 0000000..e11baf5
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/mu4e-init.el
@@ -0,0 +1,54 @@
+;;; mu4e-init.el --- mu4e initialization
+
+;; Copyright (C) 2012  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords:
+
+;; 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 .
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'oni)
+
+(oni:define-mailbox "aethon"
+                    (oni:email thomas at aethon dot nl)
+ (expand-file-name "~/documents/work/aethon/signature.txt"))
+(oni:define-mailbox "gmail" (oni:email ryuslash at gmail dot com))
+(oni:define-mailbox "ninthfloor"
+                    (oni:email ryuslash at ninthfloor dot org))
+(oni:define-mailbox "ryuslash" (oni:email tom at ryuslash dot org)
+                    nil "ryuslash.org")
+
+(setq mu4e-headers-date-format "%d-%m %H:%M")
+(setq mu4e-headers-fields '((:date . 11)
+                            (:flags . 6)
+                            (:to . 22)
+                            (:from . 22)
+                            (:subject)))
+(setq mu4e-headers-show-threads nil)
+(setq mu4e-headers-sort-revert nil)
+(setq mu4e-html2text-command "w3m -dump -T text/HTML -cols 72")
+(setq mu4e-my-email-addresses (list
+                               (oni:email tom at ryuslash dot org)
+                               (oni:email ryuslash at gmail dot com)
+                               (oni:email ryuslash at ninthfloor dot org)
+                               (oni:email thomas at aethon dot nl)))
+
+(provide 'mu4e-init)
+;;; mu4e-init.el ends here
diff --git a/emacs/.emacs.d/site-lisp/my-smt.el b/emacs/.emacs.d/site-lisp/my-smt.el
new file mode 100644
index 0000000..32009a2
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/my-smt.el
@@ -0,0 +1,123 @@
+;;; my-smt.el --- My SVG mode-line theme             -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: faces
+
+;; 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 .
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(smt/defwidget my-smt-flycheck-errors
+  :text (lambda (widget)
+          (ignore widget)
+          (when flycheck-mode
+            (let ((counts (flycheck-count-errors
+                           flycheck-current-errors)))
+              `(tspan " " (tspan :fill ,(if (smt/window-active-p)
+                                            "#a85454"
+                                          "#969696") ,(or (cdr (assoc 'error counts)) 0))
+                      "/" (tspan :fill ,(if (smt/window-active-p)
+                                            "#a88654"
+                                          "#969696") ,(or (cdr (assoc 'warning counts)) 0)))))))
+
+(smt/defwidget my-smt-jabber-activity
+  :text (lambda (widget)
+          (ignore widget)
+          (if (and (smt/window-active-p)
+                   (boundp 'jabber-activity-mode-string)
+                   (not (equal jabber-activity-mode-string "")))
+              (concat jabber-activity-mode-string " "))))
+
+(defun my-smt-yoshi-title-style (widget)
+  "Fill color for either active or inactive windows.
+
+WIDGET is ignored."
+  (ignore widget)
+  (list :fill (if (smt/window-active-p)
+                  "#a85454"
+                "#969696")))
+
+(smt/defwidget my-smt-po-counters
+  :text (lambda (widget)
+          (ignore widget)
+          (when (eql major-mode 'po-mode)
+            (format " %dt+%df+%du+%do" po-translated-counter
+                    po-fuzzy-counter po-untranslated-counter
+                    po-obsolete-counter))))
+
+(smt/defwidget my-smt-buffer-identification
+  :style 'my-smt-yoshi-title-style
+  :text (lambda (widget)
+          (ignore widget)
+          (concat
+           (s-trim
+            (substring-no-properties
+             (format-mode-line mode-line-buffer-identification)))
+           (when (and (or buffer-file-name
+                          buffer-offer-save)
+                      (buffer-modified-p))
+             "*"))))
+
+(smt/defwidget my-smt-current-dictionary
+  :text (lambda (widget)
+          (ignore widget)
+          (if flyspell-mode
+              (concat " " (or ispell-current-dictionary
+                              ispell-local-dictionary
+                              flyspell-default-dictionary)))))
+
+(smt/defwidget my-smt-position
+  :text (lambda (widget)
+          (ignore widget)
+          (format-mode-line "%l/%c:%p")))
+
+(smt/defrow my-smt-right
+  :prototype 'default-right
+  :widgets '(my-smt-jabber-activity
+             major-mode
+             my-smt-current-dictionary
+             my-smt-flycheck-errors
+             version-control minor-modes)
+  :margin 16)
+
+(smt/defrow my-smt-left
+  :prototype 'default-left
+  :widgets '(buffer-info my-smt-buffer-identification my-smt-po-counters
+                         which-function))
+
+(smt/defrow my-smt-position
+  :prototype 'default-position
+  :widgets '(my-smt-position))
+
+(defun my-smt-major-mode-style (widget)
+  (ignore widget)
+  '(:fill "#ccc" :font-family "Fantasque Sans" :filter nil
+          :font-weight "bold" :font-style "italic"))
+
+(smt/deftheme my-smt
+  :prototype 'black-crystal
+  :local-widgets (list (cons 'major-mode
+                             (smt/make-widget
+                              :prototype 'major-mode
+                              :style 'my-smt-major-mode-style)))
+  :rows '(my-smt-left my-smt-position my-smt-right))
+
+(provide 'my-smt)
+;;; my-smt.el ends here
diff --git a/emacs/.emacs.d/site-lisp/org-init.el b/emacs/.emacs.d/site-lisp/org-init.el
new file mode 100644
index 0000000..6a5c908
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/org-init.el
@@ -0,0 +1,192 @@
+;;; org-init.el --- Org initialization
+
+;; Copyright (C) 2012  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords:
+
+;; 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 .
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'appt)
+(require 'org-habit)
+(require 'org-protocol)
+
+(eval-after-load "org"
+  '(require 'org-contacts nil :noerror))
+
+(eval-when-compile
+  (require 'desktop)
+  (require 'org-capture))
+
+(autoload 'org-clocking-p "org-clock")
+
+(with-eval-after-load 'org-crypt
+  (org-crypt-use-before-save-magic))
+
+(eval-and-compile
+  (add-to-list 'load-path "~/.emacs.d/vendor-lisp/habitrpg.el"))
+
+(defun tagify (str)
+  "Remove dots, replace - with _ in STR."
+  (replace-regexp-in-string
+   "-" "_" (replace-regexp-in-string "\\." "" (downcase str))))
+
+(defun oni:color-for (object)
+  "Generate a hex color by taking the first 6 characters of OBJECT's MD5 sum."
+  (format "#%s" (substring (md5 object) 0 6)))
+
+(defun oni:org-colors-for (names)
+  "Create an alist for NAMES with corresponding colors."
+  (mapcar (lambda (name) (cons name (oni:color-for name))) names))
+
+(defun oni:note-template ()
+  (concat
+   "* %<%c>\n"
+   "  :DIRECTORY: =" default-directory "=\n"
+   (when (buffer-file-name) "  :FILE: [[file:%F][%F]]\n")
+   (when (org-clocking-p) "  :TASK: %K\n")
+   "\n  %?"))
+
+(defun oni:org-maybe-outline-path ()
+  (let ((outline-path (org-format-outline-path (org-get-outline-path))))
+    (unless (string= outline-path "")
+      (setq outline-path (concat "[ " outline-path " ] ")))
+    outline-path))
+
+(defun org-init-filter-by-desktop ()
+  "Filter agenda by current label."
+  (when desktop-dirname
+    (let ((label (tagify (file-name-nondirectory
+                          (directory-file-name
+                           (expand-file-name desktop-dirname))))))
+      (org-agenda-filter-apply (cons label nil) 'tag))))
+
+(defun org-init-skip-tags ()
+  "Skip the \"ex\" and \"unconfirmed\" tags."
+  (let ((tags (org-get-tags-at (point))))
+    (when (or (member "ex" tags)
+              (member "unconfirmed" tags))
+      (save-excursion
+        (or
+         (ignore-errors (org-forward-element)
+                        (point))
+         (point-max))))))
+
+(defun org-init-get-tag-name ()
+  "Get the name for a new tag for the currently loaded desktop."
+  (let ((dname (desktop-registry-current-desktop)))
+    (if dname
+        (let ((tag (read-string "Tag(s): " (tagify dname))))
+          (if (not (string= tag ""))
+              (format ":%s:" tag)
+            ""))
+      "")))
+
+(setq org-agenda-cmp-user-defined (lambda (a b) 1))
+(setq org-agenda-prefix-format
+      '((agenda . " %i %-12:c%?-12t% s")
+        (timeline . "  % s")
+        (todo . " %i %-12:c %(oni:org-maybe-outline-path)")
+        (tags . " %i %-12:c %(oni:org-maybe-outline-path)")
+        (search . " %i %-12:c")))
+(setq org-agenda-sorting-strategy
+      '((agenda habit-down time-up priority-down category-keep)
+        (todo priority-down user-defined-down)
+        (tags priority-down category-keep)
+        (search category-keep)))
+(setq org-agenda-tags-column (1+ (- (window-width))))
+(setq org-directory (expand-file-name "~/documents/org"))
+(setq org-default-notes-file (concat org-directory "/org"))
+(setq org-capture-templates
+      `(("t" "Task" entry (file+headline "~/documents/org/tasks" "Task Queue")
+         "* TODO %?  %(org-init-get-tag-name)"
+         :empty-lines-before 1)
+        ("T" "Linked task" entry (file "~/documents/org/tasks")
+         "* TODO %?  %(org-init-get-tag-name)\n\n  %a"
+         :empty-lines-before 1)
+        ("a" "Appointment" entry (file "~/documents/org/tasks")
+         "* %?\n  %^T\n\n  %a"
+         :empty-lines-before 1)
+        ("n" "General note" entry (file ,org-default-notes-file)
+         (function oni:note-template)
+         :empty-lines-before 1)
+        ("l" "Log entry" entry (file+datetree "~/documents/org/log.org")
+         "* %<%c>\n  <%<%Y-%m-%d %H:%M>>\n\n  %?"
+         :empty-lines-before 1)))
+(setq org-contacts-files '("~/documents/org/misc/contacts.org"))
+(setq org-agenda-show-outline-path nil)
+(setq org-agenda-todo-ignore-deadlines 'far)
+(setq org-agenda-todo-ignore-scheduled t)
+(setq org-export-htmlize-output-type 'css)
+(setq org-feed-alist
+      '(("MyEpisodes"
+         "http://www.myepisodes.com/rss.php?feed=mylist&uid=Slash&pwdmd5=04028968e1f0b7ee678b748a4320ac17"
+         "~/documents/org/tasks" "MyEpisodes"
+         :formatter oni:myepisodes-formatter)))
+(setq org-fontify-done-headline t)
+(setq org-hide-emphasis-markers t)
+(setq org-outline-path-complete-in-steps t)
+(setq org-refile-allow-creating-parent-nodes t)
+(setq org-refile-use-outline-path 'file)
+(setq org-return-follows-link t)
+(setq org-src-fontify-natively t)
+(setq org-tags-column (- 70))
+(setq org-tags-exclude-from-inheritance '("crypt"))
+(setq org-todo-keyword-faces
+      (oni:org-colors-for '("TODO" "WIP" "DONE" "CANCELLED" "FAILED"
+                            "ACQUIRE" "IGNORED" "COMMENT" "GOT")))
+(setq org-tag-faces
+      (oni:org-colors-for '("aethon" "noexport" "tv" "myaethon2"
+                            "dailies" "ex" "maintenance" "housework"
+                            "cdispass" "clark" "emacsd" "eye_on_manga"
+                            "kaarvok" "silbot" "myaethon" "hypo"
+                            "unconfirmed" "gitto" "urxvt_modeline"
+                            "scrumli" "clark_conkeror"
+                            "git_auto_commit_mode" "mode_icons"
+                            "dispassel" "hypo_emacs" "hypo_cli"
+                            "conkeror" "transient_navigation" "pkgbuilds"
+                            "edocs" "cask" "fiplr" "avandu"
+                            "gitolite_admin" "yoshi_theme" "dvdroid"
+                            "commit_check" "imsleepy" "indent_shift"
+                            "work" "picturefix")))
+(setq org-use-fast-todo-selection t)
+(setq org-agenda-skip-function-global 'org-init-skip-tags)
+(setq org-use-property-inheritance '("slug"))
+(setq org-M-RET-may-split-line '((default . t)
+                                 (headline)))
+(setq org-insert-heading-respect-content t)
+(setf (cdar org-blank-before-new-entry) t)
+
+(add-hook 'org-agenda-mode-hook 'org-agenda-to-appt)
+(add-hook 'org-agenda-finalize-hook 'org-init-filter-by-desktop)
+
+(add-to-list 'org-modules 'habit)
+
+(org-agenda-to-appt)
+(ad-activate 'org-agenda-redo)
+
+(require 'habitrpg)
+(add-hook 'org-after-todo-state-change-hook 'habitrpg-add 'append)
+
+(setq org-mobile-directory "~/ownCloud/MobileOrg"
+      org-mobile-inbox-for-pull "~/documents/org/inbox.org")
+
+(provide 'org-init)
+;;; org-init.el ends here
diff --git a/emacs/.emacs.d/site-lisp/pivot.el b/emacs/.emacs.d/site-lisp/pivot.el
new file mode 100644
index 0000000..63830ab
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/pivot.el
@@ -0,0 +1,70 @@
+;;; pivot.el --- Elisp library for the Pivotal Tracker API  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: comm, hypermedia
+
+;; 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 .
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'url)
+
+(defgroup pivotel nil
+  "Communicate with Pivotal Tracker."
+  :group 'external)
+
+(defcustom pivotel-api-token nil
+  "API token from Pivotal Tracker.
+
+From Pivotal Tracker: Your token enables access to your project
+and story data via the API, and needs to be kept private."
+  :group 'pivotel)
+
+(defvar pivotel-api-url
+  "https://www.pivotaltracker.com/services/v5"
+  "Base URL of the Pivotal Tracker API.
+
+Does not need a final `/'.")
+
+(defun pivotel-get-story (project story)
+  "Get data from PROJECT for STORY."
+  (let ((url-request-extra-headers
+         `(("X-TrackerToken" . ,pivotel-api-token))))
+    (with-current-buffer
+        (url-retrieve-synchronously
+         (format "%s/projects/%d/stories/%d"
+                 pivotel-api-url project story))
+      (goto-char (point-min))
+      (search-forward "\n\n")
+      (json-read))))
+
+(defun pivotel-get-projects ()
+  "Get a list of all projects."
+  (let ((url-request-extra-headers
+         `(("X-TrackerTocken" . ,pivotel-api-token))))
+    (with-current-buffer
+        (url-retrieve-synchronously
+         (format "%s/projects" pivotel-api-url))
+      (goto-char (point-min))
+      (search-forward "\n\n")
+      (json-read))))
+
+(provide 'pivot)
+;;; pivot.el ends here
diff --git a/emacs/.emacs.d/site-lisp/pkgbuild.el b/emacs/.emacs.d/site-lisp/pkgbuild.el
new file mode 100644
index 0000000..9cfde12
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/pkgbuild.el
@@ -0,0 +1,57 @@
+;;; pkgbuild.el --- PKGBUILD utility functions       -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: convenience
+
+;; 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 .
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(defun pkgbuild-find-checksums-boundaries ()
+  "Look in the current buffer for the start and end of the checksums."
+  (save-excursion
+    (goto-char (point-min))
+    (re-search-forward (rx (or "md5" "sha1" "sha256") "sums"))
+    (let ((start (match-beginning 0)))
+      (search-forward "(")
+      (backward-char)
+      (forward-sexp)
+      (list start (point)))))
+
+(defun pkgbuild-get-updated-checksums ()
+  "Call `makepkg -g' to get the updated checksums."
+  (with-temp-buffer
+    (insert (shell-command-to-string "makepkg -g"))
+    (apply #'buffer-substring-no-properties
+           (pkgbuild-find-checksums-boundaries))))
+
+;;;###autoload
+(defun pkgbuild-update-checksums ()
+  "Find and update the checksums for the current buffer."
+  (interactive)
+  (let ((updated (pkgbuild-get-updated-checksums)))
+    (if updated
+        (progn
+          (apply #'delete-region (pkgbuild-find-checksums-boundaries))
+          (insert updated))
+      (error "No new checksums found"))))
+
+(provide 'pkgbuild)
+;;; pkgbuild.el ends here
diff --git a/emacs/.emacs.d/site-lisp/quick-edit-mode.el b/emacs/.emacs.d/site-lisp/quick-edit-mode.el
new file mode 100644
index 0000000..898d7c2
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/quick-edit-mode.el
@@ -0,0 +1,74 @@
+;;; quick-edit-mode.el --- Quickly edit stuff
+
+;; Copyright (C) 2012  Tom Willemse
+
+;; Author: Tom Willemse 
+;; Keywords: convenience
+
+;; 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 .
+
+;;; Commentary:
+
+;; Quickly edit stuff
+
+;;; Code:
+
+(defvar quick-edit-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "/" 'undo)
+    (define-key map "0" 'delete-window)
+    (define-key map "1" 'delete-other-windows)
+    (define-key map "2" 'split-window-below)
+    (define-key map "3" 'split-window-right)
+    (define-key map "K" 'kill-whole-line)
+    (define-key map "V" 'scroll-down-command)
+    (define-key map "a" 'oni:move-beginning-of-dwim)
+    (define-key map "b" 'backward-char)
+    (define-key map "d" 'oni:kill-region-or-forward-char)
+    (define-key map "e" 'oni:move-end-of-dwim)
+    (define-key map "f" 'forward-char)
+    (define-key map "j" 'newline-and-indent)
+    (define-key map "k" 'oni:kill-region-or-line)
+    (define-key map "n" 'next-line)
+    (define-key map "o" 'other-window)
+    (define-key map "p" 'previous-line)
+    (define-key map "v" 'scroll-up-command)
+    (define-key map "w" 'oni:kill-region-or-backward-char)
+    (define-key map (kbd "C-b") 'electric-buffer-list)
+    (define-key map (kbd "C-g") 'quick-edit-mode)
+    (define-key map (kbd "RET") 'quick-edit-mode)
+    map)
+  "Keymap for quick-edit-mode.")
+
+(defun qe-locally-disable ()
+  "Disable quick-edit mode in the minibuffer"
+  (when (eq overriding-local-map quick-edit-map)
+    (setq-local overriding-local-map nil)))
+
+;;;###autoload
+(define-minor-mode quick-edit-mode
+  "Quickly edit stuff."
+  :lighter " qe"
+  :global t
+  (if quick-edit-mode
+      (progn
+        (setq overriding-local-map quick-edit-map)
+        (add-hook 'minibuffer-setup-hook 'qe-locally-disable)
+        (add-hook 'special-mode-hook 'qe-locally-disable))
+    (setq overriding-local-map nil)
+    (remove-hook 'minibuffer-setup-hook 'qe-locally-disable)
+    (remove-hook 'special-mode-hook 'qe-locally-disable)))
+
+(provide 'quick-edit-mode)
+;;; quick-edit-mode.el ends here
diff --git a/emacs/.emacs.d/site-lisp/wm-init.el b/emacs/.emacs.d/site-lisp/wm-init.el
new file mode 100644
index 0000000..694acab
--- /dev/null
+++ b/emacs/.emacs.d/site-lisp/wm-init.el
@@ -0,0 +1,3 @@
+(async-shell-command "herbstluftwm" " herbstluftwm")
+(async-shell-command "dunst" " dunst")
+(async-shell-command "xbindkeys" " xbindkeys")
diff --git a/emacs/.emacs.d/snippets/conf-mode/section b/emacs/.emacs.d/snippets/conf-mode/section
new file mode 100644
index 0000000..55be8f8
--- /dev/null
+++ b/emacs/.emacs.d/snippets/conf-mode/section
@@ -0,0 +1,8 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: Xorg Section
+# key: Section
+# --
+Section "$1"
+        Identifier "$2"
+        $0
+EndSection
diff --git a/emacs/.emacs.d/snippets/emacs-lisp/face b/emacs/.emacs.d/snippets/emacs-lisp/face
new file mode 100644
index 0000000..0a13b99
--- /dev/null
+++ b/emacs/.emacs.d/snippets/emacs-lisp/face
@@ -0,0 +1,5 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: face
+# key: f
+# --
+   `($1 ((t (${2::foreground} $0))))
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/html-mode/block b/emacs/.emacs.d/snippets/html-mode/block
new file mode 100644
index 0000000..6510011
--- /dev/null
+++ b/emacs/.emacs.d/snippets/html-mode/block
@@ -0,0 +1,7 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: block
+# key: block
+# --
+{% block $1 %}
+  $0
+{% endblock %}
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/html-mode/for b/emacs/.emacs.d/snippets/html-mode/for
new file mode 100644
index 0000000..01d9c44
--- /dev/null
+++ b/emacs/.emacs.d/snippets/html-mode/for
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: for
+# key: for
+# condition: pony-tpl-minor-mode
+# --
+{% for $1 in $2 %}
+  $0
+{% endfor %}
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/html-mode/generic-block b/emacs/.emacs.d/snippets/html-mode/generic-block
new file mode 100644
index 0000000..82d40c7
--- /dev/null
+++ b/emacs/.emacs.d/snippets/html-mode/generic-block
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: Template Block
+# key: %
+# condition: pony-tpl-minor-mode
+# --
+{% $1 %}
+   $0
+{% end$1 %}
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/html-mode/script b/emacs/.emacs.d/snippets/html-mode/script
new file mode 100644
index 0000000..e50dbf5
--- /dev/null
+++ b/emacs/.emacs.d/snippets/html-mode/script
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: script
+# key: script
+# --
+
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/html-mode/trans-with-cap b/emacs/.emacs.d/snippets/html-mode/trans-with-cap
new file mode 100644
index 0000000..4f20a33
--- /dev/null
+++ b/emacs/.emacs.d/snippets/html-mode/trans-with-cap
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: trans with cap
+# key: trans
+# condition: pony-tpl-minor-mode
+# --
+{% trans "$1"|capfirst %}
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/org-mode/codeblock b/emacs/.emacs.d/snippets/org-mode/codeblock
new file mode 100644
index 0000000..a200b08
--- /dev/null
+++ b/emacs/.emacs.d/snippets/org-mode/codeblock
@@ -0,0 +1,7 @@
+# -*- mode: snippet -*-
+# name: codeblock
+# key: code
+# --
+#+begin_src $1
+  $0
+#+end_src
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/org-mode/heading b/emacs/.emacs.d/snippets/org-mode/heading
new file mode 100644
index 0000000..9d5451e
--- /dev/null
+++ b/emacs/.emacs.d/snippets/org-mode/heading
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Heading
+# key: *
+# --
+${1:*} ${2:TODO} $3
+${1:$(make-string (length text) ?\ )} :PROPERTIES:
+${1:$(make-string (length text) ?\ )} :CATEGORY: $4
+${1:$(make-string (length text) ?\ )} :END:
+${1:$(make-string (length text) ?\ )} $0
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/org-mode/project b/emacs/.emacs.d/snippets/org-mode/project
new file mode 100644
index 0000000..269d655
--- /dev/null
+++ b/emacs/.emacs.d/snippets/org-mode/project
@@ -0,0 +1,51 @@
+# -*- mode: snippet -*-
+# name: project
+# key: project
+# --
+#+TITLE: ${1:project_name}
+#+LINK: src    ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}
+#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz
+#+LINK: zip    $2$4.zip
+#+STARTUP: showall
+
+#+begin_html
+  
+  
+#+end_html
+
+#+INCLUDE: "dlmenu.inc"
+
+* About
+
+  ${5:A short description about $1}
+
+  | $0Status   | $6 |
+  | Language | $7 |
+  | License  | ${8:GPLv3} |
+
+* Why?
+
+  ${9:Why did you even think of writing $1?}
+
+* Features
+
+  ${10:$1 does...}
+
+* Dependencies
+
+  ${11:$1 needs to have...}
+
+* Download
+
+  ${12:To download $1...}
+
+* Install
+
+  ${13:To install $1...}
+
+* Usage
+
+  ${14:Using $1...}
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/org-mode/snippet b/emacs/.emacs.d/snippets/org-mode/snippet
new file mode 100644
index 0000000..67f15d5
--- /dev/null
+++ b/emacs/.emacs.d/snippets/org-mode/snippet
@@ -0,0 +1,14 @@
+# -*- mode: snippet -*-
+# name: snippet
+# key: snippet
+# --
+#+TITLE: ${1:snippet-name}
+#+OPTIONS: toc:nil
+
+* $1
+
+  ${2:A short description abount $1}
+
+  #+BEGIN_SRC $3 :tangle yes
+$0
+  #+END_SRC
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/php-mode/function b/emacs/.emacs.d/snippets/php-mode/function
new file mode 100644
index 0000000..ab4cf2c
--- /dev/null
+++ b/emacs/.emacs.d/snippets/php-mode/function
@@ -0,0 +1,8 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: function
+# key: function
+# --
+function $1($2)
+{
+    $0
+}
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/php-mode/wpheader.php b/emacs/.emacs.d/snippets/php-mode/wpheader.php
new file mode 100644
index 0000000..2c70f93
--- /dev/null
+++ b/emacs/.emacs.d/snippets/php-mode/wpheader.php
@@ -0,0 +1,13 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: WP Plugin Header
+# key: header
+# --
+/*
+ * Plugin Name: $1
+ * Plugin URI: $2
+ * Description: $3
+ * Version: ${4:1.0}
+ * Author: ${5:Tom Willemse}
+ * Author URI: ${6:https://ryuslash.org}
+ * License: ${7:GPLv2}
+ */
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/defm_empty b/emacs/.emacs.d/snippets/python-mode/defm_empty
new file mode 100644
index 0000000..baa976e
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/defm_empty
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+# name: Empty Defmethod
+# key: defm
+# --
+def ${1:name}(self, *args, **kwargs):
+    '''$2'''
+    return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).$1(*args, **kwargs)
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/form b/emacs/.emacs.d/snippets/python-mode/form
new file mode 100644
index 0000000..225d5e4
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/form
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Model Form
+# key: form
+# --
+class ${1:Model}Form(forms.ModelForm):
+    '''Form for the $1 model.'''
+
+    class Meta:
+        model = $1
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/form_valid b/emacs/.emacs.d/snippets/python-mode/form_valid
new file mode 100644
index 0000000..c5a7e58
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/form_valid
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: Record form
+# key: defm
+# --
+@record_activity(model=${1:`(progn (re-search-backward "^[ \t]*model = \\([a-zA-Z_].*\\)$") (match-string 1))`})
+def form_valid(self, form):
+    '''Make sure any changes to the $1 model get logged.'''
+    return super(${2:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).form_valid(form)
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/form_valid_with_return b/emacs/.emacs.d/snippets/python-mode/form_valid_with_return
new file mode 100644
index 0000000..fac23bc
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/form_valid_with_return
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: form_valid with return
+# key: formvalid
+# --
+def form_valid(self, form):
+    rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form)
+    $0
+    return rv
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/import_from b/emacs/.emacs.d/snippets/python-mode/import_from
new file mode 100644
index 0000000..d9cc4e2
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/import_from
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# name: from ... import ...
+# contributor: Tom Willemse
+# key: from
+# --
+from ${1:module} import ${2:class_or_module}
diff --git a/emacs/.emacs.d/snippets/python-mode/method b/emacs/.emacs.d/snippets/python-mode/method
new file mode 100644
index 0000000..7c033cf
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/method
@@ -0,0 +1,7 @@
+# -*- mode: snippet -*-
+# name: method
+# key: defm
+# --
+def $1(self$2):
+    '''$3'''
+    $0
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/permission_guard b/emacs/.emacs.d/snippets/python-mode/permission_guard
new file mode 100644
index 0000000..ab53895
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/permission_guard
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Permission guard
+# key: defm
+# --
+@method_decorator(permission_required('$1',
+                                      raise_exception=True))
+def dispatch(self, *args, **kwargs):
+    '''Make sure the user has the $1 permission.'''
+    return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs)
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/python-mode/url b/emacs/.emacs.d/snippets/python-mode/url
new file mode 100644
index 0000000..00ade72
--- /dev/null
+++ b/emacs/.emacs.d/snippets/python-mode/url
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: url
+# key: url
+# --
+url(r'^$1', $2, name='$3'),
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/ruby-mode/ProductSeed b/emacs/.emacs.d/snippets/ruby-mode/ProductSeed
new file mode 100644
index 0000000..7e836c2
--- /dev/null
+++ b/emacs/.emacs.d/snippets/ruby-mode/ProductSeed
@@ -0,0 +1,5 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: ProductSeed
+# key: pseed
+# --
+Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW
new file mode 100644
index 0000000..843b32e
--- /dev/null
+++ b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW
@@ -0,0 +1,5 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: ProductSeedWithHW
+# key: pseed
+# --
+Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')
\ No newline at end of file
diff --git a/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup
new file mode 100644
index 0000000..25594c5
--- /dev/null
+++ b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup
@@ -0,0 +1,8 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: ProductSeedWithHWGroup
+# key: pseed
+# --
+Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210')
+Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258')
+Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300')
+Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340')
-- 
cgit v1.2.3-54-g00ecf