annotate .emacs @ 16:0de17fe9c428

gentags no longer needed.
author Augie Fackler <durin42@gmail.com>
date Thu, 04 Dec 2008 13:45:29 -0600
parents 34fd1e79495b
children b5d75594b356
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 ;; Augie Fackler's .emacs file
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 ; Places I've stolen from:
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 ; Karl Fogel: http://svn.red-bean.com/repos/kfogel/trunk
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 ; Dave Anderson:
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 (setq load-path (cons (expand-file-name "~/.elisp") load-path))
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 ; Better buffer switching and file loading (load first in case we need the
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 ; * Messages * buffer)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 (ido-mode t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 (require 'show-wspace)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 (require 'doctest-mode)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 ; Start the server so that emacsclient will work
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 ; TODO: is there a way to *not* start a server if one was already running?
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 (server-start)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 ; All lines should end in a newline
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 (setq require-final-newline t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 ; disable tabs
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 (setq tab-width 4)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 (setq-default indent-tabs-mode nil)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 (defun af-python-mode-hook ()
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 ; highlight tabs in Python
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 (make-variable-buffer-local 'font-lock-mode-hook)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 (make-variable-buffer-local 'python-indent)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 (if (string-match "melange" buffer-file-name)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 )
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 (add-hook 'python-mode-hook 'af-python-mode-hook)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 (autoload 'pymacs-apply "pymacs")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 (autoload 'pymacs-call "pymacs")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 (autoload 'pymacs-eval "pymacs" nil t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71 (autoload 'pymacs-exec "pymacs" nil t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 (autoload 'pymacs-load "pymacs" nil t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 (eval-after-load "pymacs"
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74 '(add-to-list 'pymacs-load-path "~/unixSoft/lib/python"))
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 ;(pymacs-load "ropemacs" "rope-")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 ;(setq ropemacs-enable-autoimport t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 ; text-mode tries to use M-s for something other than my save shortcut.
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
79 ; That's evil. Stop it from doing that.
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
80 (add-hook 'text-mode-hook '(lambda ()
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 (define-key text-mode-map "\M-s"
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 'save-buffer)))
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
83
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
84 ; Cleanup whitespace before saves.
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
85 (add-hook 'before-save-hook '(lambda ()
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86 (whitespace-cleanup)))
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
87
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 ; Disable that startup screen
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89 (setq inhibit-startup-message t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
91 ; Basically everything I do is in version control, stop saving backup files
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
92 (setq make-backup-files nil)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
93
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
94 ; Set some pretty colors that are gentler on my eyes
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
95 (setq default-frame-alist
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
96 '((width . 80)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
97 (cursor-color . "white")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
98 (cursor-type . box)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
99 (foreground-color . "white")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
100 (background-color . "black")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
101 )
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
106 ;; Desktop mode to remember buffers
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
107 (load "desktop")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
108 (setq desktop-enable t)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
109
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 ;; Automatically revert unedited files that change on the underlying
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
111 ;; system.
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
112 (global-auto-revert-mode)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
113
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
114 ;; Key Bindings
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
115 ; M-backspace kills the current buffer
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
116 (global-set-key [(meta backspace)] 'kill-this-buffer)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
117 ; Save early and often, with only one keystroke
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
118 (global-set-key [(meta s)] 'save-buffer)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
119 ; Typing tab is for lesser editors, make hitting return do that
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
120 (global-set-key "\C-m" 'newline-and-indent)
14
34fd1e79495b Fix for backspace being broken in some terminal emulators.
Augie Fackler <durin42@gmail.com>
parents: 12
diff changeset
121 ; 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
122 (global-set-key "\C-h" 'backward-delete-char-untabify)