Mercurial > dotfiles
annotate .emacs @ 13:c22ca1514f3b
Add an alias to ease working with mq repos.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 03 Dec 2008 22:55:45 -0600 |
parents | d4d720c4c416 |
children | 34fd1e79495b |
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 | |
13 (require 'show-wspace) | |
14 (require 'doctest-mode) | |
15 | |
12
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
16 (require 'mercurial) |
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
17 |
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
|
18 ; 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
|
19 (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
|
20 (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
|
21 |
0 | 22 ; Start the server so that emacsclient will work |
23 ; TODO: is there a way to *not* start a server if one was already running? | |
24 (server-start) | |
25 | |
26 ; All lines should end in a newline | |
27 (setq require-final-newline t) | |
28 | |
29 ; disable tabs | |
30 (setq tab-width 4) | |
31 (setq-default indent-tabs-mode nil) | |
32 | |
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
|
33 ; 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
|
34 (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
|
35 "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
|
36 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
|
37 (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
|
38 (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
|
39 (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
|
40 (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
|
41 (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
|
42 (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
|
43 |
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 (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
|
45 (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
|
46 |
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 ;; 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
|
48 (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
|
49 (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
|
50 (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
|
51 (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
|
52 |
0 | 53 (defun af-python-mode-hook () |
54 ; highlight tabs in Python | |
55 (make-variable-buffer-local 'font-lock-mode-hook) | |
56 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) | |
57 (make-variable-buffer-local 'python-indent) | |
58 (if (string-match "melange" buffer-file-name) | |
59 (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
|
60 (af-tab-fix) |
0 | 61 ) |
62 (add-hook 'python-mode-hook 'af-python-mode-hook) | |
63 | |
64 ;;pymacs | |
12
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
65 (if (string-match "unixSoft/lib/python" (getenv "PATH")) |
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
66 (setenv "PYTHONPATH" (concat (getenv "HOME") "/unixSoft/lib/python")) |
d4d720c4c416
Add mercurial support to emacs. Improve setting of PYTHONPATH in there.
Augie Fackler <durin42@gmail.com>
parents:
8
diff
changeset
|
67 ) |
0 | 68 (autoload 'pymacs-apply "pymacs") |
69 (autoload 'pymacs-call "pymacs") | |
70 (autoload 'pymacs-eval "pymacs" nil t) | |
71 (autoload 'pymacs-exec "pymacs" nil t) | |
72 (autoload 'pymacs-load "pymacs" nil t) | |
73 (eval-after-load "pymacs" | |
74 '(add-to-list 'pymacs-load-path "~/unixSoft/lib/python")) | |
75 ;(pymacs-load "ropemacs" "rope-") | |
76 ;(setq ropemacs-enable-autoimport t) | |
77 | |
78 ; text-mode tries to use M-s for something other than my save shortcut. | |
79 ; That's evil. Stop it from doing that. | |
80 (add-hook 'text-mode-hook '(lambda () | |
81 (define-key text-mode-map "\M-s" | |
82 'save-buffer))) | |
83 | |
84 ; Cleanup whitespace before saves. | |
85 (add-hook 'before-save-hook '(lambda () | |
86 (whitespace-cleanup))) | |
87 | |
88 ; Disable that startup screen | |
89 (setq inhibit-startup-message t) | |
90 | |
91 ; Basically everything I do is in version control, stop saving backup files | |
92 (setq make-backup-files nil) | |
93 | |
94 ; Set some pretty colors that are gentler on my eyes | |
95 (setq default-frame-alist | |
96 '((width . 80) | |
97 (cursor-color . "white") | |
98 (cursor-type . box) | |
99 (foreground-color . "white") | |
100 (background-color . "black") | |
101 ) | |
102 ) | |
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
|
103 ; 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
|
104 (show-paren-mode 1) |
0 | 105 |
106 ;; Desktop mode to remember buffers | |
107 (load "desktop") | |
108 (setq desktop-enable t) | |
109 | |
110 ;; Automatically revert unedited files that change on the underlying | |
111 ;; system. | |
112 (global-auto-revert-mode) | |
113 | |
114 ;; Key Bindings | |
115 ; M-backspace kills the current buffer | |
116 (global-set-key [(meta backspace)] 'kill-this-buffer) | |
117 ; Save early and often, with only one keystroke | |
118 (global-set-key [(meta s)] 'save-buffer) | |
119 ; Typing tab is for lesser editors, make hitting return do that | |
120 (global-set-key "\C-m" 'newline-and-indent) |