Mercurial > dotfiles
view .elisp/settings/40.modes.el @ 77:45d7441d0cf2
Modularize .emacs
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 09 Apr 2009 13:39:20 -0500 |
parents | |
children | 26f1ccac509c |
line wrap: on
line source
; use tab for indent or complete (defun indent-or-expand (arg) "Either indent according to mode, or expand the word preceding point." (interactive "*P") (if (and (or (bobp) (= ?w (char-syntax (char-before)))) (or (eobp) (not (= ?w (char-syntax (char-after)))))) (dabbrev-expand arg) (indent-according-to-mode))) (defun af-tab-fix () (local-set-key [tab] 'indent-or-expand)) ;; add hooks for modes you want to use the tab completion for: (set-variable 'af-cleanup-whitespace t) (add-hook 'c-mode-hook 'af-tab-fix) (add-hook 'sh-mode-hook 'af-tab-fix) (add-hook 'emacs-lisp-mode-hook 'af-tab-fix) (add-hook 'clojure-mode-hook 'af-tab-fix) (add-hook 'rst-mode-hook '(lambda () (make-variable-buffer-local 'af-cleanup-whitespace) (set-variable 'af-cleanup-whitespace nil))) (autoload 'js2-mode "js2" nil t) (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) (add-hook 'js2-mode-hook 'af-tab-fix) (defun af-python-mode-hook () ; highlight tabs in Python (make-variable-buffer-local 'font-lock-mode-hook) (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) (make-variable-buffer-local 'python-indent) (if (and buffer-file-name (string-match "melange" buffer-file-name)) (set-variable 'python-indent 2)) (af-tab-fix) ) (add-hook 'python-mode-hook 'af-python-mode-hook) ; text-mode tries to use M-s for something other than my save shortcut. ; That's evil. Stop it from doing that. (add-hook 'text-mode-hook '(lambda () (define-key text-mode-map "\M-s" 'save-buffer)))