Mercurial > dotfiles
annotate .emacs @ 73:b84c4cac3148
Add custom _subversion that works with svn 1.5 and later.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 09 Apr 2009 13:24:38 -0500 |
parents | 5c25d3dc29ab |
children | fd369b708cbe |
rev | line source |
---|---|
0 | 1 ;; Augie Fackler's .emacs file |
2 ; Places I've stolen from: | |
3 ; Karl Fogel: http://svn.red-bean.com/repos/kfogel/trunk | |
4 ; Dave Anderson: | |
5 | |
6 (setq load-path (cons (expand-file-name "~/.elisp") load-path)) | |
7 ; Better buffer switching and file loading (load first in case we need the | |
8 ; * Messages * buffer) | |
9 (require 'ido) | |
8
6b651c7265f2
Flex matching for ido-mode.
Augie Fackler <durin42@gmail.com>
parents:
7
diff
changeset
|
10 (setq ido-enable-flex-matching t) |
0 | 11 (ido-mode t) |
12 | |
19
b5d75594b356
Add support for the ipython-mode stuff and remove vestigial pymacs code.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
13 (require 'python-mode) |
b5d75594b356
Add support for the ipython-mode stuff and remove vestigial pymacs code.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
14 (require 'ipython) |
b5d75594b356
Add support for the ipython-mode stuff and remove vestigial pymacs code.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
15 |
0 | 16 (require 'show-wspace) |
17 | |
12
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
18 (require 'mercurial) |
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
19 |
32
dc1c584707e6
Add some colorized diff stuff to emacs.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
20 ; improved diff mode |
dc1c584707e6
Add some colorized diff stuff to emacs.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
21 (require 'diff-mode-) |
dc1c584707e6
Add some colorized diff stuff to emacs.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
22 |
34 | 23 (require 'midnight) |
24 | |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
25 ; Clojure |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
26 (require 'clojure-auto) |
51
ac7a8f9a0924
Better way to handle auto-mode stuff for clojure.
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
27 (add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode)) |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
28 |
22 | 29 (require 'textmate) |
30 (textmate-mode) | |
31 (textmate-also-ignore "eggs|cover|daisy|.*.pyc") | |
32 | |
52 | 33 ; yaml |
34 (require 'yaml-mode) | |
35 (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) | |
36 | |
37 | |
0 | 38 ; Start the server so that emacsclient will work |
39 ; TODO: is there a way to *not* start a server if one was already running? | |
40 (server-start) | |
41 | |
42 ; All lines should end in a newline | |
43 (setq require-final-newline t) | |
44 | |
45 ; disable tabs | |
46 (setq tab-width 4) | |
47 (setq-default indent-tabs-mode nil) | |
48 | |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
49 ; use tab for indent or complete |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
50 (defun indent-or-expand (arg) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
51 "Either indent according to mode, or expand the word preceding |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
52 point." |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
53 (interactive "*P") |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
54 (if (and |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
55 (or (bobp) (= ?w (char-syntax (char-before)))) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
56 (or (eobp) (not (= ?w (char-syntax (char-after)))))) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
57 (dabbrev-expand arg) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
58 (indent-according-to-mode))) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
59 |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
60 (defun af-tab-fix () |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
61 (local-set-key [tab] 'indent-or-expand)) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
62 |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
63 ;; add hooks for modes you want to use the tab completion for: |
43
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
64 (set-variable 'af-cleanup-whitespace t) |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
65 (add-hook 'c-mode-hook 'af-tab-fix) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
66 (add-hook 'sh-mode-hook 'af-tab-fix) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
67 (add-hook 'emacs-lisp-mode-hook 'af-tab-fix) |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
68 (add-hook 'clojure-mode-hook 'af-tab-fix) |
43
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
69 (add-hook 'rst-mode-hook '(lambda () |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
70 (make-variable-buffer-local 'af-cleanup-whitespace) |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
71 (set-variable 'af-cleanup-whitespace nil))) |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
72 |
27 | 73 (autoload 'js2-mode "js2" nil t) |
74 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) | |
37 | 75 (add-hook 'js2-mode-hook 'af-tab-fix) |
27 | 76 |
0 | 77 (defun af-python-mode-hook () |
78 ; highlight tabs in Python | |
79 (make-variable-buffer-local 'font-lock-mode-hook) | |
80 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) | |
81 (make-variable-buffer-local 'python-indent) | |
19
b5d75594b356
Add support for the ipython-mode stuff and remove vestigial pymacs code.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
82 (if (and buffer-file-name (string-match "melange" buffer-file-name)) |
b5d75594b356
Add support for the ipython-mode stuff and remove vestigial pymacs code.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
83 (set-variable 'python-indent 2)) |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
84 (af-tab-fix) |
0 | 85 ) |
86 (add-hook 'python-mode-hook 'af-python-mode-hook) | |
87 | |
88 | |
89 ; text-mode tries to use M-s for something other than my save shortcut. | |
90 ; That's evil. Stop it from doing that. | |
91 (add-hook 'text-mode-hook '(lambda () | |
43
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
92 (define-key text-mode-map "\M-s" |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
93 'save-buffer))) |
0 | 94 |
95 ; Cleanup whitespace before saves. | |
96 (add-hook 'before-save-hook '(lambda () | |
43
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
97 (if af-cleanup-whitespace (whitespace-cleanup)))) |
0 | 98 |
99 ; Disable that startup screen | |
100 (setq inhibit-startup-message t) | |
101 | |
102 ; Basically everything I do is in version control, stop saving backup files | |
103 (setq make-backup-files nil) | |
104 | |
105 ; Set some pretty colors that are gentler on my eyes | |
106 (setq default-frame-alist | |
107 '((width . 80) | |
43
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
108 (cursor-color . "white") |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
109 (cursor-type . box) |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
110 (foreground-color . "white") |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
111 (background-color . "black") |
f34194cad324
Fix to not strip whitespace in rst, since that format is broken to depend on trailing whitespace in some cases.
Augie Fackler <durin42@gmail.com>
parents:
37
diff
changeset
|
112 ) |
0 | 113 ) |
7
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
114 ; always highlight matching paren |
9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
115 (show-paren-mode 1) |
0 | 116 |
117 ;; Automatically revert unedited files that change on the underlying | |
118 ;; system. | |
119 (global-auto-revert-mode) | |
120 | |
121 ;; Key Bindings | |
122 ; M-backspace kills the current buffer | |
123 (global-set-key [(meta backspace)] 'kill-this-buffer) | |
124 ; Save early and often, with only one keystroke | |
125 (global-set-key [(meta s)] 'save-buffer) | |
126 ; Typing tab is for lesser editors, make hitting return do that | |
127 (global-set-key "\C-m" 'newline-and-indent) | |
22 | 128 ; M-l makes more sense to me for jumping to a line |
129 (global-set-key "\M-l" 'goto-line) | |
14
34fd1e79495b
Fix for backspace being broken in some terminal emulators.
Augie Fackler <durin42@gmail.com>
parents:
12
diff
changeset
|
130 ; Sometimes C-h is what Backspace sends in a terminal, and I never use C-h |
34fd1e79495b
Fix for backspace being broken in some terminal emulators.
Augie Fackler <durin42@gmail.com>
parents:
12
diff
changeset
|
131 (global-set-key "\C-h" 'backward-delete-char-untabify) |
22 | 132 ; M-t is what I want for the textmate file finding |
133 (global-set-key [(meta t)] 'textmate-goto-file) | |
32
dc1c584707e6
Add some colorized diff stuff to emacs.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
134 (global-set-key [(meta z)] 'textmate-find-in-project-type) |
65
5c25d3dc29ab
A couple more keybindings for emacs.
Augie Fackler <durin42@gmail.com>
parents:
52
diff
changeset
|
135 (global-set-key [(meta m)] 'iconify-or-deiconify-frame) |
5c25d3dc29ab
A couple more keybindings for emacs.
Augie Fackler <durin42@gmail.com>
parents:
52
diff
changeset
|
136 (global-set-key [(control backspace)] 'kill-word) |