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