]> git.donarmstrong.com Git - emacs.git/blob - .emacs
include vcl mode
[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")
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  '(iswitchb-mode t)
24  '(iswitchb-prompt-newbuffer nil)
25  '(log-edit-keep-buffer t)
26  '(mail-user-agent (quote sendmail-user-agent))
27  '(markdown-enable-math t)
28  '(markdown-follow-wiki-link-on-enter nil)
29  '(mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
30  '(post-email-address "don@donarmstrong.com")
31  '(post-kill-quoted-sig nil)
32  '(post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
33  '(post-uses-fill-mode nil)
34  '(ps-footer-font-size (quote (8 . 10)))
35  '(ps-header-font-size (quote (8 . 10)))
36  '(ps-header-title-font-size (quote (10 . 10)))
37  '(ps-line-number-color "blue")
38  '(ps-print-footer t)
39  '(ps-print-footer-frame nil)
40  '(ps-print-only-one-header t)
41  '(safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
42  '(sentence-end "[.?!][]\"')]*\\($\\|   \\| \\)[        
43 ]*")
44  '(sentence-end-double-space nil)
45  '(show-paren-mode t)
46  '(tool-bar-mode nil nil (tool-bar))
47  '(user-mail-address "don@donarmstrong.com")
48  '(vc-delete-logbuf-window nil)
49  '(vc-follow-symlinks t))
50
51
52 ;; switch back to the old primary selection method
53 (setq x-select-enable-clipboard nil)
54 (setq x-select-enable-primary t)
55 ; (setq mouse-drag-copy-region t)
56
57 (fset 'perl-mode 'cperl-mode)
58 ;;(load-file "cperl-mode.el")
59 (add-to-list 'load-path '"~/lib/emacs_el/")
60 ;; this is the tiny-tools module from https://github.com/jaalto/project--emacs-tiny-tools.git
61 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/tiny")
62 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/other")
63 ;;(add-to-list 'Tex-style-path '"~/lib/emacs_el/auctex/")
64
65 (setq tinyprocmail--procmail-version "v3.22")
66 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install)
67 (require 'tinyprocmail)
68
69 (require 'vcl-mode)
70
71 (require 'tex-site)
72 ;;(require 'psvn)
73 (require 'cperl-mode)
74 ;;(require 'ecasound)
75 ;;(require 'emacs-wiki)
76 (require 'bibtex)
77 (require 'post)
78 ;;(require 'fixme)
79 (require 'google-weather)
80 (require 'org-google-weather)
81 (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
82
83 ; org mode agenda files
84 (setq org-agenda-files
85       (quote ("~/projects/debbugs/debbugs.org"
86               "~/projects/notes/notes.org"
87               "~/projects/origins_of_life/ool.org"
88               "~/projects/sysadmin/sndservers/sndservers.org"
89               "~/projects/chaim/chaim.org"
90               "~/projects/fh/fh.org")))
91
92 (setq org-global-properties '(("Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")))
93 (setq org-global-columns-default-format "%40ITEM(Task) %TAGS %PRIORITY %TODO %17Effort(Estimated Effort){:} %CLOCKSUM")
94
95 (setq org-default-notes-file "~/projects/notes/notes.org")
96 (setq org-capture-templates  ;; mail-specific note template, identified by "m"
97       '(("m" "Mail" entry (file+headline "~/projects/notes/refile.org" "Mail")
98          "* %?\n\n  Source: %u, %c\n  %i")
99         ("t" "todo" entry (file "~/projects/notes/refile.org")
100          "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
101         ("r" "respond" entry (file "~/projects/notes/refile.org")
102          "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
103         ("n" "note" entry (file "~/projects/notes/refile.org")
104          "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
105         ("j" "Journal" entry (file+datetree "~/projects/notes/diary.org")
106          "* %?\n%U\n" :clock-in t :clock-resume t)
107         ("w" "org-protocol" entry (file "~/projects/notes/refile.org")
108          "* TODO Review %c\n%U\n" :immediate-finish t)
109         ("p" "Phone call" entry (file "~/projects/notes/refile.org")
110          "* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
111         ("h" "Habit" entry (file "~/projects/notes/refile.org")
112          "* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n")
113         )
114       )
115
116 ;; Remove empty LOGBOOK drawers on clock out
117 (defun bh/remove-empty-drawer-on-clock-out ()
118   (interactive)
119   (save-excursion
120     (beginning-of-line 0)
121     (org-remove-empty-drawer-at "LOGBOOK" (point))))
122
123 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
124
125
126 ; this is from http://doc.norang.ca/org-mode.html#Capture
127 ; use C-M-r for org mode capture
128 (global-set-key (kbd "C-M-r") 'org-capture)
129
130 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
131 (setq org-refile-targets (quote ((nil :maxlevel . 9)
132                                  (org-agenda-files :maxlevel . 9))))
133
134 ; Use full outline paths for refile targets - we file directly with IDO
135 (setq org-refile-use-outline-path t)
136
137 ; Targets complete directly with IDO
138 (setq org-outline-path-complete-in-steps nil)
139
140 ; Allow refile to create parent tasks with confirmation
141 (setq org-refile-allow-creating-parent-nodes (quote confirm))
142
143 ; Use IDO for both buffer and file completion and ido-everywhere to t
144 (setq org-completion-use-ido t)
145 (setq ido-everywhere t)
146 (setq ido-max-directory-size 100000)
147 (ido-mode (quote both))
148
149 ;;;; Refile settings
150 ; Exclude DONE state tasks from refile targets
151 (defun bh/verify-refile-target ()
152   "Exclude todo keywords with a done state from refile targets"
153   (not (member (nth 2 (org-heading-components)) org-done-keywords)))
154
155 (setq org-refile-target-verify-function 'bh/verify-refile-target)
156
157 ;; ensure that emacsclient will show just the note to be edited when invoked
158 ;; from Mutt, and that it will shut down emacsclient once finished;
159 ;; fallback to legacy behavior when not invoked via org-protocol.
160 (require 'org-protocol)
161 (add-hook 'org-capture-mode-hook 'delete-other-windows)
162 (setq my-org-protocol-flag nil)
163 (defadvice org-capture-finalize (after delete-frame-at-end activate)
164   "Delete frame at remember finalization"
165   (progn (if my-org-protocol-flag (delete-frame))
166          (setq my-org-protocol-flag nil)))
167 (defadvice org-capture-kill (after delete-frame-at-end activate)
168   "Delete frame at remember abort"
169   (progn (if my-org-protocol-flag (delete-frame))
170          (setq my-org-protocol-flag nil)))
171 (defadvice org-protocol-capture (before set-org-protocol-flag activate)
172   (setq my-org-protocol-flag t))
173
174
175 ; this comes from http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/
176 (defun open-mail-in-mutt (message)
177   "Open a mail message in Mutt, using an external terminal.
178
179 Message can be specified either by a path pointing inside a
180 Maildir, or by Message-ID."
181   (interactive "MPath or Message-ID: ")
182   (shell-command
183    (format "xterm -e \"%s %s\""
184        (substitute-in-file-name "$HOME/bin/mutt_open") message)))
185
186 ;; add support for "mutt:ID" links
187 (org-add-link-type "mutt" 'open-mail-in-mutt)
188
189
190 (global-set-key "\C-xp" 'server-edit)
191
192 (setq-default auto-mode-alist (cons '("\.wml$" . 
193                               (lambda () (html-mode) (auto-fill-mode)))
194                             auto-mode-alist))
195
196 ;; Use c-mode for perl .xs files
197 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
198 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
199 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
200 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
201 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
202
203 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . post-mode))
204 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
205
206 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . post-mode))
207 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
208
209 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
210
211
212
213 (global-unset-key "\M-g")
214 (global-set-key "\M-g" 'goto-line)
215
216 ;;(autoload 'perl-mode "cperl-mode"
217 ;;  "alternate mode for editing Perl programs" t)
218
219 ;; self-insert-command hack.
220 ;;   Without this, "if<SP>" expands to
221 ;;   if ( -!-) {
222 ;;   }
223 ;;   which really should be,
224 ;;   if (-!-) {
225 ;;   }
226 (setq-default cperl-hairy t
227       cperl-indent-level 4
228 ;;      cperl-auto-newline t
229 ;;      cperl-auto-newline-after-colon t
230       cperl-continued-statement-offset 4
231       cperl-brace-offset -4
232       cperl-label-offset -4
233       cperl-highlight-variables-indiscriminately t
234       cperl-electric-lbrace-space nil
235       )
236 (add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
237
238
239
240 ;(load-library "php-mode")
241
242 (setq-default c-indent-level 8)
243 (setq-default c-brace-imaginary-offset 0)
244 (setq-default c-brace-offset -8)
245 (setq-default c-argdecl-indent 8)
246 (setq-default c-label-offset -8)
247 (setq-default c-continued-statement-offset 8)
248 ; tabs are annoying
249 (setq-default indent-tabs-mode nil)
250 (setq-default tab-width 8)
251
252
253 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
254 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
255 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
256 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
257 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
258
259 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
260 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
261 (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
262 (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
263 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
264 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
265 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
266 (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
267 (add-hook 'LaTeX-mode-hook 'outline-minor-mode)   ; with AUCTeX LaTeX mode
268 (add-hook 'latex-mode-hook 'outline-minor-mode)   ; with Emacs latex mode
269
270 ;; (TeX-add-style-hook
271 ;;  "latex"
272 ;;  (lambda ()
273 ;;    (TeX-add-symbols
274 ;;     '("DLA" 1))))
275 ;; (custom-set-variables
276 ;;  '(font-latex-user-keyword-classes 
277 ;;    '(("fixme" 
278 ;;       ("DLA" "RZ")
279 ;;       font-lock-function-name-face 2 (command 1 t))))
280 ;; ) 
281
282 (require 'font-latex)
283 (add-to-list 'font-latex-match-reference-keywords "fref")
284 (add-to-list 'font-latex-match-reference-keywords "Fref")
285 (add-to-list 'font-latex-match-reference-keywords "citep")
286 (add-to-list 'font-latex-match-reference-keywords "citet")
287 (font-latex-match-reference-make)
288 (add-to-list 'font-latex-match-function-keywords "DLA")
289 (add-to-list 'font-latex-match-function-keywords "RZ")
290 (add-to-list 'font-latex-match-function-keywords "OM")
291 (add-to-list 'font-latex-match-function-keywords "DL")
292 (add-to-list 'font-latex-match-function-keywords "fixme")
293 (add-to-list 'font-latex-match-function-keywords "acs")
294 (add-to-list 'font-latex-match-function-keywords "acsp")
295 (add-to-list 'font-latex-match-function-keywords "ac")
296 (add-to-list 'font-latex-match-function-keywords "acp")
297 (add-to-list 'font-latex-match-function-keywords "acl")
298 (add-to-list 'font-latex-match-function-keywords "aclp")
299 (add-to-list 'font-latex-match-function-keywords "acsu")
300 (add-to-list 'font-latex-match-function-keywords "aclu")
301 (add-to-list 'font-latex-match-function-keywords "acused")
302 (font-latex-match-function-make)
303 (setq-default TeX-parse-self t)
304 (setq-default TeX-auto-save t)
305 (setq-default TeX-master nil)
306
307 (defun insert-date ()
308   "Insert date at point."
309   (interactive)
310   (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
311 (global-set-key "\C-[d" 'insert-date)
312
313 (defun unfill-paragraph (arg)
314   "Pull this whole paragraph up onto one line."
315   (interactive "*p")
316   (let ((fill-column 10000))
317     (fill-paragraph arg))
318   )
319
320 ;(iswitchb-default-keybindings)
321
322 (column-number-mode t)
323 (setq-default reftex-plug-into-AUCTeX t)
324
325 (server-start)
326
327 (require 'mode-compile)
328
329 (setq-default reftex-default-bibliography
330       '("references.bib"))
331
332 (defadvice server-process-filter (after post-mode-message first activate)
333   "If the buffer is in post mode, overwrite the server-edit
334     message with a post-save-current-buffer-and-exit message."
335   (if (eq major-mode 'post-mode)
336       (message
337        (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
338                                         ; This is also needed to see the magic message.  Set to a higher
339                                         ; number if you have a faster computer or read slower than me.
340 '(font-lock-verbose 1000)
341 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
342 ; (add-hook 'server-switch-hook 
343 ;         (function (lambda()
344 ;                     (cond ((string-match "Post" mode-name)
345 ;                            (post-goto-body)))
346 ;                     set-buffer-file-coding-system 'utf-8
347 ;                     )))
348
349
350 (add-hook 'post-mode-hook
351           (auto-fill-mode nil)
352           )
353
354 (fset 'insert-function-documentation
355    [?\C-x ?i home ?\C-k ?/ ?h ?o ?m ?e ?/ ?d ?o ?n ?/ ?l ?i ?b ?/ ?t ?e ?m ?p ?l ?a ?t ?e ?s ?/ ?p ?e ?r ?l ?_ ?f ?u ?n ?c ?t ?i ?o ?n ?_ ?d ?o ?c ?u ?m ?e ?n ?t ?a ?t ?i ?o ?n return])
356 (global-set-key "\M-f" 'insert-function-documentation)
357
358 (eval-after-load "lilypond-mode" 
359   '(progn
360      (load-library "lyqi-mode")
361      (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
362
363 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
364
365 (desktop-load-default)
366 (desktop-read)
367 '(iswitchb-mode on)
368 (custom-set-faces
369   ;; custom-set-faces was added by Custom.
370   ;; If you edit it by hand, you could mess it up, so be careful.
371   ;; Your init file should contain only one such instance.
372   ;; If there is more than one, they won't work right.
373  '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
374
375 (defun ess-change-directory (path)
376   "Set the current working directory to PATH for both *R* and Emacs."
377   (interactive "DDirectory to change to: ")
378
379   (when (file-exists-p path)
380     (ess-command (concat "setwd(\"" path "\")\n"))
381     ;; use file-name-as-directory to ensure it has trailing /
382     (setq default-directory (file-name-as-directory path))))
383
384 (put 'upcase-region 'disabled nil)
385 (put 'downcase-region 'disabled nil)
386 (put 'narrow-to-region 'disabled nil)
387
388 ;; The following lines are always needed. Choose your own keys.
389 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
390 (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
391 (global-set-key "\C-cl" 'org-store-link)
392 (global-set-key "\C-ca" 'org-agenda)
393 (global-set-key "\C-cb" 'org-iswitchb)
394 (setq-default org-log-done 'time)
395 (setq-default org-agenda-ndays 5)
396
397
398 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
399 (add-hook 'message-mode-hook 'turn-on-flyspell)
400 (add-hook 'text-mode-hook 'turn-on-flyspell)
401 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
402 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
403 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
404 (add-hook 'ess-mode-hook 'flyspell-prog-mode)
405 (defun turn-on-flyspell ()
406    "Force flyspell-mode on using a positive arg.  For use in hooks."
407    (interactive)
408    (flyspell-mode 1))
409
410 ;;; outlining support for ess modes
411 (add-hook 'ess-mode-hook
412           '(lambda ()
413              (outline-minor-mode)
414              (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function(.*{\\)")
415              (defun outline-level
416                (lambda () (interactive) (cond ((looking-at "^##### ") 1)((looking-at "^#### ") 2)((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3) (t 1000)))
417                )))
418
419  ; Outline-minor-mode key map
420  (define-prefix-command 'cm-map nil "Outline-")
421  ; HIDE
422  (define-key cm-map "q" 'hide-sublevels)    ; Hide everything but the top-level headings
423  (define-key cm-map "t" 'hide-body)         ; Hide everything but headings (all body lines)
424  (define-key cm-map "o" 'hide-other)        ; Hide other branches
425  (define-key cm-map "c" 'hide-entry)        ; Hide this entry's body
426  (define-key cm-map "l" 'hide-leaves)       ; Hide body lines in this entry and sub-entries
427  (define-key cm-map "d" 'hide-subtree)      ; Hide everything in this entry and sub-entries
428  ; SHOW
429  (define-key cm-map "a" 'show-all)          ; Show (expand) everything
430  (define-key cm-map "e" 'show-entry)        ; Show this heading's body
431  (define-key cm-map "i" 'show-children)     ; Show this heading's immediate child sub-headings
432  (define-key cm-map "k" 'show-branches)     ; Show all sub-headings under this heading
433  (define-key cm-map "s" 'show-subtree)      ; Show (expand) everything in this heading & below
434  ; MOVE
435  (define-key cm-map "u" 'outline-up-heading)                ; Up
436  (define-key cm-map "n" 'outline-next-visible-heading)      ; Next
437  (define-key cm-map "p" 'outline-previous-visible-heading)  ; Previous
438  (define-key cm-map "f" 'outline-forward-same-level)        ; Forward - same level
439  (define-key cm-map "b" 'outline-backward-same-level)       ; Backward - same level
440  (global-set-key "\M-o" cm-map)
441
442 (defun my-org-mode-setup ()
443  (when (and (buffer-file-name)
444             (file-exists-p (buffer-file-name)))
445   (load-library "reftex")
446   (and (buffer-file-name)
447         (file-exists-p (buffer-file-name))
448         (reftex-parse-all))
449    (reftex-set-cite-format
450      '((?b . "[[bib::%l]]")
451        (?n . "[[note::%l]]"))))
452    (define-key org-mode-map "\C-c\C-g" 'reftex-citation)
453 )
454 (add-hook 'org-mode-hook 'my-org-mode-setup)
455
456 (setq-default org-mobile-directory "/rzlab.ucr.edu:/sites/dav.donarmstrong.com/root/org/")
457 (setq-default org-directory "/home/don/org-mode/")
458 (setq-default org-mobile-inbox-for-pull "/home/don/org-mode/from-mobile.org")
459
460 ; debian stuff
461 (setq-default debian-changelog-mailing-address "don@debian.org")
462 (setq-default debian-changelog-full-name "Don Armstrong")
463
464 ; use iedit
465 (require 'iedit)
466 (define-key global-map (kbd "C-;") 'iedit-mode)
467 (global-set-key  (kbd "C-;") 'iedit-mode)
468
469 (require 'multi-web-mode)
470 (setq mweb-default-major-mode 'html-mode)
471 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
472                   (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
473                   (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
474 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
475 (multi-web-global-mode 1)
476
477 ; clean-mode-line from http://www.masteringemacs.org/articles/2012/09/10/hiding-replacing-modeline-strings/
478 (defvar mode-line-cleaner-alist
479   `((auto-complete-mode . " α")
480     (yas/minor-mode . " υ")
481     (paredit-mode . " π")
482     (eldoc-mode . "")
483     (abbrev-mode . "")
484     (my-keys-minor-mode . "")
485     ;; Major modes
486     (lisp-interaction-mode . "λ")
487     (hi-lock-mode . "")
488     (python-mode . "Py")
489     (cperl-mode . "ρ")
490     (auctex-mode . "Lχ")
491     (org-agenda-mode . "øα")
492     (org-mode . "ø")
493     (emacs-lisp-mode . "EL")
494     (nxhtml-mode . "nx"))
495   "Alist for `clean-mode-line'.
496  
497 When you add a new element to the alist, keep in mind that you
498 must pass the correct minor/major mode symbol and a string you
499 want to use in the modeline *in lieu of* the original.")
500  
501  
502 (defun clean-mode-line ()
503   (interactive)
504   (loop for cleaner in mode-line-cleaner-alist
505         do (let* ((mode (car cleaner))
506                  (mode-str (cdr cleaner))
507                  (old-mode-str (cdr (assq mode minor-mode-alist))))
508              (when old-mode-str
509                  (setcar old-mode-str mode-str))
510                ;; major mode
511              (when (eq mode major-mode)
512                (setq mode-name mode-str)))))
513  
514  
515 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
516  
517 ;;; alias the new `flymake-report-status-slim' to
518 ;;; `flymake-report-status'
519 (defalias 'flymake-report-status 'flymake-report-status-slim)
520 (defun flymake-report-status-slim (e-w &optional status)
521   "Show \"slim\" flymake status in mode line."
522   (when e-w
523     (setq flymake-mode-line-e-w e-w))
524   (when status
525     (setq flymake-mode-line-status status))
526   (let* ((mode-line " Φ"))
527     (when (> (length flymake-mode-line-e-w) 0)
528       (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
529     (setq mode-line (concat mode-line flymake-mode-line-status))
530     (setq flymake-mode-line mode-line)
531     (force-mode-line-update)))
532
533 ; apparently things like to step on C-;, so we'll use a hack from
534 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
535
536 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
537
538 ; use iedit everywhere
539 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
540
541 (define-minor-mode my-keys-minor-mode
542   "A minor mode so that my key settings override annoying major modes."
543   t " my-keys" 'my-keys-minor-mode-map)
544
545 (my-keys-minor-mode 1)
546 (defun my-minibuffer-setup-hook ()
547   (my-keys-minor-mode 0))
548
549 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
550 (defadvice load (after give-my-keybindings-priority)
551   "Try to ensure that my keybindings always have priority."
552   (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
553       (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
554         (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
555         (add-to-list 'minor-mode-map-alist mykeys))))
556 (ad-activate 'load)