diff options
29 files changed, 2226 insertions, 0 deletions
diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore new file mode 100644 index 0000000..031f2b4 --- /dev/null +++ b/.emacs.d/.gitignore @@ -0,0 +1,32 @@ +*.elc +.emacs.desktop* +abbrev_defs +ac-comphist.dat +auto-save-list/ +bookmarks +custom.el +elnode/ +elpa/ +emms-streams +emms/ +flymake.log +geiser-history.guile +history +jabber-hist/ +jabber/ +loaddefs.el +newsticker/ +packages/ +semanticdb/ +smex-items +srecode-map.el +templates/ +themes/ +tramp +url/ +vendor-lisp/ +todo-* +type-break +ido.last +ChangeLog +.mc-lists.el diff --git a/.emacs.d/Makefile b/.emacs.d/Makefile new file mode 100644 index 0000000..4d4f681 --- /dev/null +++ b/.emacs.d/Makefile @@ -0,0 +1,13 @@ +.PHONY: all site-lisp +all: init.elc gnus.elc site-lisp/ + +%.elc: %.el + emacs -Q -batch -eval "(byte-compile-file \"$<\")" + +%/: % + $(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)" diff --git a/.emacs.d/eshell/.gitignore b/.emacs.d/eshell/.gitignore new file mode 100644 index 0000000..ab7ef21 --- /dev/null +++ b/.emacs.d/eshell/.gitignore @@ -0,0 +1,2 @@ +lastdir +login diff --git a/.emacs.d/eshell/alias b/.emacs.d/eshell/alias new file mode 100644 index 0000000..d98e2f5 --- /dev/null +++ b/.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.d/gnus.el b/.emacs.d/gnus.el new file mode 100644 index 0000000..3118a13 --- /dev/null +++ b/.emacs.d/gnus.el @@ -0,0 +1,84 @@ +(eval-when-compile + (require 'gnus) + (require 'gnus-start) + (require 'gnus-sum) + (require 'gnus-art) + (require 'gnus-msg)) + +(defvar oni:mail-adresses + (rx (or "tom@ryuslash.org" "ryuslash@ninthfloor.org" + "ryuslash@gmail.com" "thomas@aethon.nl" "tom@aethon.nl"))) + +(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 gnus-group-line-format "%P %(%C%) %B%60=%4y%-2M%S\n") +(setq gnus-summary-line-format "%U%R%z%ua%I%(%[%4L: %-23,23f%]%) %s\n") +(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-extra-headers '(To)) +(setq gnus-save-newsrc-file nil) +(setq gnus-read-newsrc-file nil) +(setq gnus-article-truncate-lines nil) +;; (setq gnus-parameters +;; '(("gmail" +;; (display . all)) +;; ("aethon" +;; (display . all) +;; ("arch" +;; (display . all))))) +(setq gnus-permanently-visible-groups + (eval-when-compile + (regexp-opt '("gmail:inbox" + "aethon:inbox" + "ninthfloor:inbox" + "ryuslash:inbox")))) +;; (setq nntp-marks-is-evil t) +(setq gnus-check-new-newsgroups nil) +(setq gnus-posting-styles + '((".*" + (address "tom@ryuslash.org") + (eval (setq message-sendmail-extra-arguments '("-a" "ryuslash") + flyspell-default-dictionary "en"))) + ("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.txt") + (eval (setq message-sendmail-extra-arguments '("-a" "aethon") + flyspell-default-dictionary "nl"))))) +(add-hook 'gnus-group-mode-hook 'gnus-topic-mode) +;-----[ BBDB ]-------------------------------------------------------- +;; (require 'bbdb) +;; (bbdb-initialize 'gnus 'message) +;; (bbdb-insinuate-gnus) +;; (setq bbdb-north-american-phone-numbers-p nil) diff --git a/.emacs.d/gtkrc b/.emacs.d/gtkrc new file mode 100644 index 0000000..6b63cd7 --- /dev/null +++ b/.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.d/init.el b/.emacs.d/init.el new file mode 100644 index 0000000..b81c6cb --- /dev/null +++ b/.emacs.d/init.el @@ -0,0 +1,1201 @@ +;;; init.el --- My Emacs init +;;; Commentary: +;;; Code: + +(require 'uniquify) + +(eval-when-compile + (package-initialize) + + (require 'cl) + (require 'esh-io) + (require 'esh-proc) + (require 'dash)) + +(autoload 'gtags-mode "gtags" nil t) +(autoload 'jabber-connect "jabber" nil t) +(autoload 'jabber-message-libnotify "jabber-libnotify") +(autoload 'jabber-muc-libnotify "jabber-libnotify") +(autoload 'jabber-send-message "jabber-chat") +(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 'w3m-bookmark-view "w3m" nil t) +(autoload 'w3m-goto-url "w3m" nil t) +(autoload 'xmodmap-mode "xmodmap-mode" nil t) + +(defadvice org-agenda-redo (after ext:org-agenda-redo-add-appts) + "Pressing `r' on the agenda will also add appointments." + (progn + (setq appt-time-msg-list nil) + (org-agenda-to-appt))) + +(defadvice term-handle-exit (after oni:kill-buffer-after-exit activate) + "Kill the term buffer if the process finished." + (kill-buffer (current-buffer))) + +(defmacro addf (place value) + "Prepend to PLACE VALUE." + `(setf ,place (cons ,value ,place))) + +(defmacro eval-after-init (&rest body) + "Defer execution of BODY until after Emacs init." + (declare (indent 0)) + `(add-hook 'emacs-startup-hook #'(lambda () ,@body))) + +(defmacro mode-hooks (&rest lst) + "Apply `add-mode-hooks' to each element of LST." + (declare (indent 0)) + `(progn + ,@(level (mapcar + #'(lambda (itm) + (add-mode-hooks (car itm) (list 'quote (cadr itm)))) lst)))) + +(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)) + ;; Byte compile the body. If the feature is not available, ignore + ;; warnings. Taken from + ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-11/msg01262.html + (let ((loaded (if (symbolp feature) + (require feature nil :no-error) + (load feature :no-error :no-message)))) + `(,(if loaded + 'progn + (message "stante-after: cannot find %s" feature) + 'with-no-warnings) + (eval-after-load ',feature + `(funcall (function ,(lambda () ,@forms))))))) + +(eval-and-compile + (defun add-hooks (hooks function &optional append local) + "`add-hook' for each in HOOKS." + (mapcar (lambda (h) + `(add-hook (quote ,h) ,function ,append ,local)) + hooks)) + + (defun add-mode-hooks (modes function &optional append local) + "`add-hooks' with MODES renamed to mode-mode-hook." + (let ((mode-names (mapcar #'make-mode-hook-name modes))) + (add-hooks mode-names function append local)))) + +(defun enable (functions) + "Set the `disabled' property for each item in FUNCTIONS to nil." + (mapc #'(lambda (f) (put f 'disabled nil)) functions)) + +(defun hostname () + "Get the current machine's hostname." + (substring (shell-command-to-string "hostname") 0 -1)) + +(defun indent-defun () + "Indent the current defun." + (interactive) + (save-excursion + (mark-defun) + (indent-region (region-beginning) (region-end)))) + +(defun init-make-readable () + "Make the current buffer more readable." + (setq line-spacing .2)) + +(defun 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 who)))) + (when (and buffer proposed-alert) + (with-current-buffer buffer + (insert proposed-alert "\n"))))) + +(eval-and-compile + (defun level (lst) + (let ((lsts (mapcar (lambda (l) (if (listp l) l (list l))) lst))) + (apply #'append lsts)))) + +(defun 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)))) + +(eval-and-compile + (defun make-mode-hook-name (mode) + "Get the hook name for MODE." + (intern (concat (symbol-name mode) "-mode-hook")))) + +(defun 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-eshell-prompt () + "Show a pretty shell prompt." + (let ((status (if (zerop eshell-last-command-status) ?+ ?-)) + (hostname (hostname)) + (dir (abbreviate-file-name (eshell/pwd))) + (branch + (shell-command-to-string + "git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))) + (concat + (propertize (char-to-string status) + 'face `(:foreground ,(if (= status ?+) + "green" + "red"))) + " " + (propertize hostname 'face 'mode-line-buffer-id) + " " + (propertize (oni:shorten-dir dir) 'face 'font-lock-string-face) + " " + (when (not (string= branch "")) + (propertize + ;; Cut off "* " and "\n" + (substring branch 2 -1) + 'face 'font-lock-function-name-face)) + " \n> "))) + +(defun pp^L-ruler (win) + "Just make a string ruler. + +Of either `fci-rule-column' or `fill-column' length -1. Use the +`-' character. WIN is ignored." + (ignore win) + (make-string + (1- (if (boundp 'fci-rule-column) fci-rule-column fill-column)) ?-)) + +(defun 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 reload-buffer () + "Reload current buffer." + (interactive) + (revert-buffer nil t nil)) + +(defun set-emacs-lisp-keys () + "Set some keys for `emacs-lisp-mode'." + (local-set-key (kbd "C-.") 'find-function)) + +(defun set-smartparens-keys () + "Set some keys for `smartparens-mode'." + (local-set-key [remap backward-delete-char] 'sp-backward-delete-char) + (local-set-key [remap delete-char] 'sp-delete-char) + (local-set-key [remap kill-word] 'sp-kill-word) + (local-set-key [remap backward-kill-word] 'sp-backward-kill-word) + (local-set-key (kbd "<C-left>") 'sp-forward-barf-sexp) + (local-set-key (kbd "<C-right>") 'sp-forward-slurp-sexp) + (local-set-key (kbd "M-J") 'sp-join-sexp) + (local-set-key (kbd "M-S") 'sp-split-sexp)) + +(defun turn-off (modes) + "Turn off each mode in MODES." + (mapc (lambda (m) (funcall m -1)) modes)) + +(defun 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)) + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'list-buffers 'ibuffer) +(defalias 'dabbrev-expand 'hippie-expand) + +;; Get rid of annoying and useless +(turn-off '(menu-bar-mode scroll-bar-mode tool-bar-mode blink-cursor-mode + column-number-mode line-number-mode tooltip-mode)) + +(mapc #'loadpath-add-and-autoload + '("~/.emacs.d/site-lisp" "~/projects/emacs/pony-mode/src" + "~/projects/emacs/php-mode" "~/.emacs.d/vendor-lisp/org/lisp" + "~/.emacs.d/vendor-lisp/org/contrib/lisp" + "~/.emacs.d/vendor-lisp/eap")) + +(stante-after appt + (setq appt-disp-window-function #'oni:appt-display-window-and-jabber) + (setq appt-display-diary nil)) + +(stante-after "bindings" + (setq mode-line-default-help-echo "")) + +(stante-after auto-complete + (add-to-list 'ac-modes 'slime-repl-mode) + (setq-default ac-sources '(ac-source-imenu + ac-source-gtags + ac-source-abbrev + ac-source-yasnippet + ac-source-words-in-buffer + ac-source-words-in-same-mode-buffers + ac-source-dictionary + ac-source-functions + ac-source-symbols + ac-source-variables + ac-source-features)) + (setq ac-auto-show-menu nil)) + +(stante-after browse-url + (setq browse-url-browser-function 'browse-url-generic) + (setq browse-url-generic-program (getenv "BROWSER"))) + +(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 compile + (setq compilation-scroll-output t)) + +(stante-after custom + (setq custom-theme-directory "~/.emacs.d/themes") + (eval-after-init (load-theme 'yoshi t))) + +(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+ anything)) + "dailies" "work" "tasks" + (or "bookmarks.org" + "contacts.org")) eol)) + (rx (or "*ielm*" "*-jabber-roster-*" "*eshell*" + "*ansi-term*")) + (rx (and "*" (or "magit" "scratch-") (1+ anything) + "*"))) + desktop-clear-preserve-buffers)) + (setq desktop-files-not-to-save + (rx (or (regexp "\\(^/[^/:]*:\\|(ftp)$\\)") + (and "/" (or "dailies" "tasks" "bookmarks.org" + "contacts.org" "work") eol)))) + (add-to-list 'desktop-globals-to-clear 'desktop-dirname)) + +(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 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) + ("\\.tpl$" . html-mode) + ("^\\.Xmodmap$" . xmodmap-mode)) + auto-mode-alist))) + +(stante-after fill-column-indicator + (setq-default fci-rule-column 73)) + +(stante-after fiplr + (add-to-list 'fiplr-root-markers ".emacs.desktop") + (addf (cadr (assoc 'files fiplr-ignored-globs)) "*.pyc") + (addf (cadr (assoc 'directories fiplr-ignored-globs)) "migrations")) + +(stante-after flycheck + (mapc (lambda (c) (delq c flycheck-checkers)) + '(python-pylint python-pyflakes)) + (setf flycheck-highlighting-mode 'columns)) + +(stante-after geiser-repl + (setq geiser-repl-history-filename "~/.emacs.d/geiser-history")) + +(stante-after gnus + (setq gnus-novice-user nil)) + +(stante-after gnus-start + (setq gnus-init-file "~/.emacs.d/gnus")) + +(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")) + +(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 'selected-window) + (setq ido-max-window-height 1) + (setq ido-save-directory-list-file nil)) + +(stante-after ido-ubiquitous + (setq ido-ubiquitous-command-exceptions + '(org-refile org-capture-refile))) + +(stante-after imenu + (setq imenu-auto-rescan t)) + +(stante-after jabber + (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo) + (setq jabber-account-list + `((,(concat "tom@ryuslash.org/" (hostname))) + (,(concat "ryuslash@ninthfloor.org/" (hostname)))))) + +(stante-after jabber-avatar + (setq jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/")) + +(stante-after jabber-chat + (setq jabber-chat-buffer-format "+%n") + (setq jabber-chat-foreign-prompt-format "%t %u/%r <\n") + (setq jabber-chat-local-prompt-format "%t %u/%r >\n") + (setq jabber-chat-buffer-show-avatar nil)) + +(stante-after jabber-chatstates + (setq jabber-chatstates-confirm nil)) + +(stante-after jabber-muc-nick-coloring + (setq jabber-muc-colorize-local t) + (setq jabber-muc-colorize-foreign t)) + +(stante-after jabber-history + (setq jabber-history-enabled t) + (setq jabber-use-global-history nil) + (setq jabber-history-dir "~/.emacs.d/jabber-hist")) + +(stante-after jabber-muc + (setq jabber-groupchat-buffer-format "++%n") + (setq jabber-groupchat-prompt-format "%t %u --\n") + (setq jabber-muc-autojoin '("aethon@muc.ryuslash.org"))) + +(stante-after jabber-roster + (setq jabber-roster-show-bindings nil) + (setq jabber-show-offline-contacts nil)) + +(stante-after jabber-vcard-avatars + (setq jabber-vcard-avatars-publish nil) + (setq jabber-vcard-avatars-retrieve nil)) + +(stante-after jedi + (setcar jedi:server-command "python2") + (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-default-tracking-name-function + 'magit-default-tracking-name-branch-only) + (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 + (setq org-special-ctrl-a/e t)) + +(stante-after package + (setq package-archives + '(("melpa" . "http://melpa.milkbox.net/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("gnu" . "http://elpa.gnu.org/packages/"))) + (setq package-load-list '((htmlize "1.39") + (lua-mode "20111107") + (dispass "1.1.2.1") + (desktop-registry "1.1.0") + all))) + +(stante-after "paragraph" + (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 pp-c-l + (setq pp^L-^L-string-function 'pp^L-ruler) + (setq pp^L-^L-string-pre nil)) + +(stante-after sendmail + (setq send-mail-function 'sendmail-send-it) + (setq sendmail-program "/usr/bin/msmtp")) + +(stante-after simple + (setq read-mail-command 'gnus)) + +(stante-after slime + (setq inferior-lisp-program "sbcl --noinform --no-linedit")) + +(stante-after smartparens + (setq sp-cancel-autoskip-on-backward-movement nil)) + +(stante-after smex + (setq smex-key-advice-ignore-menu-bar t) + (setq smex-save-file "~/.emacs.d/smex-items")) + +(stante-after smiley + (setq smiley-style 'medium)) + +(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) + (setq user-mail-address "tom@ryuslash.org")) + +(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 + '("^\\*git-project-list\\*$" git-project-show-window)) + (add-to-list + 'display-buffer-alist + '("^\\*magit: .*\\*$" display-buffer-same-window))) + +(stante-after yasnippet + (setq yas-fallback-behavior nil) + (setq yas-prompt-functions '(yas-ido-prompt))) + +(mode-hooks + ((clojure emacs-lisp lisp sawfish scheme ielm geiser-repl slime-repl) + paredit-mode) + ((comint) turn-on-compilation-shell-for-pony) + ((css) rainbow-mode) + ((emacs-lisp go html lua php python rst ruby rust sh) flycheck-mode) + ((emacs-lisp ielm) eldoc-mode) + ((emacs-lisp ielm) set-emacs-lisp-keys) + ((eshell) buffer-disable-undo) + ((git-commit text) auto-fill-mode) + ((git-commit text) flyspell-mode) + ((html org prog) yas-minor-mode) + ((html prog) fci-mode) + ((html) tagedit-mode) + ((html) turn-off-flyspell) + ((html) turn-off-auto-fill) + ((hy) paredit-mode) + ((jabber-chat) visual-line-mode) + ((js2 python) smartparens-mode) + ((markdown python) whitespace-mode) + ((message org gnus-summary gnus-article gnus-group magit-log-edit Info + info org-agenda) + init-make-readable) + ((prog) rainbow-delimiters-mode) + ((python) jedi:setup) + ((python) subword-mode) + ((slime slime-repl) set-up-slime-ac) + ((smartparens) set-smartparens-keys) + ((tagedit) tagedit-add-experimental-features) + ((tagedit) tagedit-add-paredit-like-keybindings) + ((vala) oni:vala-mode-func)) + + +(add-hook 'emacs-startup-hook 'pretty-control-l-mode) +(add-hook 'after-make-frame-functions + '(lambda (arg) (pretty-control-l-mode))) +(add-hook 'jabber-alert-message-hooks 'jabber-message-libnotify) +(add-hook 'jabber-alert-muc-hooks 'jabber-muc-libnotify) +(add-hook 'jabber-alert-presence-hooks #'init-show-status-in-buffer) + +(setq-default bidi-paragraph-direction 'left-to-right) +(setq-default tab-width 4) +(setq-default indent-tabs-mode nil) +(setq-default truncate-lines t) +(setq custom-file "~/.emacs.d/custom.el") +(setq default-frame-alist + `((border-width . 0) + (internal-border-width . 0) + (vertical-scroll-bars . nil) + (menu-bar-lines . nil) + (tool-bar-lines . nil) + (font . "Liberation Mono:pixelsize=16"))) +(setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) +(setq inhibit-local-menu-bar-menus t) +(setq message-log-max 1000) +(setq redisplay-dont-pause t) +(setq use-dialog-box nil) +(setq user-full-name "Tom Willemse") +(setq window-combination-resize t) +(setq scroll-preserve-screen-position t) +(add-to-list 'debug-ignored-errors "^Can't shift all lines enough") +;; Can't be put in an eval-after-load or such because by then it will +;; be too late. +(setq elnode-do-init nil) + +(enable '(downcase-region narrow-to-page narrow-to-region scroll-left + upcase-region)) + +(eval-after-init (ido-ubiquitous-mode)) + +(eval-after-init + (load (expand-file-name "~/.local/share/quicklisp/slime-helper.el"))) + +(eval-after-load "org" '(require 'org-init)) + +(eval-after-init + (require 'auto-complete-config) + (ac-config-default)) + +(load "eap-autoloads") + +(eval-after-init (smex-initialize)) +(eval-after-init (global-diff-hl-mode)) +(eval-after-init (mode-icons-mode)) +(eval-after-init (desktop-registry-auto-register)) + + +;; (setq pony-tpl-indent-moves t) +;; (setq rainbow-delimiters-max-face-count 12) + +(add-hook 'after-save-hook 'oni:after-save-func t) +(add-hook 'before-save-hook 'oni:before-save-func) +(add-hook 'c-mode-hook 'oni:c-mode-func) +(add-hook 'css-mode-hook 'oni:css-mode-func) +(add-hook 'diary-display-hook 'oni:diary-display-func) +(add-hook 'go-mode-hook 'oni:go-mode-func) +(add-hook 'gtags-mode-hook 'oni:gtags-mode-func) +(add-hook 'haskell-mode-hook 'oni:haskell-mode-func) +(add-hook 'jabber-roster-mode-hook 'oni:jabber-roster-mode-func) +(add-hook 'java-mode-hook 'oni:java-mode-func) +(add-hook 'js-mode-hook 'oni:js-mode-func) +(add-hook 'js2-mode-hook 'oni:js2-mode-func) +(add-hook 'lua-mode-hook 'oni:lua-mode-func) +(add-hook 'markdown-mode-hook 'oni:markdown-mode-func) +(add-hook 'php-mode-hook 'oni:php-mode-func) +(add-hook 'prog-mode-hook 'oni:prog-mode-func) +(add-hook 'python-mode-hook 'oni:python-mode-func) +(add-hook 'term-mode-hook 'oni:term-mode-func) +(add-hook 'write-file-hooks 'oni:write-file-func) +(add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func) + +(global-set-key (kbd "'") 'oni:self-insert-dwim) +(global-set-key (kbd "<XF86HomePage>") 'oni:raise-scratch) +(global-set-key (kbd "<XF86Mail>") 'gnus) +(global-set-key (kbd "<f10>") 'git-project-show-files) +(global-set-key (kbd "<f5>") 'reload-buffer) +(global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer) +(global-set-key (kbd "<f7>") 'magit-status) +(global-set-key (kbd "<f8>") 'raise-eshell) +(global-set-key (kbd "<hiragana>") 'oni:show-org-index) +(global-set-key (kbd "C-<") 'oni:indent-shift-left) +(global-set-key (kbd "C->") 'oni: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 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 s") 'desktop-save-in-desktop-dir) +(global-set-key (kbd "C-c i p") 'identica-update-status-interactive) +(global-set-key (kbd "C-c p") 'oni:show-buffer-position) +(global-set-key (kbd "C-c t") 'oni:raise-ansi-term) +(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 "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] 'move-beginning-of-dwim) +(global-set-key (kbd "C-x f") 'fiplr-find-file) +(global-set-key (kbd "C-c m") 'gnus) +(global-set-key (kbd "C-c g s") 'magit-status) +(global-set-key (kbd "C-c g i") 'magit-init) +(global-set-key (kbd "C-c h r") 'hypo-region) + +(if (daemonp) + (global-set-key "\C-x\C-c" 'oni:close-client-window)) + +(when (or window-system (daemonp)) + (global-unset-key "\C-z")) + +(ido-mode) +(minibuffer-electric-default-mode) +(auto-insert-mode) +(savehist-mode) +(show-paren-mode) +(winner-mode) +(help-at-pt-set-timer) +(windmove-default-keybindings) + +(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))) + +(global-set-key (kbd "<prior>") 'oni:scroll-down-or-prev-page) +(global-set-key (kbd "<next>") 'oni:scroll-up-or-next-page) + +;;; Finally, load any `customize' settings. +(load custom-file) + + +(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." + (concat (symbol-name user) "@" (symbol-name host) "." + (symbol-name com))) + +(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:appt-display-window-and-jabber (min-to-app new-time appt-msg) + "Send a message to my phone jabber account." + (jabber-send-message (car jabber-connections) "phone@ryuslash.org" + nil (format "%s%s (in %s minutes)" + new-time appt-msg min-to-app) nil) + (appt-disp-window min-to-app new-time appt-msg)) +;; (jabber-send-message (car jabber-connections) +;; "aethon@muc.ryuslash.org" nil "Hi, I'm a programmatic message; this +;; upens up possibilities :)" "groupchat") +(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) + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(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:close-client-window () + "Close a client's frames." + (interactive) + (server-save-buffers-kill-terminal nil)) + +(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:css-mode-func () + "Function for `css-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(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: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:go-mode-func () + "Function for `go-mode-hook'." + (setq indent-tabs-mode nil) + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:gtags-mode-func () + "Function for `gtags-mode-hook'." + (local-set-key "\M-," 'gtags-find-tag) + (local-set-key "\M-." 'gtags-find-rtag)) + +(defun oni:haskell-mode-func () + "Function for `haskell-mode-hook'." + (turn-on-haskell-indentation)) + +(defun oni:indent-shift-left (start end &optional count) + "Rigidly indent region. +Region is from START to END. Move +COUNT number of spaces if it is non-nil otherwise use +`tab-width'." + (interactive + (if mark-active + (list (region-beginning) (region-end) current-prefix-arg) + (list (line-beginning-position) + (line-end-position) + current-prefix-arg))) + (if count + (setq count (prefix-numeric-value count)) + (setq count tab-width)) + (when (> count 0) + (let ((deactivate-mark nil)) + (save-excursion + (goto-char start) + (while (< (point) end) + (if (and (< (current-indentation) count) + (not (looking-at "[ \t]*$"))) + (error "Can't shift all lines enough")) + (forward-line)) + (indent-rigidly start end (- count)))))) + +(defun oni:indent-shift-right (start end &optional count) + "Indent region between START and END rigidly to the right. +If COUNT has been specified indent by that much, otherwise look at +`tab-width'." + (interactive + (if mark-active + (list (region-beginning) (region-end) current-prefix-arg) + (list (line-beginning-position) + (line-end-position) + current-prefix-arg))) + (let ((deactivate-mark nil)) + (if count + (setq count (prefix-numeric-value count)) + (setq count tab-width)) + (indent-rigidly start end count))) + +(defun oni:jabber-alert-message-func (from buffer text title) + (notifications-notify :title title + :body text)) + +(defun oni:jabber-roster-mode-func () + "Function for `jabber-roster-mode-hook'." + (setq mode-line-format + (list (propertize " %m" 'face 'mode-line-buffer-id)))) + +(defun oni:java-mode-func () + "Function for `java-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:js-mode-func () + "Function for `js-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:js2-mode-func () + "Function for `js2-mode-hook'." + (oni:js-mode-func)) + +(defun oni:lua-mode-func() + "Function for `lua-mode-hook'." + (local-unset-key (kbd ")")) + (local-unset-key (kbd "]")) + (local-unset-key (kbd "}"))) + +(defun oni:markdown-mode-func () + "Function for `markdown-mode-hook'." + (setq-local whitespace-style '(face trailing))) + +(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))) + (matchp (string-match "\\([^/]+\\)/\\([0-9]\\{4\\}\\) - \\(.+\\)/\\([0-9]\\{2,3\\}\\) - \\(.+\\)\\..\\{3,4\\}$" song)) + (band (substring song (match-beginning 1) (match-end 1))) + (year (substring song (match-beginning 2) (match-end 2))) + (album (substring song (match-beginning 3) (match-end 3))) + (track (substring song (match-beginning 4) (match-end 4))) + (title (substring song (match-beginning 5) (match-end 5)))) + (format "[%s - %s]" band title))) + +(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:newline-and-indent () + "`newline-and-indent', but with a twist. +When dealing with braces, add another line and indent that too." + (interactive) + (if (and (not (or (= (point) (point-max)) + (= (point) (point-min)))) + (or (and (char-equal (char-before) ?{) + (char-equal (char-after) ?})) + (and (char-equal (char-before) ?\() + (char-equal (char-after) ?\))))) + (save-excursion (newline-and-indent))) + (newline-and-indent)) + +(defun oni:php-mode-func () + "Function for `php-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent) + (c-set-offset 'arglist-intro '+) + (c-set-offset 'arglist-close '0) + (setq-local fci-rule-column 80)) + +(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 fci-rule-column 79 + 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-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: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: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: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:skip-ex-tag () + (let ((tags (org-entry-get (point) "TAGS"))) + (when (and tags (string-match-p ":ex:" tags)) + (save-excursion + (org-forward-element) + (point))))) + +(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:term-mode-func () + "Function for `term-mode-hook'." + (setq truncate-lines nil)) + +(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)) + +;;; init.el ends here diff --git a/.emacs.d/site-lisp/.gitignore b/.emacs.d/site-lisp/.gitignore new file mode 100644 index 0000000..813048b --- /dev/null +++ b/.emacs.d/site-lisp/.gitignore @@ -0,0 +1 @@ +rudel/ diff --git a/.emacs.d/site-lisp/Makefile b/.emacs.d/site-lisp/Makefile new file mode 100644 index 0000000..0925ac7 --- /dev/null +++ b/.emacs.d/site-lisp/Makefile @@ -0,0 +1,5 @@ +.PHONY: all +all: org-init.elc + +%.elc: %.el + emacs -Q -batch -eval "(byte-compile-file \"$<\")" diff --git a/.emacs.d/site-lisp/dzen.el b/.emacs.d/site-lisp/dzen.el new file mode 100644 index 0000000..da83099 --- /dev/null +++ b/.emacs.d/site-lisp/dzen.el @@ -0,0 +1,86 @@ +;;; dzen.el --- Control DZEN2 from emacs + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse <slash@drd> +;; 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 <http://www.gnu.org/licenses/>. + +;;; 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.d/site-lisp/eltuki.el b/.emacs.d/site-lisp/eltuki.el new file mode 100644 index 0000000..b64f786 --- /dev/null +++ b/.emacs.d/site-lisp/eltuki.el @@ -0,0 +1,266 @@ +;;; eltuki.el --- Tekuti functions + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse <slash@drd> +;; 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 <http://www.gnu.org/licenses/>. + +;;; 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.d/site-lisp/metalexpress.el b/.emacs.d/site-lisp/metalexpress.el new file mode 100644 index 0000000..619e4e3 --- /dev/null +++ b/.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 <thomas@aethon.nl> +;; 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 <http://www.gnu.org/licenses/>. + +;;; 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.d/site-lisp/mu4e-init.el b/.emacs.d/site-lisp/mu4e-init.el new file mode 100644 index 0000000..e11baf5 --- /dev/null +++ b/.emacs.d/site-lisp/mu4e-init.el @@ -0,0 +1,54 @@ +;;; mu4e-init.el --- mu4e initialization + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse <slash@drd> +;; 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 <http://www.gnu.org/licenses/>. + +;;; 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.d/site-lisp/org-init.el b/.emacs.d/site-lisp/org-init.el new file mode 100644 index 0000000..e3d0044 --- /dev/null +++ b/.emacs.d/site-lisp/org-init.el @@ -0,0 +1,151 @@ +;;; org-init.el --- Org initialization + +;; Copyright (C) 2012 Tom Willemse + +;; Author: Tom Willemse <slash@drd> +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'appt) +(require 'org-habit) +(require 'org-protocol) + +(eval-after-load "org" + '(require 'org-contacts)) + +(eval-when-compile + (require 'desktop) + (require 'org-capture)) + +(autoload 'org-clocking-p "org-clock") + +(eval-after-load "org-crypt" + '(org-crypt-use-before-save-magic)) + +(defun tagify (str) + "Remove dots, replace - with _ in STR." + (replace-regexp-in-string + "-" "_" (replace-regexp-in-string "\\." "" (downcase str)))) + +(defun filter-by-agenda (entry) + "Return ENTRY if it has no tags or a tag corresponding to the desktop." + (require 'desktop) + (let ((label (when desktop-dirname + (tagify (file-name-base + (directory-file-name + (expand-file-name desktop-dirname)))))) + (tags (get-text-property 0 'tags entry))) + (when (or (null desktop-dirname) (null tags) (member label tags)) + entry))) + +(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)) + +(setq org-agenda-files '("~/documents/org/tasks")) + +(setq org-agenda-before-sorting-filter-function #'filter-by-agenda) +(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 "~/documents/org/tasks") + "* TODO %? %(let ((dname (desktop-registry-current-desktop))) + (if dname + (concat \":\" dname \":\") + \"\"))") + ("T" "Linked task" entry (file "~/documents/org/tasks") + "* TODO %? %(let ((dname (desktop-registry-current-desktop))) + (if dname + (concat \":\" dname \":\") + \"\"))\n\n %a") + ("a" "Appointment" entry (file "~/documents/org/tasks") + "* %?\n %^T\n\n %a") + ("n" "General note" entry (file ,org-default-notes-file) + (function oni:note-template)))) +(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 + '(("TODO" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830")) + ("DONE" :foreground "#9ad870" :background "#222224" :box (:width 1 :color "#333335")) + ("SUCCEEDED" :foreground "#9ad870" :background "#222224" :box (:width 1 :color "#333335")) + ("WAITING" :foreground "#ffbb56" :background "#171719" :box (:width 1 :color "#282830")) + ("CANCELLED" :foreground "#93d8d8" :background "#222224" :box (:width 1 :color "#333335")) + ("FAILED" :foreground "#93d8d8" :background "#222224" :box (:width 1 :color "#333335")) + ("WIP" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830")) + ("HOLD" :foreground "#ffbb56" :background "#171719" :box (:width 1 :color "#282830")) + ("ACQUIRE" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830")) + ("IGNORED" :foreground "#999999" :background "#222224" :box (:width 1 :color "#333335")) + ("COMMENT" :foreground "#969696" :background "#3d3d3d" :box (:line-width 2 :color "#3d3d3d")))) +(setq org-use-fast-todo-selection t) +(setq org-agenda-skip-function-global 'oni:skip-ex-tag) +(setq org-use-property-inheritance '("slug")) + +(add-hook 'org-agenda-mode-hook 'org-agenda-to-appt) + +(add-to-list 'org-modules 'habit) + +(org-indent-mode t) + +(org-agenda-to-appt) +(ad-activate 'org-agenda-redo) + +(provide 'org-init) +;;; org-init.el ends here diff --git a/.emacs.d/site-lisp/quick-edit-mode.el b/.emacs.d/site-lisp/quick-edit-mode.el new file mode 100644 index 0000000..898d7c2 --- /dev/null +++ b/.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 <slash@drd> +;; 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 <http://www.gnu.org/licenses/>. + +;;; 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.d/site-lisp/wm-init.el b/.emacs.d/site-lisp/wm-init.el new file mode 100644 index 0000000..694acab --- /dev/null +++ b/.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.d/snippets/html-mode/for b/.emacs.d/snippets/html-mode/for new file mode 100644 index 0000000..01d9c44 --- /dev/null +++ b/.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.d/snippets/html-mode/generic-block b/.emacs.d/snippets/html-mode/generic-block new file mode 100644 index 0000000..82d40c7 --- /dev/null +++ b/.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.d/snippets/html-mode/script b/.emacs.d/snippets/html-mode/script new file mode 100644 index 0000000..e50dbf5 --- /dev/null +++ b/.emacs.d/snippets/html-mode/script @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: script +# key: script +# -- +<script src="$1" type="${2:text/javascript}" language="${3:javascript}"></script>
\ No newline at end of file diff --git a/.emacs.d/snippets/org-mode/codeblock b/.emacs.d/snippets/org-mode/codeblock new file mode 100644 index 0000000..a200b08 --- /dev/null +++ b/.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.d/snippets/org-mode/heading b/.emacs.d/snippets/org-mode/heading new file mode 100644 index 0000000..9d5451e --- /dev/null +++ b/.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.d/snippets/org-mode/project b/.emacs.d/snippets/org-mode/project new file mode 100644 index 0000000..269d655 --- /dev/null +++ b/.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 + <script src="/keyjs.js" type="text/javascript"></script> + <script type="text/javascript"> + keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ], + "h": [ "keyjs_goto", "http://ryuslash.org" ] }); + </script> +#+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.d/snippets/org-mode/snippet b/.emacs.d/snippets/org-mode/snippet new file mode 100644 index 0000000..67f15d5 --- /dev/null +++ b/.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.d/snippets/python-mode/defm_empty b/.emacs.d/snippets/python-mode/defm_empty new file mode 100644 index 0000000..baa976e --- /dev/null +++ b/.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.d/snippets/python-mode/form b/.emacs.d/snippets/python-mode/form new file mode 100644 index 0000000..225d5e4 --- /dev/null +++ b/.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.d/snippets/python-mode/form_valid b/.emacs.d/snippets/python-mode/form_valid new file mode 100644 index 0000000..c5a7e58 --- /dev/null +++ b/.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.d/snippets/python-mode/import_from b/.emacs.d/snippets/python-mode/import_from new file mode 100644 index 0000000..d9cc4e2 --- /dev/null +++ b/.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.d/snippets/python-mode/permission_guard b/.emacs.d/snippets/python-mode/permission_guard new file mode 100644 index 0000000..ab53895 --- /dev/null +++ b/.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.d/snippets/python-mode/url b/.emacs.d/snippets/python-mode/url new file mode 100644 index 0000000..00ade72 --- /dev/null +++ b/.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 |