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