Mercurial > dotfiles
annotate .emacs @ 7:9541f7e47514
Some edits to .emacs after my playing with Clojure, also added Clojure support files.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Sun, 30 Nov 2008 20:50:18 -0600 |
| parents | c30d68fbd368 |
| children | 6b651c7265f2 |
| 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) | |
| 10 (ido-mode t) | |
| 11 | |
| 12 (require 'show-wspace) | |
| 13 (require 'doctest-mode) | |
| 14 | |
|
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
|
15 ; 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
|
16 (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
|
17 (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
|
18 |
| 0 | 19 ; Start the server so that emacsclient will work |
| 20 ; TODO: is there a way to *not* start a server if one was already running? | |
| 21 (server-start) | |
| 22 | |
| 23 ; All lines should end in a newline | |
| 24 (setq require-final-newline t) | |
| 25 | |
| 26 ; disable tabs | |
| 27 (setq tab-width 4) | |
| 28 (setq-default indent-tabs-mode nil) | |
| 29 | |
|
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
|
30 ; 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
|
31 (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
|
32 "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
|
33 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
|
34 (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
|
35 (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
|
36 (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
|
37 (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
|
38 (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
|
39 (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
|
40 |
|
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 (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
|
42 (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
|
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 ;; 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
|
45 (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
|
46 (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
|
47 (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
|
48 (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
|
49 |
| 0 | 50 (defun af-python-mode-hook () |
| 51 ; highlight tabs in Python | |
| 52 (make-variable-buffer-local 'font-lock-mode-hook) | |
| 53 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs) | |
| 54 (make-variable-buffer-local 'python-indent) | |
| 55 (if (string-match "melange" buffer-file-name) | |
| 56 (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
|
57 (af-tab-fix) |
| 0 | 58 ) |
| 59 (add-hook 'python-mode-hook 'af-python-mode-hook) | |
| 60 | |
| 61 ;;pymacs | |
| 62 (setenv "PYTHONPATH" (concat (getenv "HOME") "/unixSoft/lib/python")) | |
| 63 (autoload 'pymacs-apply "pymacs") | |
| 64 (autoload 'pymacs-call "pymacs") | |
| 65 (autoload 'pymacs-eval "pymacs" nil t) | |
| 66 (autoload 'pymacs-exec "pymacs" nil t) | |
| 67 (autoload 'pymacs-load "pymacs" nil t) | |
| 68 (eval-after-load "pymacs" | |
| 69 '(add-to-list 'pymacs-load-path "~/unixSoft/lib/python")) | |
| 70 ;(pymacs-load "ropemacs" "rope-") | |
| 71 ;(setq ropemacs-enable-autoimport t) | |
| 72 | |
| 73 ; text-mode tries to use M-s for something other than my save shortcut. | |
| 74 ; That's evil. Stop it from doing that. | |
| 75 (add-hook 'text-mode-hook '(lambda () | |
| 76 (define-key text-mode-map "\M-s" | |
| 77 'save-buffer))) | |
| 78 | |
| 79 ; Cleanup whitespace before saves. | |
| 80 (add-hook 'before-save-hook '(lambda () | |
| 81 (whitespace-cleanup))) | |
| 82 | |
| 83 ; Disable that startup screen | |
| 84 (setq inhibit-startup-message t) | |
| 85 | |
| 86 ; Basically everything I do is in version control, stop saving backup files | |
| 87 (setq make-backup-files nil) | |
| 88 | |
| 89 ; Set some pretty colors that are gentler on my eyes | |
| 90 (setq default-frame-alist | |
| 91 '((width . 80) | |
| 92 (cursor-color . "white") | |
| 93 (cursor-type . box) | |
| 94 (foreground-color . "white") | |
| 95 (background-color . "black") | |
| 96 ) | |
| 97 ) | |
|
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
|
98 ; 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
|
99 (show-paren-mode 1) |
| 0 | 100 |
| 101 ;; Desktop mode to remember buffers | |
| 102 (load "desktop") | |
| 103 (setq desktop-enable t) | |
| 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) |
