emacs/init.el

This commit is contained in:
Tom Willemsen 2012-08-31 09:52:16 +02:00
parent a81a4ec407
commit 74c49fab14

View file

@ -143,10 +143,11 @@
(defmacro oni:generic-outline (regex) (defmacro oni:generic-outline (regex)
"Prepare for enabling `outline-minor-mode'." "Prepare for enabling `outline-minor-mode'."
`(progn `(progn
(outline-minor-mode) (when (buffer-file-name)
(set (make-local-variable 'outline-regexp) ,regex) (outline-minor-mode)
(hide-body) (set (make-local-variable 'outline-regexp) ,regex)
(local-set-key [C-tab] 'outline-toggle-children))) (hide-body)
(local-set-key [C-tab] 'outline-toggle-children))))
(defmacro oni:color (name) (defmacro oni:color (name)
`(naquadah-get-colors (quote ,name))) `(naquadah-get-colors (quote ,name)))
@ -170,7 +171,10 @@
(defun oni:after-save-func () (defun oni:after-save-func ()
"Function for `after-save-hook'." "Function for `after-save-hook'."
(oni:compile-el) (oni:compile-el)
(executable-make-buffer-file-executable-if-script-p)) (executable-make-buffer-file-executable-if-script-p)
(let ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")))
(when dom-dir
(shell-command (concat "make -C " dom-dir " TAGS")))))
(defun oni:before-save-func () (defun oni:before-save-func ()
"Function for `before-save-hook'." "Function for `before-save-hook'."
@ -182,7 +186,8 @@
(defun oni:c-mode-common-func () (defun oni:c-mode-common-func ()
"Function for `c-mode-common-hook'." "Function for `c-mode-common-hook'."
(setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning) (setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning)
(hs-minor-mode)) (when (buffer-file-name)
(hs-minor-mode)))
(defun oni:c-mode-func () (defun oni:c-mode-func ()
"Function for `c-mode-hook'." "Function for `c-mode-hook'."
@ -206,7 +211,8 @@
(defun oni:css-mode-func () (defun oni:css-mode-func ()
"Function for `css-mode-hook'." "Function for `css-mode-hook'."
(setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning) (setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning)
(hs-minor-mode) (when (buffer-file-name)
(hs-minor-mode))
(local-set-key "\C-j" 'oni:newline-and-indent) (local-set-key "\C-j" 'oni:newline-and-indent)
(rainbow-mode)) (rainbow-mode))
@ -371,7 +377,8 @@
(defun oni:lisp-mode-func () (defun oni:lisp-mode-func ()
"Function for `lisp-mode-hook'." "Function for `lisp-mode-hook'."
(hs-minor-mode)) (when (buffer-file-name)
(hs-minor-mode)))
(defun oni:magit-log-edit-mode-func () (defun oni:magit-log-edit-mode-func ()
"Function for `magit-log-edit-mode-hook'." "Function for `magit-log-edit-mode-hook'."
@ -500,7 +507,8 @@
"Function for `prog-mode-hook'." "Function for `prog-mode-hook'."
(rainbow-delimiters-mode) (rainbow-delimiters-mode)
(fci-mode) (fci-mode)
(pretty-symbols-mode)) (pretty-symbols-mode)
(yas-minor-mode))
(defun oni:python-mode-func () (defun oni:python-mode-func ()
"Function for `python-mode-hook'." "Function for `python-mode-hook'."
@ -575,7 +583,8 @@ its major mode."
(defun oni:scheme-mode-func () (defun oni:scheme-mode-func ()
"Function for `scheme-mode-hook'." "Function for `scheme-mode-hook'."
(hs-minor-mode)) (when (buffer-file-name)
(hs-minor-mode)))
(defun oni:self-insert-dwim () (defun oni:self-insert-dwim ()
"Execute self insert, but when the region is active call self "Execute self insert, but when the region is active call self
@ -623,6 +632,10 @@ for easy selection."
"Function for `write-file-hooks'." "Function for `write-file-hooks'."
(time-stamp)) (time-stamp))
(defun oni:yas-minor-mode-func ()
"Function for `yas-minor-mode-hook'."
(yas-load-directory (car yas-snippet-dirs)))
(eval-after-load "ebuff-menu" (eval-after-load "ebuff-menu"
'(define-key electric-buffer-menu-mode-map '(define-key electric-buffer-menu-mode-map
(kbd "C-s") 'isearch-forward)) (kbd "C-s") 'isearch-forward))
@ -843,6 +856,7 @@ for easy selection."
(:subject))) (:subject)))
(setq mu4e-headers-show-threads nil) (setq mu4e-headers-show-threads nil)
(setq mu4e-headers-sort-revert nil) (setq mu4e-headers-sort-revert nil)
(setq mu4e-html2text-command "w3m -dump -T text/HTML -cols 72")
(setq mu4e-my-email-addresses (list (setq mu4e-my-email-addresses (list
(oni:email tom at ryuslash dot org) (oni:email tom at ryuslash dot org)
(oni:email ryuslash at gmail dot com) (oni:email ryuslash at gmail dot com)
@ -981,6 +995,7 @@ for easy selection."
(add-hook 'term-mode-hook 'oni:term-mode-func) (add-hook 'term-mode-hook 'oni:term-mode-func)
(add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func) (add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func)
(add-hook 'write-file-hooks 'oni:write-file-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 "'") 'oni:self-insert-dwim)
(global-set-key (kbd "<XF86AudioNext>") 'emms-next) (global-set-key (kbd "<XF86AudioNext>") 'emms-next)