diff --git a/emacs/init.el b/emacs/init.el index fb33134..e915b4d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -143,10 +143,11 @@ (defmacro oni:generic-outline (regex) "Prepare for enabling `outline-minor-mode'." `(progn - (outline-minor-mode) - (set (make-local-variable 'outline-regexp) ,regex) - (hide-body) - (local-set-key [C-tab] 'outline-toggle-children))) + (when (buffer-file-name) + (outline-minor-mode) + (set (make-local-variable 'outline-regexp) ,regex) + (hide-body) + (local-set-key [C-tab] 'outline-toggle-children)))) (defmacro oni:color (name) `(naquadah-get-colors (quote ,name))) @@ -170,7 +171,10 @@ (defun oni:after-save-func () "Function for `after-save-hook'." (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 () "Function for `before-save-hook'." @@ -182,7 +186,8 @@ (defun oni:c-mode-common-func () "Function for `c-mode-common-hook'." (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 () "Function for `c-mode-hook'." @@ -206,7 +211,8 @@ (defun oni:css-mode-func () "Function for `css-mode-hook'." (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) (rainbow-mode)) @@ -371,7 +377,8 @@ (defun oni:lisp-mode-func () "Function for `lisp-mode-hook'." - (hs-minor-mode)) + (when (buffer-file-name) + (hs-minor-mode))) (defun oni:magit-log-edit-mode-func () "Function for `magit-log-edit-mode-hook'." @@ -500,7 +507,8 @@ "Function for `prog-mode-hook'." (rainbow-delimiters-mode) (fci-mode) - (pretty-symbols-mode)) + (pretty-symbols-mode) + (yas-minor-mode)) (defun oni:python-mode-func () "Function for `python-mode-hook'." @@ -575,7 +583,8 @@ its major mode." (defun oni:scheme-mode-func () "Function for `scheme-mode-hook'." - (hs-minor-mode)) + (when (buffer-file-name) + (hs-minor-mode))) (defun oni:self-insert-dwim () "Execute self insert, but when the region is active call self @@ -623,6 +632,10 @@ for easy selection." "Function for `write-file-hooks'." (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" '(define-key electric-buffer-menu-mode-map (kbd "C-s") 'isearch-forward)) @@ -843,6 +856,7 @@ for easy selection." (: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) @@ -981,6 +995,7 @@ for easy selection." (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) +(add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func) (global-set-key (kbd "'") 'oni:self-insert-dwim) (global-set-key (kbd "") 'emms-next)