2012-09-07 15:21:59 +02:00
|
|
|
;;; init.el --- ryuslash's emacs init
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; Does so much and changes so often
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(require 'geiser-install)
|
|
|
|
(require 'iso-transl)
|
|
|
|
(require 'newcomment)
|
|
|
|
(require 'uniquify)
|
|
|
|
(require 'w3m-load)
|
|
|
|
|
2012-09-07 15:21:59 +02:00
|
|
|
;;; Code:
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(eval-and-compile
|
|
|
|
(package-initialize)
|
|
|
|
|
|
|
|
(mapc #'(lambda (directory)
|
2012-08-19 00:26:15 +02:00
|
|
|
(add-to-list 'load-path directory)
|
|
|
|
(let ((default-directory directory))
|
|
|
|
(normal-top-level-add-subdirs-to-load-path)))
|
|
|
|
'("/usr/share/emacs/site-lisp" "~/.emacs.d/site-lisp"))
|
|
|
|
(add-to-list 'load-path "~/.emacs.d/"))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(autoload 'gtags-mode "gtags" nil t)
|
2012-08-18 13:57:56 +02:00
|
|
|
(autoload 'identica-mode "identica-mode" nil t)
|
|
|
|
(autoload 'mu4e "mu4e" nil t)
|
2012-08-19 00:26:15 +02:00
|
|
|
(autoload 'naquadah-get-colors "naquadah-theme")
|
2012-08-26 21:50:26 +02:00
|
|
|
(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 'xmodmap-mode "xmodmap-mode" nil t)
|
2012-09-01 11:45:00 +02:00
|
|
|
(autoload 'jabber-connect "jabber" nil t)
|
2012-09-13 10:38:37 +02:00
|
|
|
(autoload 'define-slime-contrib "slime")
|
|
|
|
(autoload 'slime-js-minor-mode "slime-js" nil t)
|
2012-08-26 21:50:26 +02:00
|
|
|
|
2012-08-19 00:26:15 +02:00
|
|
|
(load (expand-file-name "~/.emacs.d/site-lisp/loaddefs.el"))
|
2012-08-26 21:50:26 +02:00
|
|
|
|
|
|
|
(define-key key-translation-map (kbd "C-j") (kbd "C-l"))
|
|
|
|
(define-key key-translation-map (kbd "C-l") (kbd "C-j"))
|
|
|
|
|
|
|
|
(defadvice org-agenda-redo (after 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)))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
2012-08-19 00:26:15 +02:00
|
|
|
(defconst oni:c-outline-regex
|
|
|
|
(eval-when-compile
|
|
|
|
(concat
|
|
|
|
"\\(?:static\\s +\\)?\\(?:\\sw+\\(?: \\|\t\\|\n\\)*?\\*?\\)"
|
|
|
|
"\\(?:\\s \\|\t\\|\n\\)\\(?:\\sw\\|_\\)+([^)]*)[^;\n]*$"))
|
2012-09-07 15:21:59 +02:00
|
|
|
"Regex for command `outline-minor-mode' for `c-mode'.")
|
2012-08-19 00:26:15 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defconst oni:javascript-outline-regex "function \\(\\w\\|_\\)+("
|
2012-09-07 15:21:59 +02:00
|
|
|
"Regex for command `outline-minor-mode' for `js-mode'.")
|
2012-08-26 21:50:26 +02:00
|
|
|
|
|
|
|
(defconst oni:php-outline-regex
|
|
|
|
(eval-when-compile
|
|
|
|
(concat
|
|
|
|
"^ *\\(\\(?:namespace\\|interface\\) [a-zA-Z0-9_]\\|\\(\\(abstract"
|
|
|
|
"\\|final\\) \\)?class [a-zA-Z0-9_]+\\( extends [\\a-zA-Z0-9_]+\\)?"
|
|
|
|
"\\|\\(abstract \\)?\\(public\\|private\\|protected\\)?"
|
|
|
|
"\\( static\\)? function [a-zA-Z0-9_]+(\\|/\\*\\*\\)"))
|
2012-09-07 15:21:59 +02:00
|
|
|
"Regex for command `outline-minor-mode' for `php-mode'.")
|
2012-08-26 21:50:26 +02:00
|
|
|
|
|
|
|
(defconst oni:python-outline-regex
|
|
|
|
(eval-when-compile
|
|
|
|
(concat "^[ \t]*\\(?:@[a-zA-Z0-9_]+\\(?:([a-zA-Z0-9_=, ]*)\\)?"
|
|
|
|
"\n\\)*[ \t]*\\(?:\\(class\\|def\\)[ \t]+\\(\\sw\\|\\s_\\)+"
|
|
|
|
"\\(([^)]*):\\)?\\|\\#[ a-zA-Z0-9]*\\#\\)"))
|
2012-09-07 15:21:59 +02:00
|
|
|
"Regex for command `outline-minor-mode' for `python-mode'.")
|
2012-08-26 21:50:26 +02:00
|
|
|
|
|
|
|
(defface oni:mode-line-buffer-column
|
|
|
|
'((t (:inherit font-lock-type-face)))
|
|
|
|
"Face for the column number in the mode-line"
|
|
|
|
:group 'local)
|
|
|
|
|
|
|
|
(defface oni:mode-line-buffer-line
|
|
|
|
'((t (:inherit font-lock-type-face)))
|
|
|
|
"Face for the line number in the mode-line"
|
|
|
|
:group 'local)
|
|
|
|
|
|
|
|
(defface oni:mode-line-buffer-position
|
|
|
|
'((t (:inherit font-lock-constant-face)))
|
|
|
|
"Face for the buffer position in the mode-line"
|
|
|
|
:group 'local)
|
|
|
|
|
|
|
|
(defface oni:mode-line-buffer-state
|
|
|
|
'((t (:inherit font-lock-preprocessor-face)))
|
|
|
|
"Face for the state of the buffer in the mode-line"
|
|
|
|
:group 'local)
|
|
|
|
|
|
|
|
(defface oni:mode-line-mode
|
|
|
|
'((t (:inherit font-lock-string-face)))
|
|
|
|
"Face for the major mode in the mode-line"
|
|
|
|
:group 'local)
|
|
|
|
|
|
|
|
(defface oni:mode-line-modified
|
|
|
|
'((t (:inherit font-lock-warning-face)))
|
|
|
|
"Face for the modified state in the mode-line"
|
|
|
|
:group 'local)
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defmacro oni:define-mailbox (name email &optional signature longname)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Define a mailbox function for mailbox NAME with address EMAIL.
|
|
|
|
Optionally set signature to SIGNATURE and use LONGNAME as the
|
|
|
|
actual account name."
|
2012-08-18 13:57:56 +02:00
|
|
|
`(defun ,(make-symbol (concat "oni:" name "-mailbox")) ()
|
|
|
|
,(concat "Settings for " name " mailbox")
|
|
|
|
(setq mu4e-mu-home ,(expand-file-name (concat "~/.mu/" name))
|
|
|
|
mu4e-maildir ,(expand-file-name (concat "~/documents/mail/"
|
|
|
|
(or longname name)))
|
|
|
|
mu4e-get-mail-command ,(concat "offlineimap -oa " (or longname
|
|
|
|
name))
|
|
|
|
mu4e~main-buffer-name ,(concat "*mu4e-" name "*")
|
|
|
|
user-mail-address ,email
|
|
|
|
message-sendmail-extra-arguments '("-a" ,name)
|
|
|
|
message-signature-file ,signature)))
|
|
|
|
|
2012-08-24 10:51:47 +02:00
|
|
|
(defmacro oni:email (user at host dot com)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Turn arguments into an email address.
|
2012-09-14 01:55:41 +02:00
|
|
|
The resulting email address will look like: USER@HOST.COM, AT and
|
|
|
|
DOT are intentionally being skipped."
|
2012-08-24 10:51:47 +02:00
|
|
|
(concat (symbol-name user) "@" (symbol-name host) "."
|
|
|
|
(symbol-name com)))
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defmacro oni:generic-outline (regex)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Prepare for enabling command `outline-minor-mode'.
|
|
|
|
Argument REGEX will be used to set `outline-regexp' for this buffer."
|
2012-08-18 13:57:56 +02:00
|
|
|
`(progn
|
2012-08-31 09:52:16 +02:00
|
|
|
(when (buffer-file-name)
|
|
|
|
(outline-minor-mode)
|
|
|
|
(set (make-local-variable 'outline-regexp) ,regex)
|
|
|
|
(hide-body)
|
|
|
|
(local-set-key [C-tab] 'outline-toggle-children))))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-19 00:26:15 +02:00
|
|
|
(defmacro oni:color (name)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Fetch color NAME from the naquadah color theme."
|
2012-08-19 00:26:15 +02:00
|
|
|
`(naquadah-get-colors (quote ,name)))
|
|
|
|
|
|
|
|
(defvar oni:mailbox-map
|
|
|
|
'("top" ("menu"
|
|
|
|
("ryulash.org" . "ryuslash")
|
|
|
|
("ninthfloor" . "ninthfloor")
|
|
|
|
("gmail" . "gmail")
|
|
|
|
("aethon" . "aethon")))
|
|
|
|
"A mailbox map for use with `tmm-prompt'.")
|
|
|
|
|
|
|
|
(defvar oni:required-packages
|
|
|
|
'(graphviz-dot-mode htmlize magit rainbow-delimiters
|
|
|
|
rainbow-mode yasnippet markdown-mode flymake
|
|
|
|
flymake-cursor pony-mode sauron dispass
|
|
|
|
expand-region fill-column-indicator
|
|
|
|
git-auto-commit-mode idomenu magit smex)
|
2012-09-07 15:21:59 +02:00
|
|
|
"List of all the packages I have (want) installed.")
|
2012-08-19 00:26:15 +02:00
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defun oni:after-save-func ()
|
|
|
|
"Function for `after-save-hook'."
|
|
|
|
(oni:compile-el)
|
2012-08-31 09:52:16 +02:00
|
|
|
(executable-make-buffer-file-executable-if-script-p)
|
|
|
|
(let ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")))
|
|
|
|
(when dom-dir
|
2012-09-07 15:21:59 +02:00
|
|
|
(shell-command (concat "make -C " dom-dir " TAGS >/dev/null 2>&1")))))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(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-common-func ()
|
|
|
|
"Function for `c-mode-common-hook'."
|
|
|
|
(setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning)
|
2012-08-31 09:52:16 +02:00
|
|
|
(when (buffer-file-name)
|
|
|
|
(hs-minor-mode)))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(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:close-client-window ()
|
|
|
|
"Close a client's frames."
|
|
|
|
(interactive)
|
|
|
|
(server-save-buffers-kill-terminal nil))
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defun oni:compile-el ()
|
|
|
|
"Compile the current buffer file if it is an .el file."
|
|
|
|
(let* ((full-file-name (buffer-file-name))
|
|
|
|
(file-name (file-name-nondirectory full-file-name))
|
|
|
|
(suffix (file-name-extension file-name)))
|
|
|
|
(if (and (not (string-equal file-name ".dir-locals.el"))
|
|
|
|
(string-equal suffix "el"))
|
|
|
|
(byte-compile-file full-file-name))))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:css-mode-func ()
|
|
|
|
"Function for `css-mode-hook'."
|
|
|
|
(setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning)
|
2012-08-31 09:52:16 +02:00
|
|
|
(when (buffer-file-name)
|
|
|
|
(hs-minor-mode))
|
2012-08-26 21:50:26 +02:00
|
|
|
(local-set-key "\C-j" 'oni:newline-and-indent)
|
|
|
|
(rainbow-mode))
|
|
|
|
|
|
|
|
(defun oni:diary-display-func ()
|
|
|
|
"Function for `diary-display-hook'."
|
|
|
|
(diary-fancy-display))
|
|
|
|
|
|
|
|
(defun oni:emacs-lisp-mode-func ()
|
|
|
|
"Function for `emacs-lisp-mode-hook'."
|
|
|
|
(eldoc-mode)
|
|
|
|
(when (buffer-file-name)
|
|
|
|
(hs-minor-mode)))
|
|
|
|
|
|
|
|
(defun oni:emms-toggle-playing ()
|
|
|
|
"Toggle between playing/paused states."
|
|
|
|
(interactive)
|
|
|
|
(if (eq emms-player-playing-p nil)
|
|
|
|
(emms-start)
|
|
|
|
(emms-pause)))
|
|
|
|
|
|
|
|
(defun oni:erc-mode-func ()
|
|
|
|
"Function for `erc-mode-hook'."
|
|
|
|
(erc-fill-mode -1)
|
|
|
|
(visual-line-mode)
|
|
|
|
(setq truncate-lines nil))
|
|
|
|
|
|
|
|
(defun oni:eshell-mode-func ()
|
|
|
|
"Function for `eshell-mode-hook'."
|
|
|
|
(setq truncate-lines nil))
|
|
|
|
|
|
|
|
(defun oni:eshell-prompt-function ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Show a pretty shell prompt."
|
2012-08-26 21:50:26 +02:00
|
|
|
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
|
|
|
|
(hostname (shell-command-to-string "hostname"))
|
|
|
|
(dir (abbreviate-file-name (eshell/pwd)))
|
|
|
|
(branch
|
|
|
|
(shell-command-to-string
|
|
|
|
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
|
|
|
|
(userstatus (if (zerop (user-uid)) ?# ?$)))
|
|
|
|
(concat
|
|
|
|
(propertize (char-to-string status)
|
|
|
|
'face `(:foreground ,(if (= status ?+)
|
|
|
|
(oni:color chameleon-1)
|
|
|
|
(oni:color scarlet-red-2))))
|
|
|
|
" "
|
|
|
|
(propertize (substring hostname 0 -1) '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"
|
|
|
|
(propertize (char-to-string userstatus)
|
|
|
|
'face `(:foreground ,(oni:color sky-blue-1)))
|
|
|
|
"> ")))
|
|
|
|
|
|
|
|
(defun oni:flymake-mode-func ()
|
|
|
|
"Function for `flymake-mode-hook'."
|
|
|
|
(local-set-key [M-P] 'flymake-goto-prev-error)
|
|
|
|
(local-set-key [M-N] 'flymake-goto-next-error))
|
|
|
|
|
|
|
|
(defun oni:flymake-pyflakes-init ()
|
|
|
|
"Initialize function for flymake with pyflakes."
|
|
|
|
(let* ((temp-file (flymake-init-create-temp-buffer-copy
|
|
|
|
'flymake-create-temp-inplace))
|
|
|
|
(local-file (file-relative-name temp-file (file-name-directory
|
|
|
|
buffer-file-name))))
|
|
|
|
(list "pyflakes" (list local-file))))
|
|
|
|
|
|
|
|
(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))
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defun oni:hs-minor-mode-func ()
|
|
|
|
"Function for `hs-minor-mode-hook'."
|
|
|
|
(local-set-key [C-tab] 'hs-toggle-hiding)
|
|
|
|
(hs-hide-all))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:html-mode-func ()
|
|
|
|
"Function for `html-mode-hook'."
|
|
|
|
(fci-mode))
|
|
|
|
|
|
|
|
(defun oni:indent-shift-left (start end &optional count)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Rigidly indent region.
|
|
|
|
Region is from START to END. Move
|
|
|
|
COUNT number of spaces if it is non-nil otherwise use
|
|
|
|
`tab-width'."
|
2012-08-26 21:50:26 +02:00
|
|
|
(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)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Indent region between START and END rigidly to the right.
|
|
|
|
If COUNT has been specified indent by that much, otherwise look at
|
|
|
|
`tab-width'."
|
2012-08-26 21:50:26 +02:00
|
|
|
(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)))
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defun oni:jabber-chat-mode-func ()
|
|
|
|
"Function for `jabber-chat-mode-hook'."
|
|
|
|
(visual-line-mode))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(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'."
|
|
|
|
(oni:generic-outline oni:javascript-outline-regex)
|
|
|
|
(rainbow-delimiters-mode)
|
2012-09-07 15:21:59 +02:00
|
|
|
(local-set-key "\C-j" 'oni:newline-and-indent)
|
|
|
|
(pretty-symbols-mode -1))
|
2012-08-26 21:50:26 +02:00
|
|
|
|
2012-09-11 21:03:50 +02:00
|
|
|
(defun oni:js2-mode-func ()
|
|
|
|
"Function for `js2-mode-hook'."
|
|
|
|
(oni:prog-mode-func)
|
|
|
|
(oni:js-mode-func)
|
|
|
|
(local-set-key (kbd "<f5>") #'slime-js-reload)
|
|
|
|
(slime-js-minor-mode))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:kill-region-or-backward-char ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Either `kill-region' or `backward-delete-char-untabify'."
|
2012-08-26 21:50:26 +02:00
|
|
|
(interactive)
|
|
|
|
(if (region-active-p)
|
|
|
|
(kill-region (region-beginning) (region-end))
|
|
|
|
(backward-delete-char-untabify 1)))
|
|
|
|
|
|
|
|
(defun oni:kill-region-or-forward-char ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Either `kill-region' or `delete-forward-char'."
|
2012-08-26 21:50:26 +02:00
|
|
|
(interactive)
|
|
|
|
(if (region-active-p)
|
|
|
|
(kill-region (region-beginning) (region-end))
|
|
|
|
(delete-forward-char 1)))
|
|
|
|
|
|
|
|
(defun oni:kill-region-or-line ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Either `kill-region' or `kill-line'."
|
2012-08-26 21:50:26 +02:00
|
|
|
(interactive)
|
|
|
|
(if (region-active-p)
|
|
|
|
(kill-region (region-beginning) (region-end))
|
|
|
|
(kill-line)))
|
|
|
|
|
|
|
|
(defun oni:lisp-mode-func ()
|
|
|
|
"Function for `lisp-mode-hook'."
|
2012-08-31 09:52:16 +02:00
|
|
|
(when (buffer-file-name)
|
|
|
|
(hs-minor-mode)))
|
2012-08-26 21:50:26 +02:00
|
|
|
|
2012-09-13 10:38:37 +02:00
|
|
|
(defun oni:lua-mode-func()
|
|
|
|
"Function for `lisp-mode-hook'."
|
|
|
|
(local-unset-key (kbd ")"))
|
|
|
|
(local-unset-key (kbd "]"))
|
|
|
|
(local-unset-key (kbd "}")))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:magit-log-edit-mode-func ()
|
|
|
|
"Function for `magit-log-edit-mode-hook'."
|
|
|
|
(auto-fill-mode)
|
|
|
|
(font-lock-add-keywords
|
|
|
|
nil
|
|
|
|
'(("\\`\\(.\\{,50\\}\\)\\(.*\\)\n?\\(.*\\)$"
|
|
|
|
(1 'git-commit-summary-face)
|
|
|
|
(2 'git-commit-overlong-summary-face)
|
|
|
|
(3 'git-commit-nonempty-second-line-face))
|
|
|
|
("`\\([^']+\\)'" 1 font-lock-constant-face))
|
|
|
|
t))
|
|
|
|
|
|
|
|
(defun oni:markdown-mode-func ()
|
|
|
|
"Function for `markdown-mode-hook'."
|
|
|
|
(auto-fill-mode)
|
|
|
|
(whitespace-mode))
|
|
|
|
|
|
|
|
(defun oni:message-mode-func ()
|
|
|
|
"Function for `message-mode-hook'."
|
|
|
|
(auto-fill-mode)
|
|
|
|
(flyspell-mode)
|
|
|
|
(ispell-change-dictionary (read-string "New dictionary: ")))
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defun oni:mini-fix-timestamp-string (date-string)
|
2012-09-07 15:21:59 +02:00
|
|
|
"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"
|
2012-08-18 13:57:56 +02:00
|
|
|
(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)))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:move-beginning-of-dwim ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Move to beginning of line either after indentation or before."
|
2012-08-26 21:50:26 +02:00
|
|
|
(interactive)
|
|
|
|
(let ((start (point)))
|
|
|
|
(back-to-indentation)
|
|
|
|
(if (= start (point))
|
|
|
|
(beginning-of-line))))
|
|
|
|
|
|
|
|
(defun oni:move-end-of-dwim ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Move to end of line, either before any comments or after."
|
2012-08-26 21:50:26 +02:00
|
|
|
(interactive)
|
|
|
|
(let ((start (point))
|
|
|
|
(eolpos (line-end-position)))
|
|
|
|
(beginning-of-line)
|
|
|
|
(if (and 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)
|
2012-09-07 15:21:59 +02:00
|
|
|
"Format RSS items from MyEpisodes as org tasks.
|
|
|
|
PLIST contains all the pertinent information."
|
2012-08-26 21:50:26 +02:00
|
|
|
(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 <%s>" title episode name date))))
|
|
|
|
|
|
|
|
(defun oni:newline-and-indent ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"`newline-and-indent', but with a twist.
|
|
|
|
When dealing with braces, add another line and indent that too."
|
2012-08-26 21:50:26 +02:00
|
|
|
(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:org-mode-func ()
|
|
|
|
"Function for `org-mode-hook'."
|
|
|
|
(flyspell-mode)
|
|
|
|
(auto-fill-mode))
|
|
|
|
|
|
|
|
(defun oni:php-mode-func ()
|
|
|
|
"Function for `php-mode-hook'."
|
|
|
|
(flymake-mode)
|
|
|
|
(local-set-key "\C-j" 'oni:newline-and-indent)
|
|
|
|
(c-set-offset 'arglist-intro '+)
|
|
|
|
(c-set-offset 'arglist-close '0)
|
|
|
|
(rainbow-delimiters-mode)
|
|
|
|
(setq fci-rule-column 81))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(defun oni:prog-mode-func ()
|
|
|
|
"Function for `prog-mode-hook'."
|
|
|
|
(rainbow-delimiters-mode)
|
|
|
|
(fci-mode)
|
2012-08-31 09:52:16 +02:00
|
|
|
(pretty-symbols-mode)
|
|
|
|
(yas-minor-mode))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:python-mode-func ()
|
|
|
|
"Function for `python-mode-hook'."
|
|
|
|
(flymake-mode)
|
|
|
|
(local-set-key (kbd "C->") 'python-indent-shift-right)
|
|
|
|
(local-set-key (kbd "C-<") 'python-indent-shift-left)
|
|
|
|
(local-set-key [C-tab] 'outline-toggle-children)
|
|
|
|
(oni:generic-outline oni:python-outline-regex)
|
|
|
|
(set (make-local-variable 'electric-indent-chars) nil)
|
|
|
|
(rainbow-delimiters-mode)
|
2012-09-07 15:21:59 +02:00
|
|
|
(setq fci-rule-column 80
|
|
|
|
fill-column 72)
|
2012-08-26 21:50:26 +02:00
|
|
|
(fci-mode))
|
|
|
|
|
|
|
|
(defun oni:raise-eshell ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Start or switch back to `eshell'.
|
|
|
|
Also change directories to current working directory."
|
2012-08-26 21:50:26 +02:00
|
|
|
(interactive)
|
|
|
|
(let ((dir (file-name-directory
|
|
|
|
(or (buffer-file-name) "~/")))
|
|
|
|
(hasfile (not (eq (buffer-file-name) nil))))
|
|
|
|
(eshell)
|
|
|
|
(if (and hasfile (eq eshell-process-list nil))
|
|
|
|
(progn
|
|
|
|
(eshell/cd dir)
|
|
|
|
(eshell-reset)))))
|
|
|
|
|
|
|
|
(defun oni:raise-scratch (&optional mode)
|
2012-09-07 15:21:59 +02:00
|
|
|
"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."
|
2012-08-26 21:50:26 +02:00
|
|
|
(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))))
|
|
|
|
|
|
|
|
(switch-to-buffer buffer)))
|
|
|
|
|
|
|
|
(defun oni:reload-buffer ()
|
|
|
|
"Reload current buffer."
|
|
|
|
(interactive)
|
|
|
|
(revert-buffer nil t nil))
|
|
|
|
|
2012-08-18 13:57:56 +02:00
|
|
|
(defun oni:replace-html-special-chars ()
|
2012-09-07 15:21:59 +02:00
|
|
|
"Replace special characters with HTML escaped entities."
|
2012-08-18 13:57:56 +02:00
|
|
|
(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:required-packages-installed-p ()
|
|
|
|
"Check if all the packages I need are installed."
|
|
|
|
(let ((tmp-packages oni:required-packages)
|
|
|
|
(result t))
|
|
|
|
(while (and tmp-packages result)
|
|
|
|
(if (not (package-installed-p (car tmp-packages)))
|
|
|
|
(setq result nil))
|
|
|
|
(setq tmp-packages (cdr tmp-packages)))
|
|
|
|
result))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:scheme-mode-func ()
|
|
|
|
"Function for `scheme-mode-hook'."
|
2012-08-31 09:52:16 +02:00
|
|
|
(when (buffer-file-name)
|
|
|
|
(hs-minor-mode)))
|
2012-08-26 21:50:26 +02:00
|
|
|
|
|
|
|
(defun oni:self-insert-dwim ()
|
|
|
|
"Execute self insert, but when the region is active call self
|
2012-09-07 15:21:59 +02:00
|
|
|
insert at the end of the region and at the beginning."
|
2012-08-26 21:50:26 +02:00
|
|
|
(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)
|
|
|
|
|
2012-09-14 01:55:41 +02:00
|
|
|
(defun oni:start-emms ()
|
|
|
|
"Check to see if the function `emms' exists, if not call
|
|
|
|
`emms-player-mpd-connect' and assume that will have loaded it."
|
|
|
|
(interactive)
|
|
|
|
(unless (fboundp 'emms)
|
|
|
|
(emms-player-mpd-connect))
|
|
|
|
(emms))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:term-mode-func ()
|
|
|
|
"Function for `term-mode-hook'."
|
|
|
|
(setq truncate-lines nil))
|
|
|
|
|
|
|
|
(defun oni:texinfo-mode-func ()
|
|
|
|
"Function for `texinfo-mode-hook'."
|
|
|
|
(auto-fill-mode))
|
|
|
|
|
2012-09-14 01:55:41 +02:00
|
|
|
(defun oni:view-mail (inbox)
|
2012-08-18 13:57:56 +02:00
|
|
|
"Show a menu with all mailbox options from `oni:mailbox-map'
|
|
|
|
for easy selection."
|
2012-09-14 01:55:41 +02:00
|
|
|
(interactive
|
|
|
|
(list (progn
|
|
|
|
(require 'tmm)
|
|
|
|
(let ((tmm-completion-prompt "Choose a mailbox\n"))
|
|
|
|
(tmm-prompt oni:mailbox-map)))))
|
|
|
|
(if inbox
|
|
|
|
(progn
|
|
|
|
(require 'mu4e)
|
|
|
|
(funcall (intern (concat "oni:" inbox "-mailbox")))
|
|
|
|
(mu4e))))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(defun oni:write-file-func ()
|
|
|
|
"Function for `write-file-hooks'."
|
|
|
|
(time-stamp))
|
|
|
|
|
2012-08-31 09:52:16 +02:00
|
|
|
(defun oni:yas-minor-mode-func ()
|
|
|
|
"Function for `yas-minor-mode-hook'."
|
|
|
|
(yas-load-directory (car yas-snippet-dirs)))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(eval-after-load "ebuff-menu"
|
|
|
|
'(define-key electric-buffer-menu-mode-map
|
|
|
|
(kbd "C-s") 'isearch-forward))
|
|
|
|
|
|
|
|
(eval-after-load "em-term"
|
|
|
|
'(add-to-list 'eshell-visual-commands
|
|
|
|
"unison"))
|
|
|
|
|
|
|
|
(eval-after-load "emms-source-file"
|
|
|
|
'(progn
|
|
|
|
(require 'emms-setup)
|
|
|
|
|
|
|
|
(emms-standard)
|
|
|
|
(require 'emms-player-mpd)
|
|
|
|
|
|
|
|
(setq emms-player-mpd-server-name "localhost")
|
|
|
|
(setq emms-player-mpd-server-port "6600")
|
|
|
|
|
|
|
|
(add-to-list 'emms-info-functions 'emms-info-mpd)
|
|
|
|
(add-to-list 'emms-player-list 'emms-player-mpd)
|
|
|
|
(setq emms-player-mpd-music-directory "/mnt/music/mp3")))
|
|
|
|
|
|
|
|
(eval-after-load "flymake"
|
|
|
|
'(progn
|
|
|
|
(require 'flymake-cursor)
|
|
|
|
|
|
|
|
(add-to-list ; Make sure pyflakes is loaded
|
|
|
|
'flymake-allowed-file-name-masks ; for python files.
|
|
|
|
'("\\.py\\'" oni:flymake-pyflakes-init))
|
|
|
|
|
|
|
|
(add-to-list ; Error line repexp for go
|
|
|
|
'flymake-err-line-patterns ; compilation.
|
|
|
|
'("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$"
|
|
|
|
1 2 nil 3))
|
|
|
|
|
|
|
|
(add-to-list ; Go uses makefiles, makes
|
|
|
|
'flymake-allowed-file-name-masks ; flymaking 'easy'.
|
|
|
|
'("\\.go$" flymake-simple-make-init))))
|
|
|
|
|
|
|
|
(eval-after-load "ido"
|
|
|
|
'(setq ido-ignore-buffers `(,@ido-ignore-buffers
|
|
|
|
"^\\*.*\\*$" "^irc\\." "^\\#")))
|
|
|
|
|
2012-08-19 00:26:15 +02:00
|
|
|
(eval-after-load "info"
|
|
|
|
'(require 'info+))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(eval-after-load "mu4e"
|
|
|
|
'(add-to-list
|
|
|
|
'org-capture-templates
|
|
|
|
'("c" "Contact" entry (file "~/documents/org/misc/contacts.org")
|
|
|
|
(concat "* %(mu4e-view-snarf-from 'name)\n"
|
|
|
|
" :PROPERTIES:\n"
|
|
|
|
" :EMAIL: %(mu4e-view-snarf-from 'email)\n"
|
|
|
|
" :END:"))))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(eval-after-load "org"
|
|
|
|
'(progn
|
|
|
|
(require 'appt)
|
|
|
|
(require 'org-protocol)
|
|
|
|
(require 'org-habit)
|
|
|
|
(require 'org-contacts)
|
|
|
|
|
|
|
|
(add-to-list 'org-modules 'habit)
|
|
|
|
|
|
|
|
(org-indent-mode t)
|
|
|
|
|
|
|
|
(org-agenda-to-appt)
|
|
|
|
(ad-activate 'org-agenda-redo)))
|
|
|
|
|
|
|
|
(eval-after-load "org-crypt"
|
|
|
|
'(org-crypt-use-before-save-magic))
|
|
|
|
|
|
|
|
(eval-after-load "sauron"
|
|
|
|
'(setq sauron-modules (append '(sauron-identica sauron-jabber)
|
|
|
|
sauron-modules)))
|
|
|
|
|
|
|
|
(eval-after-load "smex"
|
|
|
|
'(progn
|
|
|
|
(global-set-key (kbd "M-x") 'smex)
|
|
|
|
(global-set-key (kbd "C-M-x") 'smex-major-mode-commands)))
|
|
|
|
|
2012-08-24 10:51:47 +02:00
|
|
|
(oni:define-mailbox "aethon"
|
|
|
|
(oni:email thomas at aethon dot nl)
|
2012-08-18 13:57:56 +02:00
|
|
|
(expand-file-name "~/documents/work/aethon/signature.txt"))
|
2012-08-24 10:51:47 +02:00
|
|
|
(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")
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(put 'upcase-region 'disabled nil)
|
|
|
|
(put 'downcase-region 'disabled nil)
|
|
|
|
(put 'narrow-to-region 'disabled nil)
|
2012-09-02 11:34:56 +02:00
|
|
|
(put 'scroll-left 'disabled nil)
|
2012-08-26 21:50:26 +02:00
|
|
|
|
|
|
|
(setq-default bidi-paragraph-direction 'left-to-right)
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq-default c-basic-offset 4)
|
|
|
|
(setq-default fci-rule-column 73)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq-default gac-automatically-push-p t)
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
(setq-default mode-line-format
|
|
|
|
(list
|
|
|
|
'(:eval
|
|
|
|
(if (and (buffer-modified-p) (buffer-file-name))
|
|
|
|
(propertize "!"
|
|
|
|
'face 'oni:mode-line-modified
|
|
|
|
'help-echo "Buffer has been modified")
|
|
|
|
" "))
|
|
|
|
|
|
|
|
'(:eval (propertize "%m"
|
|
|
|
'face 'oni:mode-line-mode
|
|
|
|
'help-echo buffer-file-coding-system))
|
|
|
|
|
|
|
|
": "
|
|
|
|
|
|
|
|
'(:eval (propertize "%b "
|
|
|
|
'face 'mode-line-buffer-id
|
|
|
|
'help-echo (buffer-file-name)))
|
|
|
|
|
|
|
|
"("
|
|
|
|
(propertize "%p" 'face 'oni:mode-line-buffer-position) ":"
|
|
|
|
(propertize "%04l" 'face 'oni:mode-line-buffer-line) ","
|
|
|
|
(propertize "%02c" 'face 'oni:mode-line-buffer-column)
|
|
|
|
") "
|
|
|
|
|
|
|
|
"["
|
|
|
|
'(:eval (propertize
|
|
|
|
(if buffer-read-only
|
|
|
|
"R"
|
|
|
|
(if overwrite-mode "O" "I"))
|
|
|
|
'face 'oni:mode-line-buffer-state
|
|
|
|
'help-echo (concat "Buffer is "
|
|
|
|
(if buffer-read-only
|
|
|
|
"read-only"
|
|
|
|
(if overwrite-mode
|
|
|
|
"in overwrite mode"
|
|
|
|
"in insert mode")))))
|
|
|
|
|
|
|
|
"] "
|
|
|
|
|
|
|
|
'(:eval
|
|
|
|
(propertize (format-time-string "%H:%M")
|
|
|
|
'help-echo
|
|
|
|
(concat (format-time-string "%c; ")
|
|
|
|
(emacs-uptime "Uptime: %hh"))))
|
|
|
|
" --"
|
|
|
|
'(:eval global-mode-string)))
|
|
|
|
(setq-default php-mode-warn-if-mumamo-off nil)
|
|
|
|
(setq-default require-final-newline t)
|
|
|
|
(setq-default tab-width 4)
|
|
|
|
(setq-default truncate-lines t)
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq appt-display-diary nil)
|
|
|
|
(setq auto-mode-case-fold nil)
|
|
|
|
(setq auto-save-file-name-transforms
|
|
|
|
`((".*" ,temporary-file-directory t)))
|
2012-08-24 10:51:47 +02:00
|
|
|
(setq avandu-article-render-function #'avandu-view-w3m)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq backup-directory-alist
|
|
|
|
`((".*" . ,temporary-file-directory)))
|
|
|
|
(setq browse-url-browser-function 'browse-url-generic)
|
|
|
|
(setq browse-url-generic-program (getenv "BROWSER"))
|
|
|
|
(setq custom-file "~/.emacs.d/custom.el")
|
|
|
|
(setq custom-theme-directory "~/.emacs.d/themes")
|
|
|
|
(setq default-frame-alist
|
|
|
|
`((border-width . 0)
|
|
|
|
(internal-border-width . 0)
|
|
|
|
(vertical-scroll-bars . nil)
|
|
|
|
(menu-bar-lines . nil)
|
|
|
|
(tool-bar-lines . nil)
|
2012-09-14 01:55:41 +02:00
|
|
|
(font . "osaka_unicode:pixelsize=18")
|
2012-08-26 21:50:26 +02:00
|
|
|
(left-fringe . 0)))
|
|
|
|
(setq emms-source-file-default-directory "/mnt/music/")
|
|
|
|
(setq erc-autojoin-channels-alist
|
|
|
|
'(("freenode.net" "#herbstluftwm" "#ninthfloor" "#emacs"
|
|
|
|
"#dispass")))
|
|
|
|
(setq erc-hide-list '("JOIN" "PART" "QUIT"))
|
|
|
|
(setq erc-insert-timestamp-function 'erc-insert-timestamp-left)
|
|
|
|
(setq erc-nick "ryuslash")
|
|
|
|
(setq erc-timestamp-format "[%H:%M] ")
|
|
|
|
(setq erc-timestamp-only-if-changed-flag nil)
|
|
|
|
(setq eshell-highlight-prompt nil)
|
|
|
|
(setq eshell-prompt-function 'oni:eshell-prompt-function)
|
|
|
|
(setq eshell-prompt-regexp "^[#$]> ")
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq fci-rule-color "darkred")
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq flymake-gui-warnings-enabled nil)
|
|
|
|
(setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log"))
|
|
|
|
(setq flymake-log-level 0)
|
|
|
|
(setq frame-title-format '(:eval (concat "emacs: " (buffer-name))))
|
|
|
|
(setq geiser-repl-history-filename "~/.emacs.d/geiser-history")
|
|
|
|
(setq gtags-auto-update t)
|
|
|
|
(setq help-at-pt-display-when-idle t)
|
|
|
|
(setq ido-auto-merge-delay-time 1000000)
|
2012-09-11 10:32:30 +02:00
|
|
|
(setq ido-default-buffer-method 'selected-window)
|
2012-09-07 15:21:59 +02:00
|
|
|
(setq ido-max-window-height 1)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq ido-save-directory-list-file nil)
|
2012-09-11 21:03:50 +02:00
|
|
|
(setq ido-ubiquitous-command-exceptions '(oni:view-mail tmm-menubar))
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq inferior-lisp-program "sbcl")
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq inhibit-default-init t)
|
|
|
|
(setq inhibit-local-menu-bar-menus t)
|
|
|
|
(setq inhibit-startup-message t)
|
|
|
|
(setq initial-major-mode 'emacs-lisp-mode)
|
|
|
|
(setq initial-scratch-message nil)
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq jabber-account-list '(("ryuslash@jabber.org")))
|
|
|
|
(setq jabber-chat-buffer-format "*jabber:%n*")
|
|
|
|
(setq jabber-chat-buffer-show-avatar nil)
|
|
|
|
(setq jabber-chat-fill-long-lines nil)
|
|
|
|
(setq jabber-chat-foreign-prompt-format "[%t] < ")
|
|
|
|
(setq jabber-chat-local-prompt-format "[%t] > ")
|
|
|
|
(setq jabber-chatstates-confirm nil)
|
|
|
|
(setq jabber-history-dir "~/.emacs.d/jabber")
|
|
|
|
(setq jabber-roster-show-bindings nil)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq jit-lock-defer-time 0.2)
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq mail-header-separator "")
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq message-log-max 1000)
|
|
|
|
(setq message-send-mail-function 'message-send-mail-with-sendmail)
|
2012-08-18 13:57:56 +02:00
|
|
|
(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)
|
2012-08-31 09:52:16 +02:00
|
|
|
(setq mu4e-html2text-command "w3m -dump -T text/HTML -cols 72")
|
2012-08-24 10:51:47 +02:00
|
|
|
(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)))
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq org-agenda-custom-commands
|
|
|
|
'(("b" "Bookmarks to look at."
|
|
|
|
todo "LOOKAT")
|
|
|
|
("w" "Work todo."
|
|
|
|
tags-todo "CATEGORY=\"Work\"")))
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq org-agenda-sorting-strategy
|
2012-08-18 13:57:56 +02:00
|
|
|
'((agenda habit-down time-up priority-down category-keep)
|
|
|
|
(todo priority-down category-up)
|
|
|
|
(tags priority-down category-keep)
|
|
|
|
(search category-keep)))
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq org-capture-templates
|
2012-09-07 15:21:59 +02:00
|
|
|
'(("t" "Task" entry (file "~/documents/org/tasks")
|
|
|
|
"* TODO %?")
|
2012-08-26 21:50:26 +02:00
|
|
|
("h" "Habit" entry (file "")
|
2012-08-18 13:57:56 +02:00
|
|
|
(concat "* TODO %^{Description}\n"
|
|
|
|
" SCHEDULED: %^T\n"
|
|
|
|
" :PROPERTIES:\n"
|
|
|
|
" :STYLE: habit\n"
|
|
|
|
" :END:")
|
|
|
|
:immediate-finish t)
|
|
|
|
("l" "Log" entry (file+headline "" "notes")
|
|
|
|
(concat "* %n %<%d-%m-%Y %H:%M:%S>\n"
|
|
|
|
" %a\n\n"
|
|
|
|
" %?")
|
|
|
|
:prepend t :empty-lines 1)
|
|
|
|
("a" "Appointment" entry (file+headline "" "appointments")
|
|
|
|
"* %^{Description} %^T" :immediate-finish t)
|
|
|
|
("b" "Bookmark" entry (file "~/documents/org/misc/bookmarks.org")
|
|
|
|
"* %c\n\n %:initial")))
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq org-contacts-files '("~/documents/org/misc/contacts.org"))
|
|
|
|
(setq org-directory (expand-file-name "~/documents/org"))
|
|
|
|
(setq org-agenda-files
|
|
|
|
`(,(concat org-directory "/org")
|
|
|
|
,(concat org-directory "/misc/contacts.org")
|
|
|
|
,(concat org-directory "/misc/bookmarks.org")))
|
|
|
|
(setq org-default-notes-file (concat org-directory "/org"))
|
|
|
|
(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/org" "MyEpisodes"
|
|
|
|
:formatter oni:myepisodes-formatter)))
|
|
|
|
(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-targets '((nil . (:maxlevel . 6))))
|
|
|
|
(setq org-refile-use-outline-path 'file)
|
|
|
|
(setq org-return-follows-link t)
|
|
|
|
(setq org-src-fontify-natively t)
|
|
|
|
(setq org-tags-exclude-from-inheritance '("crypt"))
|
2012-08-18 13:57:56 +02:00
|
|
|
(setq org-todo-keyword-faces
|
|
|
|
'(("TODO" :foreground "red")
|
|
|
|
("IN PROGRESS" :foreground "yellow")
|
|
|
|
("DONE" :foreground "forest green")
|
|
|
|
("SUCCEEDED" :foreground "forest green")
|
|
|
|
("WAITING" :foreground "orange")
|
|
|
|
("CANCELLED" :foreground "orangered")
|
|
|
|
("FAILED" :foreground "orangered")))
|
|
|
|
(setq org-todo-keywords
|
|
|
|
'((sequence "TODO(t)" "IN PROGRESS" "WAITING(@/!)" "|"
|
|
|
|
"DONE(!/!)" "CANCELLED(@/!)")))
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq org-use-fast-todo-selection t)
|
|
|
|
(setq package-archives
|
|
|
|
'(("melpa" . "http://melpa.milkbox.net/packages/")
|
|
|
|
("ELPA" . "http://tromey.com/elpa/")
|
|
|
|
("gnu" . "http://elpa.gnu.org/packages/")
|
|
|
|
("marmalade" . "http://marmalade-repo.org/packages/")))
|
|
|
|
(setq package-load-list '((htmlize "1.39")
|
2012-09-14 01:55:41 +02:00
|
|
|
(lua-mode "20111107")
|
2012-08-26 21:50:26 +02:00
|
|
|
all))
|
|
|
|
(setq php-function-call-face 'font-lock-function-name-face)
|
|
|
|
(setq php-mode-force-pear t)
|
2012-09-11 23:27:45 +02:00
|
|
|
(setq pony-tpl-indent-moves t)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq rainbow-delimiters-max-face-count 12)
|
|
|
|
(setq redisplay-dont-pause t)
|
|
|
|
(setq sauron-column-alist '((timestamp . 6)
|
|
|
|
(message)))
|
|
|
|
(setq sauron-hide-mode-line t)
|
|
|
|
(setq sauron-max-line-length 189)
|
|
|
|
(setq sauron-timestamp-format "%H:%M")
|
|
|
|
(setq sauron-watch-nicks '("ryuslash"))
|
|
|
|
(setq sauron-watch-patterns '("ryuslash"))
|
|
|
|
(setq scroll-conservatively 101)
|
|
|
|
(setq send-mail-function 'smtpmail-send-it)
|
|
|
|
(setq sendmail-program "/usr/bin/msmtp")
|
2012-09-14 01:55:41 +02:00
|
|
|
(setq smex-key-advice-ignore-menu-bar t)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq smex-save-file "~/.emacs.d/smex-items")
|
|
|
|
(setq special-display-buffer-names '("*Sauron*"))
|
|
|
|
(setq special-display-frame-alist '((minibuffer . nil)
|
|
|
|
(right-fringe . 0)))
|
2012-09-07 15:21:59 +02:00
|
|
|
(setq split-height-threshold 40)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq time-stamp-active t)
|
|
|
|
(setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)")
|
|
|
|
(setq uniquify-buffer-name-style 'post-forward)
|
|
|
|
(setq use-dialog-box nil)
|
|
|
|
(setq user-full-name "Tom Willemsen")
|
|
|
|
(setq whitespace-style '(face trailing))
|
2012-09-07 15:21:59 +02:00
|
|
|
(setq window-combination-resize t)
|
2012-08-26 21:50:26 +02:00
|
|
|
(setq yas-prompt-functions '(yas-ido-prompt))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-09-02 11:29:02 +02:00
|
|
|
(add-hook 'after-save-hook 'oni:after-save-func t)
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-hook 'before-save-hook 'oni:before-save-func)
|
|
|
|
(add-hook 'c-mode-common-hook 'oni:c-mode-common-func)
|
|
|
|
(add-hook 'c-mode-hook 'oni:c-mode-func)
|
|
|
|
(add-hook 'css-mode-hook 'oni:css-mode-func)
|
2012-08-18 13:57:56 +02:00
|
|
|
(add-hook 'diary-display-hook 'oni:diary-display-func)
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func)
|
|
|
|
(add-hook 'erc-mode-hook 'oni:erc-mode-func)
|
|
|
|
(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
|
|
|
|
(add-hook 'flymake-mode-hook 'oni:flymake-mode-func)
|
|
|
|
(add-hook 'go-mode-hook 'oni:go-mode-func)
|
|
|
|
(add-hook 'gtags-mode-hook 'oni:gtags-mode-func)
|
|
|
|
(add-hook 'hs-minor-mode-hook 'oni:hs-minor-mode-func)
|
|
|
|
(add-hook 'html-mode-hook 'oni:html-mode-func)
|
|
|
|
(add-hook 'jabber-chat-mode-hook 'oni:jabber-chat-mode-func)
|
|
|
|
(add-hook 'java-mode-hook 'oni:java-mode-func)
|
|
|
|
(add-hook 'js-mode-hook 'oni:js-mode-func)
|
2012-09-11 21:03:50 +02:00
|
|
|
(add-hook 'js2-mode-hook 'oni:js2-mode-func)
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-hook 'lisp-mode-hook 'oni:lisp-mode-func)
|
2012-09-13 10:38:37 +02:00
|
|
|
(add-hook 'lua-mode-hook 'oni:lua-mode-func)
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func)
|
|
|
|
(add-hook 'markdown-mode-hook 'oni:markdown-mode-func)
|
|
|
|
(add-hook 'message-mode-hook 'oni:message-mode-func)
|
|
|
|
(add-hook 'org-mode-hook 'oni:org-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 'scheme-mode-hook 'oni:scheme-mode-func)
|
|
|
|
(add-hook 'term-mode-hook 'oni:term-mode-func)
|
|
|
|
(add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func)
|
|
|
|
(add-hook 'write-file-hooks 'oni:write-file-func)
|
2012-08-31 09:52:16 +02:00
|
|
|
(add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func)
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(global-set-key (kbd "'") 'oni:self-insert-dwim)
|
|
|
|
(global-set-key (kbd "<XF86AudioNext>") 'emms-next)
|
|
|
|
(global-set-key (kbd "<XF86AudioPlay>") 'oni:emms-toggle-playing)
|
|
|
|
(global-set-key (kbd "<XF86AudioPrev>") 'emms-previous)
|
|
|
|
(global-set-key (kbd "<XF86AudioStop>") 'emms-stop)
|
|
|
|
(global-set-key (kbd "<XF86HomePage>") 'oni:raise-scratch)
|
|
|
|
(global-set-key (kbd "<XF86Mail>") 'oni:view-mail)
|
2012-09-14 01:55:41 +02:00
|
|
|
(global-set-key (kbd "<XF86Tools>") 'oni:start-emms)
|
2012-08-26 21:50:26 +02:00
|
|
|
(global-set-key (kbd "<f5>") 'oni:reload-buffer)
|
|
|
|
(global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer)
|
|
|
|
(global-set-key (kbd "<f7>") 'magit-status)
|
|
|
|
(global-set-key (kbd "<f8>") 'oni:raise-eshell)
|
|
|
|
(global-set-key (kbd "C-<") 'indent-shift-left)
|
|
|
|
(global-set-key (kbd "C->") 'indent-shift-right)
|
|
|
|
(global-set-key (kbd "C-@") '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-S-k") 'kill-whole-line)
|
|
|
|
(global-set-key (kbd "C-a") 'oni:move-beginning-of-dwim)
|
|
|
|
(global-set-key (kbd "C-c a") 'org-agenda)
|
|
|
|
(global-set-key (kbd "C-c c") 'org-capture)
|
|
|
|
(global-set-key (kbd "C-c i p") 'identica-update-status-interactive)
|
|
|
|
(global-set-key (kbd "C-d") 'oni:kill-region-or-forward-char)
|
|
|
|
(global-set-key (kbd "C-e") 'oni:move-end-of-dwim)
|
|
|
|
(global-set-key (kbd "C-k") 'oni:kill-region-or-line)
|
|
|
|
(global-set-key (kbd "C-w") 'oni:kill-region-or-backward-char)
|
|
|
|
(global-set-key (kbd "C-x C-b") 'electric-buffer-list)
|
|
|
|
(global-set-key (kbd "M-n") 'idomenu)
|
|
|
|
(global-set-key (kbd "\"") 'oni:self-insert-dwim)
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(when (daemonp)
|
|
|
|
(global-set-key "\C-x\C-c" 'oni:close-client-window))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(when (or window-system (daemonp))
|
|
|
|
(global-unset-key "\C-z"))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.jl$" . sawfish-mode))
|
2012-09-11 21:03:50 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
|
2012-08-18 13:57:56 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?do?wn$" . markdown-mode))
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("^PKGBUILD$" . shell-script-mode))
|
2012-08-18 13:57:56 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("^\\.Xmodmap$" . xmodmap-mode))
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(add-to-list 'custom-theme-load-path
|
|
|
|
(concat custom-theme-directory "/naquadah-theme"))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(add-to-list 'debug-ignored-errors "^Can't shift all lines enough")
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(unless (oni:required-packages-installed-p)
|
|
|
|
(message "%s" "Refreshing package database...")
|
|
|
|
(package-refresh-contents)
|
|
|
|
(message "%s" " done.")
|
|
|
|
(mapc #'(lambda (package)
|
|
|
|
(when (not (package-installed-p package))
|
|
|
|
(package-install package)))
|
|
|
|
oni:required-packages))
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(blink-cursor-mode -1)
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
(tooltip-mode -1)
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(electric-indent-mode)
|
|
|
|
(electric-pair-mode)
|
2012-08-18 13:57:56 +02:00
|
|
|
(ido-mode)
|
2012-09-11 23:27:45 +02:00
|
|
|
(ido-ubiquitous-mode)
|
2012-08-26 21:50:26 +02:00
|
|
|
(savehist-mode)
|
|
|
|
(show-paren-mode)
|
2012-09-07 15:21:59 +02:00
|
|
|
(auto-insert-mode)
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(smex-initialize)
|
|
|
|
(help-at-pt-set-timer)
|
|
|
|
|
2012-08-26 21:50:26 +02:00
|
|
|
(load-theme 'naquadah t)
|
2012-08-18 13:57:56 +02:00
|
|
|
|
|
|
|
(load custom-file)
|
|
|
|
(load "rudel-loaddefs.el")
|
|
|
|
(load (expand-file-name "~/quicklisp/slime-helper.el"))
|
2012-09-07 15:21:59 +02:00
|
|
|
|
|
|
|
(provide 'init)
|
|
|
|
|
|
|
|
;;; init.el ends here
|