3 # if for some reason, things get pear-shaped, we want to be able to
4 # enter the debugger by sending -USR2 to emacs
6 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
7 (setq debug-on-event 'siguser2)
11 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
12 (add-to-list 'load-path '"~/lib/emacs_el/")
13 (add-to-list 'load-path '"~/lib/emacs_el/helm")
14 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/tiny")
15 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/other")
16 (add-to-list 'load-path '"~/lib/emacs_el/auctex/lisp")
17 (add-to-list 'load-path '"~/lib/emacs_el/auctex")
18 (add-to-list 'load-path '"~/lib/emacs_el/ESS/lisp")
19 (add-to-list 'load-path '"~/lib/emacs_el/org-mode/lisp")
20 (add-to-list 'load-path '"~/lib/emacs_el/auctex-beamer")
21 (add-to-list 'load-path '"~/lib/emacs_el/magit-annex")
22 (add-to-list 'load-path '"~/lib/emacs_el/polymode")
28 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
29 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
30 ;; execute conditional code when loading libraries
31 (defmacro with-library (symbol &rest body)
32 `(when (require ,symbol nil t)
34 (put 'with-library 'lisp-indent-function 1)
42 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
44 (with-library 'tinyprocmail
45 ; (setq tinyprocmail--procmail-version "v3.22")
46 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
50 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
51 ; don't verify where we are pushing
52 (setq magit-push-always-verify nil)
53 ;; refine diffs always (hilight words)
54 (setq magit-diff-refine-hunk 'all)
57 (append '("~/lib/emacs_el/magit-annex")
59 (require 'magit-annex)
63 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
65 ;; Use c-mode for perl .xs files
66 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
67 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
68 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
69 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
70 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
73 cperl-auto-newline nil
74 cperl-auto-newline-after-colon nil
75 cperl-continued-statement-offset 4
77 cperl-continued-brace-offset 0
79 cperl-highlight-variables-indiscriminately t
80 cperl-electric-lbrace-space nil
81 cperl-indent-parens-as-block nil
82 cperl-close-paren-offset -1
83 cperl-tab-always-indent t)
84 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
88 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
92 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
97 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
98 (add-to-list 'tramp-methods '("vcsh"
99 (tramp-login-program "vcsh")
103 (tramp-remote-shell "/bin/sh")
104 (tramp-remote-shell-args
108 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
109 (load "auctex.el" nil t t)
110 (load "preview-latex.el" nil t t)
111 (load "latex.el" nil t t)
113 ;; this is in the very newest auctex; avoid for now
114 (add-to-list 'LaTeX-fill-excluded-macros
116 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
117 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
118 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
119 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
120 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
121 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
122 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
123 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
124 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
125 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
127 ; use smart quotes by default instead of `` and ''
128 ; taken from http://kieranhealy.org/esk/kjhealy.html
129 (setq TeX-open-quote "“")
130 (setq TeX-close-quote "”")
132 ;; (TeX-add-style-hook
137 ;; (custom-set-variables
138 ;; '(font-latex-user-keyword-classes
141 ;; font-lock-function-name-face 2 (command 1 t))))
144 (require 'font-latex)
145 (setq font-latex-match-reference-keywords
161 ; (setq font-latex-match-warning-keywords
169 (setq-default TeX-parse-self t)
170 (setq-default TeX-auto-save t)
171 (setq-default TeX-master nil)
177 (if (boundp 'reftex-ref-style-alist)
179 'reftex-ref-style-alist
180 '("Cleveref" "cleveref"
181 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
182 (reftex-ref-style-activate "Cleveref")
184 '("cref" TeX-arg-ref)
185 '("Cref" TeX-arg-ref)
186 '("cpageref" TeX-arg-ref)
187 '("Cpageref" TeX-arg-ref)))))
188 ;; this doesn't seem to work; not currently sure why
189 ; (setq font-latex-user-keyword-classes
190 ; '(("my-warning-commands"
197 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
200 (setq-default reftex-default-bibliography
201 '("~/projects/research/references.bib"))
206 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
207 (require 'org-mode-configuration)
210 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
211 (require 'ess_configuration)
216 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
218 (append '("~/lib/emacs_el/polymode/modes")
222 (require 'poly-noweb)
223 (require 'poly-markdown)
224 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
225 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
226 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
230 ** Override other things
231 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
232 ; apparently things like to step on C-;, so we'll use a hack from
233 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
235 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
237 ; use iedit everywhere
238 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
239 ;; use outline mode keybindings everywhere
240 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
242 (define-minor-mode my-keys-minor-mode
243 "A minor mode so that my key settings override annoying major modes."
244 t " my-keys" 'my-keys-minor-mode-map)
246 (my-keys-minor-mode 1)
247 (defun my-minibuffer-setup-hook ()
248 (my-keys-minor-mode 0))
250 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
251 (defadvice load (after give-my-keybindings-priority)
252 "Try to ensure that my keybindings always have priority."
253 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
254 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
255 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
256 (add-to-list 'minor-mode-map-alist mykeys))))
260 * Misc (uncharacterized)
261 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
262 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
263 (setq calendar-latitude 40.11)
264 (setq calendar-longitude -88.24)
265 (setq case-fold-search t)
266 (setq confirm-kill-emacs (quote y-or-n-p))
267 (setq cperl-lazy-help-time nil)
268 (setq debian-changelog-mailing-address "don@debian.org")
270 (setq display-time-24hr-format t)
271 (setq display-time-day-and-date t)
272 (display-time-mode 1)
273 (setq font-latex-fontify-script nil)
274 (setq font-latex-fontify-sectioning (quote color))
275 (setq font-latex-script-display (quote (nil)))
276 (global-auto-revert-mode 1)
277 (global-font-lock-mode 1)
279 (setq log-edit-keep-buffer t)
280 (setq mail-user-agent (quote sendmail-user-agent))
281 (setq markdown-enable-math t)
282 (setq markdown-follow-wiki-link-on-enter nil)
283 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
284 (setq post-email-address "don@donarmstrong.com")
285 (setq post-kill-quoted-sig nil)
286 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
287 (setq post-uses-fill-mode nil)
288 (setq ps-footer-font-size (quote (8 . 10)))
289 (setq ps-header-font-size (quote (8 . 10)))
290 (setq ps-header-title-font-size (quote (10 . 10)))
291 (setq ps-line-number-color "blue")
292 (setq ps-print-footer t)
293 (setq ps-print-footer-frame nil)
294 (setq ps-print-only-one-header t)
295 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
296 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
298 (setq sentence-end-double-space nil)
299 ; enable matching parenthesis
302 (setq user-mail-address "don@donarmstrong.com")
303 (setq vc-delete-logbuf-window nil)
304 (setq vc-follow-symlinks t)
306 ;; use git before SVN; use CVS earlier, because I have CVS
307 ;; repositories inside of git directories
308 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
310 ;; switch back to the old primary selection method
311 (setq x-select-enable-clipboard nil)
312 (setq x-select-enable-primary t)
313 ; (setq mouse-drag-copy-region t)
315 (fset 'perl-mode 'cperl-mode)
316 ;;(load-file "cperl-mode.el")
322 ;;(require 'ecasound)
323 ;;(require 'emacs-wiki)
327 ; (require 'google-weather)
328 ; (require 'org-google-weather)
329 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
331 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
332 ; this colorizes color strings
333 (require 'rainbow-mode)
334 ; add ess to the x major mode
335 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
336 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
338 (global-set-key "\C-xp" 'server-edit)
340 (setq-default auto-mode-alist (cons '("\.wml$" .
341 (lambda () (html-mode) (auto-fill-mode)))
345 ; use markdown mode for mdwn files
346 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
347 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
350 ;; tramp configuration
351 (setq tramp-use-ssh-controlmaster-options nil)
354 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
355 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
357 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
358 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
359 (defun my-message-mode-settings ()
360 (font-lock-add-keywords nil
361 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
362 (0 'message-multiply-quoted-text-face))
363 ("^[ \t]*>[ \t]*>.*$"
364 (0 'message-double-quoted-text-face))))
365 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
367 (add-hook 'message-mode-hook 'my-message-mode-settings)
369 (defun my-post-attach-file ()
370 "Prompt for an attachment."
372 (let ((file (read-file-name "Attach file: " nil nil t nil))
373 (description (string-read "Description: ")))
374 (my-header-attach-file file description)))
376 (symbol-function 'my-post-attach-file)
378 (defun my-header-attach-file (file description)
379 "Attach a FILE to the current message (works with Mutt).
380 Argument DESCRIPTION MIME description."
381 (interactive "fAttach file: \nsDescription: ")
382 (when (> (length file) 0)
387 (goto-char (point-min))
388 (search-forward-regexp "^$")
389 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
391 (message (concat "Attached '" file "'."))
392 (setq post-has-attachment t))))))
396 (setq mail-yank-prefix "> ")
398 (global-unset-key "\M-g")
399 (global-set-key "\M-g" 'goto-line)
401 ;; self-insert-command hack.
402 ;; Without this, "if<SP>" expands to
405 ;; which really should be,
411 ;(load-library "php-mode")
413 (setq-default c-indent-level 4)
414 (setq-default c-brace-imaginary-offset 0)
415 (setq-default c-brace-offset -4)
416 (setq-default c-argdecl-indent 4)
417 (setq-default c-label-offset -4)
418 (setq-default c-continued-statement-offset 4)
420 (setq-default indent-tabs-mode nil)
421 (setq-default tab-width 4)
424 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
425 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
426 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
427 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
428 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
431 (defun insert-date ()
432 "Insert date at point."
434 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
435 (global-set-key "\C-[d" 'insert-date)
437 (defun unfill-paragraph (arg)
438 "Pull this whole paragraph up onto one line."
440 (let ((fill-column 10000))
441 (fill-paragraph arg))
444 (column-number-mode t)
445 (setq-default reftex-plug-into-AUCTeX t)
449 ; (require 'mode-compile)
451 (defadvice server-process-filter (after post-mode-message first activate)
452 "If the buffer is in post mode, overwrite the server-edit
453 message with a post-save-current-buffer-and-exit message."
454 (if (eq major-mode 'post-mode)
456 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
457 ; This is also needed to see the magic message. Set to a higher
458 ; number if you have a faster computer or read slower than me.
459 '(font-lock-verbose 1000)
460 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
461 ; (add-hook 'server-switch-hook
462 ; (function (lambda()
463 ; (cond ((string-match "Post" mode-name)
465 ; set-buffer-file-coding-system 'utf-8
469 (add-hook 'post-mode-hook
472 ; abbrev mode settings
473 ; load abbreviations from
474 (setq abbrev-file-name
475 "~/.emacs_abbrev_def")
477 ; read the abbrev file if it exists
478 (if (file-exists-p abbrev-file-name)
479 (quietly-read-abbrev-file))
481 ; for now, use abbrev mode everywhere
482 (setq default-abbrev-mode t)
485 (defun insert-function-documentation ()
486 "Insert function documentation"
488 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
489 (global-set-key "\M-f" 'insert-function-documentation)
491 (eval-after-load "lilypond-mode"
493 (load-library "lyqi-mode")
494 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
496 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
498 (desktop-load-default)
502 ;; custom-set-faces was added by Custom.
503 ;; If you edit it by hand, you could mess it up, so be careful.
504 ;; Your init file should contain only one such instance.
505 ;; If there is more than one, they won't work right.
506 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
509 (put 'upcase-region 'disabled nil)
510 (put 'downcase-region 'disabled nil)
511 (put 'narrow-to-region 'disabled nil)
514 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
515 (add-hook 'message-mode-hook 'turn-on-flyspell)
516 (add-hook 'text-mode-hook 'turn-on-flyspell)
517 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
518 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
519 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
520 ; (defun turn-on-flyspell ()
521 ; "Force flyspell-mode on using a positive arg. For use in hooks."
526 ; Outline-minor-mode key map
527 (define-prefix-command 'cm-map nil "Outline-")
529 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
530 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
531 (define-key cm-map "o" 'hide-other) ; Hide other branches
532 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
533 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
534 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
536 (define-key cm-map "a" 'show-all) ; Show (expand) everything
537 (define-key cm-map "e" 'show-entry) ; Show this heading's body
538 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
539 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
540 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
542 (define-key cm-map "u" 'outline-up-heading) ; Up
543 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
544 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
545 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
546 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
547 (global-set-key "\M-o" cm-map)
551 (setq-default debian-changelog-mailing-address "don@debian.org")
552 (setq-default debian-changelog-full-name "Don Armstrong")
554 ; ediff configuration
555 ; don't use the multi-window configuration
556 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
560 (define-key global-map (kbd "C-;") 'iedit-mode)
561 (global-set-key (kbd "C-;") 'iedit-mode)
563 ; fix up css mode to not be silly
564 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
565 (setq cssm-indent-level 4)
566 (setq cssm-newline-before-closing-bracket t)
567 (setq cssm-indent-function #'cssm-c-style-indenter)
568 (setq cssm-mirror-mode nil)
570 (require 'multi-web-mode)
571 (setq mweb-default-major-mode 'html-mode)
572 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
573 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
574 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
575 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
576 (multi-web-global-mode 1)
578 ;;; alias the new `flymake-report-status-slim' to
579 ;;; `flymake-report-status'
580 (defalias 'flymake-report-status 'flymake-report-status-slim)
581 (defun flymake-report-status-slim (e-w &optional status)
582 "Show \"slim\" flymake status in mode line."
584 (setq flymake-mode-line-e-w e-w))
586 (setq flymake-mode-line-status status))
587 (let* ((mode-line " Φ"))
588 (when (> (length flymake-mode-line-e-w) 0)
589 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
590 (setq mode-line (concat mode-line flymake-mode-line-status))
591 (setq flymake-mode-line mode-line)
592 (force-mode-line-update)))
594 ; load sql-indent when sql is loaded
595 (eval-after-load "sql"
596 '(load-library "sql-indent"))
598 ; fix up tmux xterm keys
599 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
602 (let ((x 2) (tkey ""))
622 ;; ctrl + alt + shift
624 (setq tkey "C-M-S-"))
627 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
628 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
629 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
630 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
632 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
634 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
636 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
638 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
640 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
642 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
644 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
646 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
648 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
650 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
652 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
654 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
656 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
658 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
660 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
662 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
664 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
666 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
668 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
670 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
672 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
674 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
676 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
678 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
680 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
682 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
689 ; procmailmode configuration
690 (load "procmail_mode")
692 (load "mode-line-cleaner")
694 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
695 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
696 (if (or (buffer-modified-p)
697 (verify-visited-file-modtime)
698 (< (* 8 1024 1024) (buffer-size))
699 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
701 (clear-visited-file-modtime)
703 (ad-activate 'ask-user-about-supersession-threat)
705 ; apparently things like to step on C-;, so we'll use a hack from
706 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
708 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
710 ; use iedit everywhere
711 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
713 (define-minor-mode my-keys-minor-mode
714 "A minor mode so that my key settings override annoying major modes."
715 t " my-keys" 'my-keys-minor-mode-map)
717 (my-keys-minor-mode 1)
718 (defun my-minibuffer-setup-hook ()
719 (my-keys-minor-mode 0))
721 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
722 (defadvice load (after give-my-keybindings-priority)
723 "Try to ensure that my keybindings always have priority."
724 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
725 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
726 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
727 (add-to-list 'minor-mode-map-alist mykeys))))
729 (global-set-key "\M- " 'hippie-expand)
734 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
735 (provide 'don-configuration)