]> git.donarmstrong.com Git - emacs.git/blob - .emacs
load don-configuration
[emacs.git] / .emacs
1 (custom-set-variables
2  ;; custom-set-variables was added by Custom.
3  ;; If you edit it by hand, you could mess it up, so be careful.
4  ;; Your init file should contain only one such instance.
5  ;; If there is more than one, they won't work right.
6  '(bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
7  '(calendar-latitude [33 57 north])
8  '(calendar-longitude [117 24 west])
9  '(case-fold-search t)
10  '(confirm-kill-emacs (quote y-or-n-p))
11  '(cperl-lazy-help-time nil)
12  '(debian-changelog-mailing-address "don@debian.org" t)
13  '(display-time t)
14  '(display-time-24hr-format t)
15  '(display-time-day-and-date t)
16  '(display-time-mode t)
17  '(font-latex-fontify-script nil)
18  '(font-latex-fontify-sectioning (quote color))
19  '(font-latex-script-display (quote (nil)))
20  '(global-auto-revert-mode t)
21  '(global-font-lock-mode t nil (font-lock))
22  '(global-set-key "\347" t)
23  '(icomplete-mode t)
24  '(log-edit-keep-buffer t)
25  '(mail-user-agent (quote sendmail-user-agent))
26  '(markdown-enable-math t)
27  '(markdown-follow-wiki-link-on-enter nil)
28  '(mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
29  '(post-email-address "don@donarmstrong.com")
30  '(post-kill-quoted-sig nil)
31  '(post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
32  '(post-uses-fill-mode nil)
33  '(ps-footer-font-size (quote (8 . 10)))
34  '(ps-header-font-size (quote (8 . 10)))
35  '(ps-header-title-font-size (quote (10 . 10)))
36  '(ps-line-number-color "blue")
37  '(ps-print-footer t)
38  '(ps-print-footer-frame nil)
39  '(ps-print-only-one-header t)
40  '(safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
41  '(sentence-end "[.?!][]\"')]*\\($\\|   \\| \\)[        
42 ]*")
43  '(sentence-end-double-space nil)
44  '(show-paren-mode t)
45  '(tool-bar-mode nil nil (tool-bar))
46  '(user-mail-address "don@donarmstrong.com")
47  '(vc-delete-logbuf-window nil)
48  '(vc-follow-symlinks t))
49
50 ;; use git before SVN; use CVS earlier, because I have CVS
51 ;; repositories inside of git directories
52 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
53
54 ;; switch back to the old primary selection method
55 (setq x-select-enable-clipboard nil)
56 (setq x-select-enable-primary t)
57 ; (setq mouse-drag-copy-region t)
58
59 (fset 'perl-mode 'cperl-mode)
60 ;;(load-file "cperl-mode.el")
61 (add-to-list 'load-path '"~/lib/emacs_el/configuration/")
62 (require 'don-configuration)
63
64 (require 'vcl-mode)
65
66 (require 'tex-site)
67 ;;(require 'psvn)
68 ;;(require 'ecasound)
69 ;;(require 'emacs-wiki)
70 (require 'bibtex)
71 (require 'post)
72 ;;(require 'fixme)
73 ; (require 'google-weather)
74 ; (require 'org-google-weather)
75 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
76
77 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
78 ; this colorizes color strings
79 (require 'rainbow-mode)
80 ; add ess to the x major mode
81 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
82 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
83
84 (global-set-key "\C-xp" 'server-edit)
85
86 (setq-default auto-mode-alist (cons '("\.wml$" . 
87                               (lambda () (html-mode) (auto-fill-mode)))
88                             auto-mode-alist))
89
90
91 ; use markdown mode for mdwn files
92 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
93
94
95
96
97 ; mail configuration
98 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
99 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
100
101 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
102 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
103 (defun my-message-mode-settings ()
104   (font-lock-add-keywords nil
105                           '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
106                              (0 'message-multiply-quoted-text-face))
107                             ("^[ \t]*>[ \t]*>.*$"
108                              (0 'message-double-quoted-text-face))))
109   (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
110   )
111 (add-hook 'message-mode-hook 'my-message-mode-settings)
112
113 (defun my-post-attach-file ()
114   "Prompt for an attachment."
115   (interactive)
116   (let ((file (read-file-name "Attach file: " nil nil t nil))
117         (description (string-read "Description: ")))
118     (my-header-attach-file file description)))
119
120 (symbol-function 'my-post-attach-file)
121
122 (defun my-header-attach-file (file description)
123   "Attach a FILE to the current message (works with Mutt).
124 Argument DESCRIPTION MIME description."
125   (interactive "fAttach file: \nsDescription: ")
126   (when (> (length file) 0)
127     (save-excursion
128       (save-match-data
129         (save-restriction
130           (widen)
131           (goto-char (point-min))
132           (search-forward-regexp "^$")
133           (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
134                           description "\n"))
135           (message (concat "Attached '" file "'."))
136           (setq post-has-attachment t))))))
137
138
139
140 (setq mail-yank-prefix "> ")
141
142 (global-unset-key "\M-g")
143 (global-set-key "\M-g" 'goto-line)
144
145 ;; self-insert-command hack.
146 ;;   Without this, "if<SP>" expands to
147 ;;   if ( -!-) {
148 ;;   }
149 ;;   which really should be,
150 ;;   if (-!-) {
151 ;;   }
152
153
154
155 ;(load-library "php-mode")
156
157 (setq-default c-indent-level 4)
158 (setq-default c-brace-imaginary-offset 0)
159 (setq-default c-brace-offset -4)
160 (setq-default c-argdecl-indent 4)
161 (setq-default c-label-offset -4)
162 (setq-default c-continued-statement-offset 4)
163 ; tabs are annoying
164 (setq-default indent-tabs-mode nil)
165 (setq-default tab-width 4)
166
167
168 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
169 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
170 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
171 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
172 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
173
174 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
175 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
176 (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
177 (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
178 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
179 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
180 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
181 (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
182 (add-hook 'LaTeX-mode-hook 'outline-minor-mode)   ; with AUCTeX LaTeX mode
183 (add-hook 'latex-mode-hook 'outline-minor-mode)   ; with Emacs latex mode
184
185 ; use smart quotes by default instead of `` and ''
186 ; taken from http://kieranhealy.org/esk/kjhealy.html
187 (setq TeX-open-quote "“")
188 (setq TeX-close-quote "”")
189
190 ;; (TeX-add-style-hook
191 ;;  "latex"
192 ;;  (lambda ()
193 ;;    (TeX-add-symbols
194 ;;     '("DLA" 1))))
195 ;; (custom-set-variables
196 ;;  '(font-latex-user-keyword-classes 
197 ;;    '(("fixme" 
198 ;;       ("DLA" "RZ")
199 ;;       font-lock-function-name-face 2 (command 1 t))))
200 ;; ) 
201
202 (require 'font-latex)
203 (setq font-latex-match-reference-keywords
204       '(
205         ("fref" "{")
206         ("Fref" "{")
207         ("citep" "{")
208         ("citet" "{")
209         ("acs" "{")
210         ("acsp" "{")
211         ("ac" "{")
212         ("acp" "{")
213         ("acl" "{")
214         ("aclp" "{")
215         ("acsu" "{")
216         ("aclu" "{")
217         ("acused" "{")
218 ;         ))
219 ; (setq font-latex-match-warning-keywords
220 ;       '(
221         ("DLA" "{")
222         ("RZ" "{")
223         ("OM" "{")
224         ("DL" "{")
225         ("fixme" "{")))
226       
227 (setq-default TeX-parse-self t)
228 (setq-default TeX-auto-save t)
229 (setq-default TeX-master nil)
230
231 ;; this doesn't seem to work; not currently sure why
232 ; (setq font-latex-user-keyword-classes
233 ;       '(("my-warning-commands"
234 ;          (("DLA" "{")
235 ;           ("RZ" "{")
236 ;           ("OM" "{")
237 ;           ("DL" "{")
238 ;           ("fixme" "{")
239 ;           )
240 ;          (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
241 ;         ))
242
243
244 (defun insert-date ()
245   "Insert date at point."
246   (interactive)
247   (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
248 (global-set-key "\C-[d" 'insert-date)
249
250 (defun unfill-paragraph (arg)
251   "Pull this whole paragraph up onto one line."
252   (interactive "*p")
253   (let ((fill-column 10000))
254     (fill-paragraph arg))
255   )
256
257 (column-number-mode t)
258 (setq-default reftex-plug-into-AUCTeX t)
259
260 (server-start)
261
262 (require 'mode-compile)
263
264 (setq-default reftex-default-bibliography
265       '("~/projects/research/references.bib"))
266
267 (defadvice server-process-filter (after post-mode-message first activate)
268   "If the buffer is in post mode, overwrite the server-edit
269     message with a post-save-current-buffer-and-exit message."
270   (if (eq major-mode 'post-mode)
271       (message
272        (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
273                                         ; This is also needed to see the magic message.  Set to a higher
274                                         ; number if you have a faster computer or read slower than me.
275 '(font-lock-verbose 1000)
276 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
277 ; (add-hook 'server-switch-hook 
278 ;         (function (lambda()
279 ;                     (cond ((string-match "Post" mode-name)
280 ;                            (post-goto-body)))
281 ;                     set-buffer-file-coding-system 'utf-8
282 ;                     )))
283
284
285 (add-hook 'post-mode-hook
286           (auto-fill-mode nil)
287           )
288 ; abbrev mode settings
289 ; load abbreviations from 
290 (setq abbrev-file-name       
291       "~/.emacs_abbrev_def")
292
293 ; read the abbrev file if it exists
294 (if (file-exists-p abbrev-file-name)
295     (quietly-read-abbrev-file))
296
297 ; for now, use abbrev mode everywhere
298 (setq default-abbrev-mode t)
299
300
301 (defun insert-function-documentation ()
302   "Insert function documentation"
303   (interactive)
304   (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
305 (global-set-key "\M-f" 'insert-function-documentation)
306
307 (eval-after-load "lilypond-mode" 
308   '(progn
309      (load-library "lyqi-mode")
310      (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
311
312 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
313
314 (desktop-load-default)
315 (desktop-read)
316 '(icomplete-mode on)
317 (custom-set-faces
318  ;; custom-set-faces was added by Custom.
319  ;; If you edit it by hand, you could mess it up, so be careful.
320  ;; Your init file should contain only one such instance.
321  ;; If there is more than one, they won't work right.
322  '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
323
324
325 (put 'upcase-region 'disabled nil)
326 (put 'downcase-region 'disabled nil)
327 (put 'narrow-to-region 'disabled nil)
328
329
330 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
331 (add-hook 'message-mode-hook 'turn-on-flyspell)
332 (add-hook 'text-mode-hook 'turn-on-flyspell)
333 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
334 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
335 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
336 (defun turn-on-flyspell ()
337    "Force flyspell-mode on using a positive arg.  For use in hooks."
338    (interactive)
339    (flyspell-mode 1))
340
341
342  ; Outline-minor-mode key map
343  (define-prefix-command 'cm-map nil "Outline-")
344  ; HIDE
345  (define-key cm-map "q" 'hide-sublevels)    ; Hide everything but the top-level headings
346  (define-key cm-map "t" 'hide-body)         ; Hide everything but headings (all body lines)
347  (define-key cm-map "o" 'hide-other)        ; Hide other branches
348  (define-key cm-map "c" 'hide-entry)        ; Hide this entry's body
349  (define-key cm-map "l" 'hide-leaves)       ; Hide body lines in this entry and sub-entries
350  (define-key cm-map "d" 'hide-subtree)      ; Hide everything in this entry and sub-entries
351  ; SHOW
352  (define-key cm-map "a" 'show-all)          ; Show (expand) everything
353  (define-key cm-map "e" 'show-entry)        ; Show this heading's body
354  (define-key cm-map "i" 'show-children)     ; Show this heading's immediate child sub-headings
355  (define-key cm-map "k" 'show-branches)     ; Show all sub-headings under this heading
356  (define-key cm-map "s" 'show-subtree)      ; Show (expand) everything in this heading & below
357  ; MOVE
358  (define-key cm-map "u" 'outline-up-heading)                ; Up
359  (define-key cm-map "n" 'outline-next-visible-heading)      ; Next
360  (define-key cm-map "p" 'outline-previous-visible-heading)  ; Previous
361  (define-key cm-map "f" 'outline-forward-same-level)        ; Forward - same level
362  (define-key cm-map "b" 'outline-backward-same-level)       ; Backward - same level
363  (global-set-key "\M-o" cm-map)
364
365
366 ; debian stuff
367 (setq-default debian-changelog-mailing-address "don@debian.org")
368 (setq-default debian-changelog-full-name "Don Armstrong")
369
370 ; ediff configuration
371 ; don't use the multi-window configuration
372 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
373
374 ; use iedit
375 (require 'iedit)
376 (define-key global-map (kbd "C-;") 'iedit-mode)
377 (global-set-key  (kbd "C-;") 'iedit-mode)
378
379 ; fix up css mode to not be silly
380 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
381 (setq cssm-indent-level 4)
382 (setq cssm-newline-before-closing-bracket t)
383 (setq cssm-indent-function #'cssm-c-style-indenter)
384 (setq cssm-mirror-mode nil)
385
386 (require 'multi-web-mode)
387 (setq mweb-default-major-mode 'html-mode)
388 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
389                   (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
390                   (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
391 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
392 (multi-web-global-mode 1)
393
394 ;;; alias the new `flymake-report-status-slim' to
395 ;;; `flymake-report-status'
396 (defalias 'flymake-report-status 'flymake-report-status-slim)
397 (defun flymake-report-status-slim (e-w &optional status)
398   "Show \"slim\" flymake status in mode line."
399   (when e-w
400     (setq flymake-mode-line-e-w e-w))
401   (when status
402     (setq flymake-mode-line-status status))
403   (let* ((mode-line " Φ"))
404     (when (> (length flymake-mode-line-e-w) 0)
405       (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
406     (setq mode-line (concat mode-line flymake-mode-line-status))
407     (setq flymake-mode-line mode-line)
408     (force-mode-line-update)))
409
410 ; load sql-indent when sql is loaded
411 (eval-after-load "sql"
412   '(load-library "sql-indent"))
413
414 ; fix up tmux xterm keys
415 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
416 (if (getenv "TMUX")
417     (progn
418       (let ((x 2) (tkey ""))
419         (while (<= x 8)
420           ;; shift
421           (if (= x 2)
422               (setq tkey "S-"))
423           ;; alt
424           (if (= x 3)
425               (setq tkey "M-"))
426           ;; alt + shift
427           (if (= x 4)
428               (setq tkey "M-S-"))
429           ;; ctrl
430           (if (= x 5)
431               (setq tkey "C-"))
432           ;; ctrl + shift
433           (if (= x 6)
434               (setq tkey "C-S-"))
435           ;; ctrl + alt
436           (if (= x 7)
437               (setq tkey "C-M-"))
438           ;; ctrl + alt + shift
439           (if (= x 8)
440               (setq tkey "C-M-S-"))
441           
442           ;; arrows
443           (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
444           (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
445           (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
446           (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
447           ;; home
448           (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
449           ;; end
450           (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
451           ;; page up
452           (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
453           ;; page down
454           (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
455           ;; insert
456           (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
457           ;; delete
458           (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
459           ;; f1
460           (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
461           ;; f2
462           (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
463           ;; f3
464           (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
465           ;; f4
466           (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
467           ;; f5
468           (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
469           ;; f6
470           (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
471           ;; f7
472           (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
473           ;; f8
474           (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
475           ;; f9
476           (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
477           ;; f10
478           (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
479           ;; f11
480           (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
481           ;; f12
482           (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
483           ;; f13
484           (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
485           ;; f14
486           (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
487           ;; f15
488           (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
489           ;; f16
490           (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
491           ;; f17
492           (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
493           ;; f18
494           (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
495           ;; f19
496           (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
497           ;; f20
498           (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
499
500           (setq x (+ x 1))
501           ))
502       )
503   )
504
505 ; require org mode
506 (load "org-mode-configuration")
507 ; ess configuration
508 (load "ess_remote_eval")
509 (load "ess_configuration")
510 ; procmailmode configuration
511 (load "procmail_mode")
512
513 (load "mode-line-cleaner")
514
515 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
516   "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
517   (if (or (buffer-modified-p)
518           (verify-visited-file-modtime)
519           (< (* 8 1024 1024) (buffer-size))
520           (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
521       ad-do-it
522     (clear-visited-file-modtime)
523     (not-modified)))
524 (ad-activate 'ask-user-about-supersession-threat)
525
526 ; apparently things like to step on C-;, so we'll use a hack from
527 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
528
529 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
530
531 ; use iedit everywhere
532 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
533
534 (define-minor-mode my-keys-minor-mode
535   "A minor mode so that my key settings override annoying major modes."
536   t " my-keys" 'my-keys-minor-mode-map)
537
538 (my-keys-minor-mode 1)
539 (defun my-minibuffer-setup-hook ()
540   (my-keys-minor-mode 0))
541
542 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
543 (defadvice load (after give-my-keybindings-priority)
544   "Try to ensure that my keybindings always have priority."
545   (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
546       (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
547         (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
548         (add-to-list 'minor-mode-map-alist mykeys))))
549 (ad-activate 'load)
550 (global-set-key "\M- " 'hippie-expand)