Mercurial > dotfiles
annotate .elisp/settings/40.modes.el @ 116:85d912e123af
More ruby fixes, set html.erb to be some non-useless mode.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 26 Jun 2009 11:39:39 -0500 |
parents | 6a64e61359b7 |
children | e83373ab1581 |
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 | |
111
6a64e61359b7
Unbreaks this file, but I am not sure if the django stuff is working properly.
Augie Fackler <durin42@gmail.com>
parents:
109
diff
changeset
|
28 (add-hook 'ruby-mode-hook '(lambda () |
6a64e61359b7
Unbreaks this file, but I am not sure if the django stuff is working properly.
Augie Fackler <durin42@gmail.com>
parents:
109
diff
changeset
|
29 (af-tab-fix) |
6a64e61359b7
Unbreaks this file, but I am not sure if the django stuff is working properly.
Augie Fackler <durin42@gmail.com>
parents:
109
diff
changeset
|
30 (local-set-key (kbd "RET") |
116
85d912e123af
More ruby fixes, set html.erb to be some non-useless mode.
Augie Fackler <durin42@gmail.com>
parents:
111
diff
changeset
|
31 'reindent-then-newline-and-indent) |
85d912e123af
More ruby fixes, set html.erb to be some non-useless mode.
Augie Fackler <durin42@gmail.com>
parents:
111
diff
changeset
|
32 (local-set-key (kbd "C-M-f") |
85d912e123af
More ruby fixes, set html.erb to be some non-useless mode.
Augie Fackler <durin42@gmail.com>
parents:
111
diff
changeset
|
33 'textmate-find-in-project-type))) |
82
89f6d05cd7d5
Fix some ruby mode keybindings.
Augie Fackler <durin42@gmail.com>
parents:
79
diff
changeset
|
34 |
107 | 35 (require 'django-html-mode) |
36 ;; I think I probably just always want it in django mode for now | |
37 (add-to-list 'auto-mode-alist '("\\.html$'" . django-html-mode)) | |
116
85d912e123af
More ruby fixes, set html.erb to be some non-useless mode.
Augie Fackler <durin42@gmail.com>
parents:
111
diff
changeset
|
38 (add-to-list 'auto-mode-alist '("\\.html.erb$'" . django-html-mode)) |
85d912e123af
More ruby fixes, set html.erb to be some non-useless mode.
Augie Fackler <durin42@gmail.com>
parents:
111
diff
changeset
|
39 (add-to-list 'auto-mode-alist '("\\.rhtml$'" . django-html-mode)) |
111
6a64e61359b7
Unbreaks this file, but I am not sure if the django stuff is working properly.
Augie Fackler <durin42@gmail.com>
parents:
109
diff
changeset
|
40 (add-hook 'django-html-mode-hook '(lambda () |
6a64e61359b7
Unbreaks this file, but I am not sure if the django stuff is working properly.
Augie Fackler <durin42@gmail.com>
parents:
109
diff
changeset
|
41 (local-set-key (kbd "RET") |
6a64e61359b7
Unbreaks this file, but I am not sure if the django stuff is working properly.
Augie Fackler <durin42@gmail.com>
parents:
109
diff
changeset
|
42 'reindent-then-newline-and-indent))) |
107 | 43 |
77 | 44 (defun af-python-mode-hook () |
45 ; highlight tabs in Python | |
46 (make-variable-buffer-local 'font-lock-mode-hook) | |
47 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) | |
48 (make-variable-buffer-local 'python-indent) | |
49 (if (and buffer-file-name (string-match "melange" buffer-file-name)) | |
50 (set-variable 'python-indent 2)) | |
51 (af-tab-fix) | |
94
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
52 (easy-menu-add-item nil '("Python") ["Run All Tests" nosetests-all t] |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
53 "Comment Out Region") |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
54 (easy-menu-add-item nil '("Python") ["Run Module Tests" nosetests-module t] |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
55 "Comment Out Region") |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
56 (easy-menu-add-item nil '("Python") ["Run One Test" nosetests-one t] |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
57 "Comment Out Region") |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
58 (easy-menu-add-item nil '("Python") ["Debug One Test" nosetests-pdb-one t] |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
59 "Comment Out Region") |
9052c3801744
First stab at some menu items for the nose stuff.
Augie Fackler <durin42@gmail.com>
parents:
86
diff
changeset
|
60 (easy-menu-add-item nil '("Python") ["-" nil t] "Comment Out Region") |
102
16472f9a3543
Add some nosetests keybindings.
Augie Fackler <durin42@gmail.com>
parents:
101
diff
changeset
|
61 (local-set-key "\M-n" 'nosetests-module) |
16472f9a3543
Add some nosetests keybindings.
Augie Fackler <durin42@gmail.com>
parents:
101
diff
changeset
|
62 (local-set-key "\M-\C-n" 'nosetests-one) |
77 | 63 ) |
64 (add-hook 'python-mode-hook 'af-python-mode-hook) | |
65 | |
79
26f1ccac509c
Bind g to recompile in compilation-mode buffers.
Augie Fackler <durin42@gmail.com>
parents:
77
diff
changeset
|
66 (add-hook 'compilation-mode-hook '(lambda () (local-set-key "g" 'recompile))) |