Mercurial > dotfiles
annotate .emacs @ 33:b403402153b5
Add some setup to make emacs easier to use on OS X.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 09 Jan 2009 11:28:50 -0600 |
parents | dc1c584707e6 |
children | 1c70c9393f45 |
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 |
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
|
23 ; 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
|
24 (require 'clojure-auto) |
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 (setq auto-mode-alist (cons '("\\.clj$" . clojure-mode) auto-mode-alist)) |
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 |
22 | 27 (require 'textmate) |
28 (textmate-mode) | |
29 (textmate-also-ignore "eggs|cover|daisy|.*.pyc") | |
30 | |
0 | 31 ; Start the server so that emacsclient will work |
32 ; TODO: is there a way to *not* start a server if one was already running? | |
33 (server-start) | |
34 | |
35 ; All lines should end in a newline | |
36 (setq require-final-newline t) | |
37 | |
38 ; disable tabs | |
39 (setq tab-width 4) | |
40 (setq-default indent-tabs-mode nil) | |
41 | |
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
|
42 ; 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
|
43 (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
|
44 "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
|
45 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
|
46 (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
|
47 (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
|
48 (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
|
49 (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
|
50 (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
|
51 (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
|
52 |
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 (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
|
54 (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
|
55 |
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 ;; add hooks for modes you want to use the tab completion for: |
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 (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
|
58 (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
|
59 (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
|
60 (add-hook 'clojure-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
|
61 |
27 | 62 (autoload 'js2-mode "js2" nil t) |
63 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) | |
64 | |
0 | 65 (defun af-python-mode-hook () |
66 ; highlight tabs in Python | |
67 (make-variable-buffer-local 'font-lock-mode-hook) | |
68 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) | |
69 (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
|
70 (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
|
71 (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
|
72 (af-tab-fix) |
0 | 73 ) |
74 (add-hook 'python-mode-hook 'af-python-mode-hook) | |
75 | |
76 | |
77 ; text-mode tries to use M-s for something other than my save shortcut. | |
78 ; That's evil. Stop it from doing that. | |
79 (add-hook 'text-mode-hook '(lambda () | |
80 (define-key text-mode-map "\M-s" | |
81 'save-buffer))) | |
82 | |
83 ; Cleanup whitespace before saves. | |
84 (add-hook 'before-save-hook '(lambda () | |
85 (whitespace-cleanup))) | |
86 | |
87 ; Disable that startup screen | |
88 (setq inhibit-startup-message t) | |
89 | |
90 ; Basically everything I do is in version control, stop saving backup files | |
91 (setq make-backup-files nil) | |
92 | |
93 ; Set some pretty colors that are gentler on my eyes | |
94 (setq default-frame-alist | |
95 '((width . 80) | |
96 (cursor-color . "white") | |
97 (cursor-type . box) | |
98 (foreground-color . "white") | |
99 (background-color . "black") | |
100 ) | |
101 ) | |
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
|
102 ; 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
|
103 (show-paren-mode 1) |
0 | 104 |
105 ;; Automatically revert unedited files that change on the underlying | |
106 ;; system. | |
107 (global-auto-revert-mode) | |
108 | |
109 ;; Key Bindings | |
110 ; M-backspace kills the current buffer | |
111 (global-set-key [(meta backspace)] 'kill-this-buffer) | |
112 ; Save early and often, with only one keystroke | |
113 (global-set-key [(meta s)] 'save-buffer) | |
114 ; Typing tab is for lesser editors, make hitting return do that | |
115 (global-set-key "\C-m" 'newline-and-indent) | |
22 | 116 ; M-l makes more sense to me for jumping to a line |
117 (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
|
118 ; 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
|
119 (global-set-key "\C-h" 'backward-delete-char-untabify) |
22 | 120 ; M-t is what I want for the textmate file finding |
121 (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
|
122 (global-set-key [(meta z)] 'textmate-find-in-project-type) |