diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/init.el | 89 | ||||
-rw-r--r-- | emacs/site-lisp/oni.el | 59 |
2 files changed, 75 insertions, 73 deletions
diff --git a/emacs/init.el b/emacs/init.el index a39751d..89c4792 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1,3 +1,4 @@ +;;;; Turn off useless visual components ;;; Turn the menu, scroll-bar and tool-bar off quickly, emacs startup ;;; isn't as jittery. (menu-bar-mode -1) @@ -52,14 +53,22 @@ package.el is loaded anyway." ;;; look at. (setq compilation-scroll-output t) -;;; Enable the excellent `paredit-mode' for any lisp-like languages. -(add-hook 'clojure-mode-hook 'paredit-mode) -(add-hook 'emacs-lisp-mode-hook 'paredit-mode) -(add-hook 'lisp-mode-hook 'paredit-mode) -(add-hook 'sawfish-mode-hook 'paredit-mode) -(add-hook 'scheme-mode-hook 'paredit-mode) - -;;; Enable Flycheck for some modes. +;;;; Hooks +;;;;; Enable `auto-fill-mode' for some text-heavy modes. + +(add-hook 'prog-mode-hook 'auto-fill-mode) +(add-hook 'text-mode-hook 'auto-fill-mode) + +;;;;; Enable `eldoc-mode' for some nice programming modes. + +(add-hook 'emacs-lisp-mode-hook 'eldoc-mode) + +;;;;; Enable `fill-column-indicator' for most programming modes. + +(add-hook 'html-mode-hook 'fci-mode) +(add-hook 'prog-mode-hook 'fci-mode) + +;;;;; Enable `flycheck-mode' for supported modes. (add-hook 'css-mode-hook 'flycheck-mode) (add-hook 'emacs-lisp-mode-hook 'flycheck-mode) @@ -73,7 +82,56 @@ package.el is loaded anyway." (add-hook 'ruby-mode-hook 'flycheck-mode) (add-hook 'rust-mode-hook 'flycheck-mode) (add-hook 'sh-mode-hook 'flycheck-mode) + +;;;;; Enable `flyspell-mode' for some text modes. + +(add-hook 'text-mode-hook 'flyspell-mode) + +;;;;; Enable `paredit-mode' for any lisp-like languages. +;;; Since all of these modes care heavily about their parentheses it +;;; is very easy to edit them as syntax trees, rather than unrelated +;;; bits of text. I also helps keep parens balanced. + +(add-hook 'clojure-mode-hook 'paredit-mode) +(add-hook 'emacs-lisp-mode-hook 'paredit-mode) +(add-hook 'lisp-mode-hook 'paredit-mode) +(add-hook 'sawfish-mode-hook 'paredit-mode) +(add-hook 'scheme-mode-hook 'paredit-mode) + +;;;;; Enable `rainbow-delimiters-mode' for programming modes. + +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + +;;;;; Enable `rainbow-mode' for some colorful modes. + +(add-hook 'css-mode-hook 'rainbow-mode) + +;;;;; Enable `slime-js-minor-mode' for `js2-mode'. + +(add-hook 'js2-mode-hook 'slime-js-minor-mode) + +;;;;; Enable `smartparens-mode' for some non-lisp modes. + +(add-hook 'html-mode-hook 'smartparens-mode) +(add-hook 'python-mode-hook 'smartparens-mode) + +;;;;; Enable `visual-line-mode' for some text modes. + +(add-hook 'jabber-chat-mode-hook 'visual-line-mode) + +;;;;; Enable `whitespace-mode' for some whitespace-caring modes. + +(add-hook 'markdown-mode-hook 'whitespace-mode) +(add-hook 'python-mode-hook 'whitespace-mode) + +;;;;; Enable `yas-minor-mode' for some heavy-duty modes. + +(add-hook 'html-mode-hook 'yas-minor-mode) +(add-hook 'org-mode-hook 'yas-minor-mode) +(add-hook 'prog-mode-hook 'yas-minor-mode) + +;;;; Rest ;;; Remove the pylint and pyflakes checkers from the flycheck ;;; configuration so the flake8 checker remains. (eval-after-load "flycheck" @@ -368,7 +426,6 @@ Also change directories to current working directory." (brace-list-open . +) (topmost-intro-cont first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont))) -(setq comment-auto-fill-only-comments t) (setq custom-file "~/.emacs.d/custom.el") (setq custom-theme-directory "~/.emacs.d/themes") (setq default-frame-alist @@ -448,12 +505,9 @@ Also change directories to current working directory." (add-hook 'css-mode-hook 'oni:css-mode-func) (add-hook 'diary-display-hook 'oni:diary-display-func) (add-hook 'emacs-startup-hook 'oni:emacs-startup-func) -(add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-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 'html-mode-hook 'oni:html-mode-func) -(add-hook 'jabber-chat-mode-hook 'oni:jabber-chat-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) @@ -461,14 +515,10 @@ Also change directories to current working directory." (add-hook 'lua-mode-hook 'oni:lua-mode-func) (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 'rst-mode-hook 'oni:rst-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) (add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func) @@ -585,9 +635,6 @@ Also change directories to current working directory." (setq eltuki-blog-dir "~/documents/blog") (setq sp-cancel-autoskip-on-backward-movement nil) - -(add-hook 'python-mode-hook 'smartparens-mode) -(add-hook 'html-mode-hook 'smartparens-mode) (defun oni:scroll-down-or-prev-page (arg) "Either scroll down or go to the previous page. @@ -640,3 +687,7 @@ Depending on the value of `buffer-narrowed-p'." ;;; Finally, load any `customize' settings and slime. (load custom-file) (load (expand-file-name "~/quicklisp/slime-helper.el")) + +;; Local Variables: +;; outline-regexp: ";;;;+" +;; End: diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index a962741..749ca37 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -86,8 +86,7 @@ DOT are intentionally being skipped." (defun oni:css-mode-func () "Function for `css-mode-hook'." - (local-set-key "\C-j" 'oni:newline-and-indent) - (rainbow-mode)) + (local-set-key "\C-j" 'oni:newline-and-indent)) (defun oni:current-jabber-status () "Return a string representing the current jabber status." @@ -100,10 +99,6 @@ DOT are intentionally being skipped." "Function for `diary-display-hook'." (diary-fancy-display)) -(defun oni:emacs-lisp-mode-func () - "Function for `emacs-lisp-mode-hook'." - (eldoc-mode)) - (defun oni:emacs-startup-func () "Function for `emacs-init-hook'." (require 'auto-complete-config) @@ -123,11 +118,6 @@ DOT are intentionally being skipped." "Function for `haskell-mode-hook'." (turn-on-haskell-indentation)) -(defun oni:html-mode-func () - "Function for `html-mode-hook'." - (yas-minor-mode) - (fci-mode)) - (defun oni:indent-shift-left (start end &optional count) "Rigidly indent region. Region is from START to END. Move @@ -173,10 +163,6 @@ If COUNT has been specified indent by that much, otherwise look at (notifications-notify :title title :body text)) -(defun oni:jabber-chat-mode-func () - "Function for `jabber-chat-mode-hook'." - (visual-line-mode)) - (defun oni:jabber-roster-mode-func () "Function for `jabber-roster-mode-hook'." (setq mode-line-format @@ -188,15 +174,12 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:js-mode-func () "Function for `js-mode-hook'." - (rainbow-delimiters-mode) (local-set-key "\C-j" 'oni:newline-and-indent)) (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)) + (local-set-key (kbd "<f5>") #'slime-js-reload)) (defun oni:kill-region-or-backward-char () "Either `kill-region' or `backward-delete-char-untabify'." @@ -227,7 +210,6 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:magit-log-edit-mode-func () "Function for `magit-log-edit-mode-hook'." - (auto-fill-mode) (font-lock-add-keywords nil '(("\\`\\(.\\{,50\\}\\)\\(.*\\)\n?\\(.*\\)$" @@ -239,16 +221,7 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:markdown-mode-func () "Function for `markdown-mode-hook'." - (setq-local comment-auto-fill-only-comments nil) - (setq-local whitespace-style '(face trailing)) - (auto-fill-mode) - (whitespace-mode)) - -(defun oni:message-mode-func () - "Function for `message-mode-hook'." - (setq-local comment-auto-fill-only-comments nil) - (auto-fill-mode) - (flyspell-mode)) + (setq-local whitespace-style '(face trailing))) (defun oni:mini-fix-timestamp-string (date-string) "A minimal version of Xah Lee's `fix-timestamp-string'. @@ -326,38 +299,25 @@ When dealing with braces, add another line and indent that too." (save-excursion (newline-and-indent))) (newline-and-indent)) -(defun oni:org-mode-func () - "Function for `org-mode-hook'." - (auto-fill-mode) - (yas-minor-mode) - (setq-local comment-auto-fill-only-comments nil)) - (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) - (rainbow-delimiters-mode) (setq-local fci-rule-column 80)) (defun oni:prog-mode-func () "Function for `prog-mode-hook'." - (rainbow-delimiters-mode) - (fci-mode) - (yas-minor-mode) - (auto-fill-mode)) + (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) - (rainbow-delimiters-mode) (setq fci-rule-column 79 fill-column 72) - (setq-local whitespace-style '(tab-mark)) - (fci-mode) - (whitespace-mode)) + (setq-local whitespace-style '(tab-mark))) (defun oni:rainbow-mode-init () "Initialization function for rainbow-mode." @@ -433,10 +393,6 @@ use. If MODE is not nil, open a new buffer with the name default-directory "' request-pull " (when patchp "-p ") from " " url " " to)))))) -(defun oni:rst-mode-func () - "Function for `rst-mode-hook'." - (auto-fill-mode)) - (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." @@ -511,11 +467,6 @@ If no direction is given, don't split." "Function for `term-mode-hook'." (setq truncate-lines nil)) -(defun oni:texinfo-mode-func () - "Function for `texinfo-mode-hook'." - (setq-local comment-auto-fill-only-comments nil) - (auto-fill-mode)) - (defun oni:write-file-func () "Function for `write-file-hooks'." (time-stamp)) |