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)
56 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
58 ;; Use c-mode for perl .xs files
59 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
60 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
61 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
62 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
63 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
66 cperl-auto-newline nil
67 cperl-auto-newline-after-colon nil
68 cperl-continued-statement-offset 4
70 cperl-continued-brace-offset 0
72 cperl-highlight-variables-indiscriminately t
73 cperl-electric-lbrace-space nil
74 cperl-indent-parens-as-block nil
75 cperl-close-paren-offset -1
76 cperl-tab-always-indent t)
77 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
81 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
85 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
90 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
91 (add-to-list 'tramp-methods '("vcsh"
92 (tramp-login-program "vcsh")
96 (tramp-remote-shell "/bin/sh")
97 (tramp-remote-shell-args
101 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
102 (load "auctex.el" nil t t)
103 (load "preview-latex.el" nil t t)
104 (load "latex.el" nil t t)
106 ;; this is in the very newest auctex; avoid for now
107 (add-to-list 'LaTeX-fill-excluded-macros
109 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
110 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
111 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
112 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
113 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
114 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
115 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
116 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
117 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
118 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
120 ; use smart quotes by default instead of `` and ''
121 ; taken from http://kieranhealy.org/esk/kjhealy.html
122 (setq TeX-open-quote "“")
123 (setq TeX-close-quote "”")
125 ;; (TeX-add-style-hook
130 ;; (custom-set-variables
131 ;; '(font-latex-user-keyword-classes
134 ;; font-lock-function-name-face 2 (command 1 t))))
137 (require 'font-latex)
138 (setq font-latex-match-reference-keywords
154 ; (setq font-latex-match-warning-keywords
162 (setq-default TeX-parse-self t)
163 (setq-default TeX-auto-save t)
164 (setq-default TeX-master nil)
170 (if (boundp 'reftex-ref-style-alist)
172 'reftex-ref-style-alist
173 '("Cleveref" "cleveref"
174 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
175 (reftex-ref-style-activate "Cleveref")
177 '("cref" TeX-arg-ref)
178 '("Cref" TeX-arg-ref)
179 '("cpageref" TeX-arg-ref)
180 '("Cpageref" TeX-arg-ref)))))
181 ;; this doesn't seem to work; not currently sure why
182 ; (setq font-latex-user-keyword-classes
183 ; '(("my-warning-commands"
190 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
193 (setq-default reftex-default-bibliography
194 '("~/projects/research/references.bib"))
199 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
200 (require 'org-mode-configuration)
203 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
204 (require 'ess_configuration)
209 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
211 (append '("~/lib/emacs_el/polymode/modes")
215 (require 'poly-noweb)
216 (require 'poly-markdown)
217 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
218 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
219 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
223 ** Override other things
224 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
225 ; apparently things like to step on C-;, so we'll use a hack from
226 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
228 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
230 ; use iedit everywhere
231 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
232 ;; use outline mode keybindings everywhere
233 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
235 (define-minor-mode my-keys-minor-mode
236 "A minor mode so that my key settings override annoying major modes."
237 t " my-keys" 'my-keys-minor-mode-map)
239 (my-keys-minor-mode 1)
240 (defun my-minibuffer-setup-hook ()
241 (my-keys-minor-mode 0))
243 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
244 (defadvice load (after give-my-keybindings-priority)
245 "Try to ensure that my keybindings always have priority."
246 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
247 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
248 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
249 (add-to-list 'minor-mode-map-alist mykeys))))
253 * Misc (uncharacterized)
254 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
255 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
256 (setq calendar-latitude 40.11)
257 (setq calendar-longitude -88.24)
258 (setq case-fold-search t)
259 (setq confirm-kill-emacs (quote y-or-n-p))
260 (setq cperl-lazy-help-time nil)
261 (setq debian-changelog-mailing-address "don@debian.org")
263 (setq display-time-24hr-format t)
264 (setq display-time-day-and-date t)
265 (display-time-mode 1)
266 (setq font-latex-fontify-script nil)
267 (setq font-latex-fontify-sectioning (quote color))
268 (setq font-latex-script-display (quote (nil)))
269 (global-auto-revert-mode 1)
270 (global-font-lock-mode 1)
272 (setq log-edit-keep-buffer t)
273 (setq mail-user-agent (quote sendmail-user-agent))
274 (setq markdown-enable-math t)
275 (setq markdown-follow-wiki-link-on-enter nil)
276 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
277 (setq post-email-address "don@donarmstrong.com")
278 (setq post-kill-quoted-sig nil)
279 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
280 (setq post-uses-fill-mode nil)
281 (setq ps-footer-font-size (quote (8 . 10)))
282 (setq ps-header-font-size (quote (8 . 10)))
283 (setq ps-header-title-font-size (quote (10 . 10)))
284 (setq ps-line-number-color "blue")
285 (setq ps-print-footer t)
286 (setq ps-print-footer-frame nil)
287 (setq ps-print-only-one-header t)
288 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
289 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
291 (setq sentence-end-double-space nil)
292 ; enable matching parenthesis
295 (setq user-mail-address "don@donarmstrong.com")
296 (setq vc-delete-logbuf-window nil)
297 (setq vc-follow-symlinks t)
299 ;; use git before SVN; use CVS earlier, because I have CVS
300 ;; repositories inside of git directories
301 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
303 ;; switch back to the old primary selection method
304 (setq x-select-enable-clipboard nil)
305 (setq x-select-enable-primary t)
306 ; (setq mouse-drag-copy-region t)
308 (fset 'perl-mode 'cperl-mode)
309 ;;(load-file "cperl-mode.el")
315 ;;(require 'ecasound)
316 ;;(require 'emacs-wiki)
320 ; (require 'google-weather)
321 ; (require 'org-google-weather)
322 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
324 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
325 ; this colorizes color strings
326 (require 'rainbow-mode)
327 ; add ess to the x major mode
328 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
329 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
331 (global-set-key "\C-xp" 'server-edit)
333 (setq-default auto-mode-alist (cons '("\.wml$" .
334 (lambda () (html-mode) (auto-fill-mode)))
338 ; use markdown mode for mdwn files
339 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
340 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
343 ;; tramp configuration
344 (setq tramp-use-ssh-controlmaster-options nil)
347 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
348 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
350 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
351 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
352 (defun my-message-mode-settings ()
353 (font-lock-add-keywords nil
354 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
355 (0 'message-multiply-quoted-text-face))
356 ("^[ \t]*>[ \t]*>.*$"
357 (0 'message-double-quoted-text-face))))
358 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
360 (add-hook 'message-mode-hook 'my-message-mode-settings)
362 (defun my-post-attach-file ()
363 "Prompt for an attachment."
365 (let ((file (read-file-name "Attach file: " nil nil t nil))
366 (description (string-read "Description: ")))
367 (my-header-attach-file file description)))
369 (symbol-function 'my-post-attach-file)
371 (defun my-header-attach-file (file description)
372 "Attach a FILE to the current message (works with Mutt).
373 Argument DESCRIPTION MIME description."
374 (interactive "fAttach file: \nsDescription: ")
375 (when (> (length file) 0)
380 (goto-char (point-min))
381 (search-forward-regexp "^$")
382 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
384 (message (concat "Attached '" file "'."))
385 (setq post-has-attachment t))))))
389 (setq mail-yank-prefix "> ")
391 (global-unset-key "\M-g")
392 (global-set-key "\M-g" 'goto-line)
394 ;; self-insert-command hack.
395 ;; Without this, "if<SP>" expands to
398 ;; which really should be,
404 ;(load-library "php-mode")
406 (setq-default c-indent-level 4)
407 (setq-default c-brace-imaginary-offset 0)
408 (setq-default c-brace-offset -4)
409 (setq-default c-argdecl-indent 4)
410 (setq-default c-label-offset -4)
411 (setq-default c-continued-statement-offset 4)
413 (setq-default indent-tabs-mode nil)
414 (setq-default tab-width 4)
417 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
418 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
419 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
420 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
421 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
424 (defun insert-date ()
425 "Insert date at point."
427 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
428 (global-set-key "\C-[d" 'insert-date)
430 (defun unfill-paragraph (arg)
431 "Pull this whole paragraph up onto one line."
433 (let ((fill-column 10000))
434 (fill-paragraph arg))
437 (column-number-mode t)
438 (setq-default reftex-plug-into-AUCTeX t)
442 ; (require 'mode-compile)
444 (defadvice server-process-filter (after post-mode-message first activate)
445 "If the buffer is in post mode, overwrite the server-edit
446 message with a post-save-current-buffer-and-exit message."
447 (if (eq major-mode 'post-mode)
449 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
450 ; This is also needed to see the magic message. Set to a higher
451 ; number if you have a faster computer or read slower than me.
452 '(font-lock-verbose 1000)
453 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
454 ; (add-hook 'server-switch-hook
455 ; (function (lambda()
456 ; (cond ((string-match "Post" mode-name)
458 ; set-buffer-file-coding-system 'utf-8
462 (add-hook 'post-mode-hook
465 ; abbrev mode settings
466 ; load abbreviations from
467 (setq abbrev-file-name
468 "~/.emacs_abbrev_def")
470 ; read the abbrev file if it exists
471 (if (file-exists-p abbrev-file-name)
472 (quietly-read-abbrev-file))
474 ; for now, use abbrev mode everywhere
475 (setq default-abbrev-mode t)
478 (defun insert-function-documentation ()
479 "Insert function documentation"
481 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
482 (global-set-key "\M-f" 'insert-function-documentation)
484 (eval-after-load "lilypond-mode"
486 (load-library "lyqi-mode")
487 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
489 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
491 (desktop-load-default)
495 ;; custom-set-faces was added by Custom.
496 ;; If you edit it by hand, you could mess it up, so be careful.
497 ;; Your init file should contain only one such instance.
498 ;; If there is more than one, they won't work right.
499 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
502 (put 'upcase-region 'disabled nil)
503 (put 'downcase-region 'disabled nil)
504 (put 'narrow-to-region 'disabled nil)
507 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
508 (add-hook 'message-mode-hook 'turn-on-flyspell)
509 (add-hook 'text-mode-hook 'turn-on-flyspell)
510 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
511 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
512 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
513 ; (defun turn-on-flyspell ()
514 ; "Force flyspell-mode on using a positive arg. For use in hooks."
519 ; Outline-minor-mode key map
520 (define-prefix-command 'cm-map nil "Outline-")
522 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
523 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
524 (define-key cm-map "o" 'hide-other) ; Hide other branches
525 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
526 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
527 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
529 (define-key cm-map "a" 'show-all) ; Show (expand) everything
530 (define-key cm-map "e" 'show-entry) ; Show this heading's body
531 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
532 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
533 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
535 (define-key cm-map "u" 'outline-up-heading) ; Up
536 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
537 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
538 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
539 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
540 (global-set-key "\M-o" cm-map)
544 (setq-default debian-changelog-mailing-address "don@debian.org")
545 (setq-default debian-changelog-full-name "Don Armstrong")
547 ; ediff configuration
548 ; don't use the multi-window configuration
549 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
553 (define-key global-map (kbd "C-;") 'iedit-mode)
554 (global-set-key (kbd "C-;") 'iedit-mode)
556 ; fix up css mode to not be silly
557 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
558 (setq cssm-indent-level 4)
559 (setq cssm-newline-before-closing-bracket t)
560 (setq cssm-indent-function #'cssm-c-style-indenter)
561 (setq cssm-mirror-mode nil)
563 (require 'multi-web-mode)
564 (setq mweb-default-major-mode 'html-mode)
565 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
566 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
567 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
568 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
569 (multi-web-global-mode 1)
571 ;;; alias the new `flymake-report-status-slim' to
572 ;;; `flymake-report-status'
573 (defalias 'flymake-report-status 'flymake-report-status-slim)
574 (defun flymake-report-status-slim (e-w &optional status)
575 "Show \"slim\" flymake status in mode line."
577 (setq flymake-mode-line-e-w e-w))
579 (setq flymake-mode-line-status status))
580 (let* ((mode-line " Φ"))
581 (when (> (length flymake-mode-line-e-w) 0)
582 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
583 (setq mode-line (concat mode-line flymake-mode-line-status))
584 (setq flymake-mode-line mode-line)
585 (force-mode-line-update)))
587 ; load sql-indent when sql is loaded
588 (eval-after-load "sql"
589 '(load-library "sql-indent"))
591 ; fix up tmux xterm keys
592 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
595 (let ((x 2) (tkey ""))
615 ;; ctrl + alt + shift
617 (setq tkey "C-M-S-"))
620 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
621 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
622 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
623 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
625 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
627 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
629 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
631 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
633 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
635 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
637 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
639 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
641 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
643 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
645 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
647 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
649 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
651 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
653 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
655 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
657 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
659 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
661 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
663 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
665 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
667 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
669 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
671 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
673 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
675 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
682 ; procmailmode configuration
683 (load "procmail_mode")
685 (load "mode-line-cleaner")
687 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
688 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
689 (if (or (buffer-modified-p)
690 (verify-visited-file-modtime)
691 (< (* 8 1024 1024) (buffer-size))
692 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
694 (clear-visited-file-modtime)
696 (ad-activate 'ask-user-about-supersession-threat)
698 ; apparently things like to step on C-;, so we'll use a hack from
699 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
701 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
703 ; use iedit everywhere
704 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
706 (define-minor-mode my-keys-minor-mode
707 "A minor mode so that my key settings override annoying major modes."
708 t " my-keys" 'my-keys-minor-mode-map)
710 (my-keys-minor-mode 1)
711 (defun my-minibuffer-setup-hook ()
712 (my-keys-minor-mode 0))
714 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
715 (defadvice load (after give-my-keybindings-priority)
716 "Try to ensure that my keybindings always have priority."
717 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
718 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
719 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
720 (add-to-list 'minor-mode-map-alist mykeys))))
722 (global-set-key "\M- " 'hippie-expand)
727 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
728 (provide 'don-configuration)