Mercurial > dotfiles
annotate .elisp/settings/40.modes.el @ 87:b958738c16f3
Fix an oops in the .hgrc.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 16 Apr 2009 14:56:15 -0500 |
parents | 68f53fa09e99 |
children | 9052c3801744 |
rev | line source |
---|---|
77 | 1 ; use tab for indent or complete |
2 (defun indent-or-expand (arg) | |
3 "Either indent according to mode, or expand the word preceding | |
4 point." | |
5 (interactive "*P") | |
6 (if (and | |
7 (or (bobp) (= ?w (char-syntax (char-before)))) | |
8 (or (eobp) (not (= ?w (char-syntax (char-after)))))) | |
9 (dabbrev-expand arg) | |
10 (indent-according-to-mode))) | |
11 | |
12 (defun af-tab-fix () | |
13 (local-set-key [tab] 'indent-or-expand)) | |
14 | |
15 ;; add hooks for modes you want to use the tab completion for: | |
16 (set-variable 'af-cleanup-whitespace t) | |
17 (add-hook 'c-mode-hook 'af-tab-fix) | |
18 (add-hook 'sh-mode-hook 'af-tab-fix) | |
19 (add-hook 'emacs-lisp-mode-hook 'af-tab-fix) | |
20 (add-hook 'rst-mode-hook '(lambda () | |
21 (make-variable-buffer-local 'af-cleanup-whitespace) | |
22 (set-variable 'af-cleanup-whitespace nil))) | |
23 | |
24 (autoload 'js2-mode "js2" nil t) | |
25 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) | |
26 (add-hook 'js2-mode-hook 'af-tab-fix) | |
27 | |
82
89f6d05cd7d5
Fix some ruby mode keybindings.
Augie Fackler <durin42@gmail.com>
parents:
79
diff
changeset
|
28 (add-hook 'ruby-mode-hook (lambda () |
89f6d05cd7d5
Fix some ruby mode keybindings.
Augie Fackler <durin42@gmail.com>
parents:
79
diff
changeset
|
29 (af-tab-fix) |
89f6d05cd7d5
Fix some ruby mode keybindings.
Augie Fackler <durin42@gmail.com>
parents:
79
diff
changeset
|
30 (local-set-key "\C-m" 'newline-and-indent))) |
89f6d05cd7d5
Fix some ruby mode keybindings.
Augie Fackler <durin42@gmail.com>
parents:
79
diff
changeset
|
31 |
89f6d05cd7d5
Fix some ruby mode keybindings.
Augie Fackler <durin42@gmail.com>
parents:
79
diff
changeset
|
32 |
77 | 33 (defun af-python-mode-hook () |
34 ; highlight tabs in Python | |
35 (make-variable-buffer-local 'font-lock-mode-hook) | |
36 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) | |
37 (make-variable-buffer-local 'python-indent) | |
38 (if (and buffer-file-name (string-match "melange" buffer-file-name)) | |
39 (set-variable 'python-indent 2)) | |
40 (af-tab-fix) | |
41 ) | |
42 (add-hook 'python-mode-hook 'af-python-mode-hook) | |
43 | |
79
26f1ccac509c
Bind g to recompile in compilation-mode buffers.
Augie Fackler <durin42@gmail.com>
parents:
77
diff
changeset
|
44 (add-hook 'compilation-mode-hook '(lambda () (local-set-key "g" 'recompile))) |
26f1ccac509c
Bind g to recompile in compilation-mode buffers.
Augie Fackler <durin42@gmail.com>
parents:
77
diff
changeset
|
45 |
77 | 46 |
47 ; text-mode tries to use M-s for something other than my save shortcut. | |
48 ; That's evil. Stop it from doing that. | |
49 (add-hook 'text-mode-hook '(lambda () | |
50 (define-key text-mode-map "\M-s" | |
51 'save-buffer))) |