1 #+PROPERTY: header-args:emacs-lisp :tangle don-configuration.el
4 # if for some reason, things get pear-shaped, we want to be able to
5 # enter the debugger by sending -USR2 to emacs
8 (setq debug-on-event 'siguser2)
12 #+BEGIN_SRC emacs-lisp
13 (add-to-list 'load-path '"~/lib/emacs_el/")
14 (add-to-list 'load-path '"~/lib/emacs_el/helm")
15 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/tiny")
16 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/other")
17 (add-to-list 'load-path '"~/lib/emacs_el/auctex/lisp")
18 (add-to-list 'load-path '"~/lib/emacs_el/auctex")
19 (add-to-list 'load-path '"~/lib/emacs_el/ESS/lisp")
20 (add-to-list 'load-path '"~/lib/emacs_el/org-mode/lisp")
21 (add-to-list 'load-path '"~/lib/emacs_el/auctex-beamer")
22 (add-to-list 'load-path '"~/lib/emacs_el/magit-annex")
23 (add-to-list 'load-path '"~/lib/emacs_el/polymode")
29 #+BEGIN_SRC emacs-lisp
30 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
31 ;; execute conditional code when loading libraries
32 (defmacro with-library (symbol &rest body)
33 `(when (require ,symbol nil t)
35 (put 'with-library 'lisp-indent-function 1)
43 #+BEGIN_SRC emacs-lisp
45 (with-library 'tinyprocmail
46 ; (setq tinyprocmail--procmail-version "v3.22")
47 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
51 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
52 ; don't verify where we are pushing
53 (setq magit-push-always-verify nil)
54 ;; refine diffs always (hilight words)
55 (setq magit-diff-refine-hunk 'all)
58 (append '("~/lib/emacs_el/magit-annex")
60 (require 'magit-annex)
64 #+BEGIN_SRC emacs-lisp
66 ;; Use c-mode for perl .xs files
67 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
68 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
69 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
70 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
71 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
74 cperl-auto-newline nil
75 cperl-auto-newline-after-colon nil
76 cperl-continued-statement-offset 4
78 cperl-continued-brace-offset 0
80 cperl-highlight-variables-indiscriminately t
81 cperl-electric-lbrace-space nil
82 cperl-indent-parens-as-block nil
83 cperl-close-paren-offset -1
84 cperl-tab-always-indent t)
85 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
89 #+BEGIN_SRC emacs-lisp
93 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
98 #+BEGIN_SRC emacs-lisp
99 (add-to-list 'tramp-methods '("vcsh"
100 (tramp-login-program "vcsh")
104 (tramp-remote-shell "/bin/sh")
105 (tramp-remote-shell-args
109 #+BEGIN_SRC emacs-lisp
110 (load "auctex.el" nil t t)
111 (load "preview-latex.el" nil t t)
112 (load "latex.el" nil t t)
114 ;; this is in the very newest auctex; avoid for now
115 (add-to-list 'LaTeX-fill-excluded-macros
117 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
118 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
119 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
120 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
121 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
122 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
123 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
124 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
125 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
126 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
128 ; use smart quotes by default instead of `` and ''
129 ; taken from http://kieranhealy.org/esk/kjhealy.html
130 (setq TeX-open-quote "“")
131 (setq TeX-close-quote "”")
133 ;; (TeX-add-style-hook
138 ;; (custom-set-variables
139 ;; '(font-latex-user-keyword-classes
142 ;; font-lock-function-name-face 2 (command 1 t))))
145 (require 'font-latex)
146 (setq font-latex-match-reference-keywords
162 ; (setq font-latex-match-warning-keywords
170 (setq-default TeX-parse-self t)
171 (setq-default TeX-auto-save t)
172 (setq-default TeX-master nil)
178 (if (boundp 'reftex-ref-style-alist)
180 'reftex-ref-style-alist
181 '("Cleveref" "cleveref"
182 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
183 (reftex-ref-style-activate "Cleveref")
185 '("cref" TeX-arg-ref)
186 '("Cref" TeX-arg-ref)
187 '("cpageref" TeX-arg-ref)
188 '("Cpageref" TeX-arg-ref)))))
189 ;; this doesn't seem to work; not currently sure why
190 ; (setq font-latex-user-keyword-classes
191 ; '(("my-warning-commands"
198 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
201 (setq-default reftex-default-bibliography
202 '("~/projects/research/references.bib"))
207 #+BEGIN_SRC emacs-lisp
208 (require 'org-mode-configuration)
211 #+BEGIN_SRC emacs-lisp
212 (require 'ess_configuration)
217 #+BEGIN_SRC emacs-lisp
219 (append '("~/lib/emacs_el/polymode/modes")
223 (require 'poly-noweb)
224 (require 'poly-markdown)
225 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
226 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
227 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
231 ** Override other things
232 #+BEGIN_SRC emacs-lisp
233 ; apparently things like to step on C-;, so we'll use a hack from
234 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
236 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
238 ; use iedit everywhere
239 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
240 ;; use outline mode keybindings everywhere
241 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
243 (define-minor-mode my-keys-minor-mode
244 "A minor mode so that my key settings override annoying major modes."
245 t " my-keys" 'my-keys-minor-mode-map)
247 (my-keys-minor-mode 1)
248 (defun my-minibuffer-setup-hook ()
249 (my-keys-minor-mode 0))
251 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
252 (defadvice load (after give-my-keybindings-priority)
253 "Try to ensure that my keybindings always have priority."
254 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
255 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
256 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
257 (add-to-list 'minor-mode-map-alist mykeys))))
261 * Misc (uncharacterized)
262 #+BEGIN_SRC emacs-lisp
263 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
264 (setq calendar-latitude 40.11)
265 (setq calendar-longitude -88.24)
266 (setq case-fold-search t)
267 (setq confirm-kill-emacs (quote y-or-n-p))
268 (setq cperl-lazy-help-time nil)
269 (setq debian-changelog-mailing-address "don@debian.org")
271 (setq display-time-24hr-format t)
272 (setq display-time-day-and-date t)
273 (display-time-mode 1)
274 (setq font-latex-fontify-script nil)
275 (setq font-latex-fontify-sectioning (quote color))
276 (setq font-latex-script-display (quote (nil)))
277 (global-auto-revert-mode 1)
278 (global-font-lock-mode 1)
280 (setq log-edit-keep-buffer t)
281 (setq mail-user-agent (quote sendmail-user-agent))
282 (setq markdown-enable-math t)
283 (setq markdown-follow-wiki-link-on-enter nil)
284 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
285 (setq post-email-address "don@donarmstrong.com")
286 (setq post-kill-quoted-sig nil)
287 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
288 (setq post-uses-fill-mode nil)
289 (setq ps-footer-font-size (quote (8 . 10)))
290 (setq ps-header-font-size (quote (8 . 10)))
291 (setq ps-header-title-font-size (quote (10 . 10)))
292 (setq ps-line-number-color "blue")
293 (setq ps-print-footer t)
294 (setq ps-print-footer-frame nil)
295 (setq ps-print-only-one-header t)
296 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
297 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
299 (setq sentence-end-double-space nil)
300 ; enable matching parenthesis
303 (setq user-mail-address "don@donarmstrong.com")
304 (setq vc-delete-logbuf-window nil)
305 (setq vc-follow-symlinks t)
307 ;; use git before SVN; use CVS earlier, because I have CVS
308 ;; repositories inside of git directories
309 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
311 ;; switch back to the old primary selection method
312 (setq x-select-enable-clipboard nil)
313 (setq x-select-enable-primary t)
314 ; (setq mouse-drag-copy-region t)
316 (fset 'perl-mode 'cperl-mode)
317 ;;(load-file "cperl-mode.el")
323 ;;(require 'ecasound)
324 ;;(require 'emacs-wiki)
328 ; (require 'google-weather)
329 ; (require 'org-google-weather)
330 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
332 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
333 ; this colorizes color strings
334 (require 'rainbow-mode)
335 ; add ess to the x major mode
336 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
337 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
339 (global-set-key "\C-xp" 'server-edit)
341 (setq-default auto-mode-alist (cons '("\.wml$" .
342 (lambda () (html-mode) (auto-fill-mode)))
346 ; use markdown mode for mdwn files
347 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
348 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
351 ;; tramp configuration
352 (setq tramp-use-ssh-controlmaster-options nil)
355 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
356 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
358 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
359 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
360 (defun my-message-mode-settings ()
361 (font-lock-add-keywords nil
362 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
363 (0 'message-multiply-quoted-text-face))
364 ("^[ \t]*>[ \t]*>.*$"
365 (0 'message-double-quoted-text-face))))
366 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
368 (add-hook 'message-mode-hook 'my-message-mode-settings)
370 (defun my-post-attach-file ()
371 "Prompt for an attachment."
373 (let ((file (read-file-name "Attach file: " nil nil t nil))
374 (description (string-read "Description: ")))
375 (my-header-attach-file file description)))
377 (symbol-function 'my-post-attach-file)
379 (defun my-header-attach-file (file description)
380 "Attach a FILE to the current message (works with Mutt).
381 Argument DESCRIPTION MIME description."
382 (interactive "fAttach file: \nsDescription: ")
383 (when (> (length file) 0)
388 (goto-char (point-min))
389 (search-forward-regexp "^$")
390 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
392 (message (concat "Attached '" file "'."))
393 (setq post-has-attachment t))))))
397 (setq mail-yank-prefix "> ")
399 (global-unset-key "\M-g")
400 (global-set-key "\M-g" 'goto-line)
402 ;; self-insert-command hack.
403 ;; Without this, "if<SP>" expands to
406 ;; which really should be,
412 ;(load-library "php-mode")
414 (setq-default c-indent-level 4)
415 (setq-default c-brace-imaginary-offset 0)
416 (setq-default c-brace-offset -4)
417 (setq-default c-argdecl-indent 4)
418 (setq-default c-label-offset -4)
419 (setq-default c-continued-statement-offset 4)
421 (setq-default indent-tabs-mode nil)
422 (setq-default tab-width 4)
425 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
426 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
427 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
428 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
429 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
432 (defun insert-date ()
433 "Insert date at point."
435 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
436 (global-set-key "\C-[d" 'insert-date)
438 (defun unfill-paragraph (arg)
439 "Pull this whole paragraph up onto one line."
441 (let ((fill-column 10000))
442 (fill-paragraph arg))
445 (column-number-mode t)
446 (setq-default reftex-plug-into-AUCTeX t)
450 ; (require 'mode-compile)
452 (defadvice server-process-filter (after post-mode-message first activate)
453 "If the buffer is in post mode, overwrite the server-edit
454 message with a post-save-current-buffer-and-exit message."
455 (if (eq major-mode 'post-mode)
457 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
458 ; This is also needed to see the magic message. Set to a higher
459 ; number if you have a faster computer or read slower than me.
460 '(font-lock-verbose 1000)
461 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
462 ; (add-hook 'server-switch-hook
463 ; (function (lambda()
464 ; (cond ((string-match "Post" mode-name)
466 ; set-buffer-file-coding-system 'utf-8
470 (add-hook 'post-mode-hook
473 ; abbrev mode settings
474 ; load abbreviations from
475 (setq abbrev-file-name
476 "~/.emacs_abbrev_def")
478 ; read the abbrev file if it exists
479 (if (file-exists-p abbrev-file-name)
480 (quietly-read-abbrev-file))
482 ; for now, use abbrev mode everywhere
483 (setq default-abbrev-mode t)
486 (defun insert-function-documentation ()
487 "Insert function documentation"
489 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
490 (global-set-key "\M-f" 'insert-function-documentation)
492 (eval-after-load "lilypond-mode"
494 (load-library "lyqi-mode")
495 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
497 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
499 (desktop-load-default)
503 ;; custom-set-faces was added by Custom.
504 ;; If you edit it by hand, you could mess it up, so be careful.
505 ;; Your init file should contain only one such instance.
506 ;; If there is more than one, they won't work right.
507 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
510 (put 'upcase-region 'disabled nil)
511 (put 'downcase-region 'disabled nil)
512 (put 'narrow-to-region 'disabled nil)
515 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
516 (add-hook 'message-mode-hook 'turn-on-flyspell)
517 (add-hook 'text-mode-hook 'turn-on-flyspell)
518 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
519 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
520 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
521 ; (defun turn-on-flyspell ()
522 ; "Force flyspell-mode on using a positive arg. For use in hooks."
527 ; Outline-minor-mode key map
528 (define-prefix-command 'cm-map nil "Outline-")
530 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
531 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
532 (define-key cm-map "o" 'hide-other) ; Hide other branches
533 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
534 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
535 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
537 (define-key cm-map "a" 'show-all) ; Show (expand) everything
538 (define-key cm-map "e" 'show-entry) ; Show this heading's body
539 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
540 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
541 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
543 (define-key cm-map "u" 'outline-up-heading) ; Up
544 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
545 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
546 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
547 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
548 (global-set-key "\M-o" cm-map)
552 (setq-default debian-changelog-mailing-address "don@debian.org")
553 (setq-default debian-changelog-full-name "Don Armstrong")
555 ; ediff configuration
556 ; don't use the multi-window configuration
557 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
561 (define-key global-map (kbd "C-;") 'iedit-mode)
562 (global-set-key (kbd "C-;") 'iedit-mode)
564 ; fix up css mode to not be silly
565 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
566 (setq cssm-indent-level 4)
567 (setq cssm-newline-before-closing-bracket t)
568 (setq cssm-indent-function #'cssm-c-style-indenter)
569 (setq cssm-mirror-mode nil)
571 (require 'multi-web-mode)
572 (setq mweb-default-major-mode 'html-mode)
573 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
574 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
575 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
576 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
577 (multi-web-global-mode 1)
579 ;;; alias the new `flymake-report-status-slim' to
580 ;;; `flymake-report-status'
581 (defalias 'flymake-report-status 'flymake-report-status-slim)
582 (defun flymake-report-status-slim (e-w &optional status)
583 "Show \"slim\" flymake status in mode line."
585 (setq flymake-mode-line-e-w e-w))
587 (setq flymake-mode-line-status status))
588 (let* ((mode-line " Φ"))
589 (when (> (length flymake-mode-line-e-w) 0)
590 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
591 (setq mode-line (concat mode-line flymake-mode-line-status))
592 (setq flymake-mode-line mode-line)
593 (force-mode-line-update)))
595 ; load sql-indent when sql is loaded
596 (eval-after-load "sql"
597 '(load-library "sql-indent"))
599 ; fix up tmux xterm keys
600 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
603 (let ((x 2) (tkey ""))
623 ;; ctrl + alt + shift
625 (setq tkey "C-M-S-"))
628 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
629 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
630 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
631 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
633 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
635 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
637 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
639 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
641 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
643 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
645 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
647 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
649 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
651 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
653 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
655 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
657 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
659 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
661 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
663 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
665 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
667 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
669 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
671 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
673 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
675 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
677 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
679 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
681 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
683 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
690 ; procmailmode configuration
691 (load "procmail_mode")
693 (load "mode-line-cleaner")
695 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
696 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
697 (if (or (buffer-modified-p)
698 (verify-visited-file-modtime)
699 (< (* 8 1024 1024) (buffer-size))
700 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
702 (clear-visited-file-modtime)
704 (ad-activate 'ask-user-about-supersession-threat)
706 ; apparently things like to step on C-;, so we'll use a hack from
707 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
709 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
711 ; use iedit everywhere
712 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
714 (define-minor-mode my-keys-minor-mode
715 "A minor mode so that my key settings override annoying major modes."
716 t " my-keys" 'my-keys-minor-mode-map)
718 (my-keys-minor-mode 1)
719 (defun my-minibuffer-setup-hook ()
720 (my-keys-minor-mode 0))
722 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
723 (defadvice load (after give-my-keybindings-priority)
724 "Try to ensure that my keybindings always have priority."
725 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
726 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
727 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
728 (add-to-list 'minor-mode-map-alist mykeys))))
730 (global-set-key "\M- " 'hippie-expand)
735 #+BEGIN_SRC emacs-lisp
736 (provide 'don-configuration)