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")
27 ** package repositories and package manager
28 #+BEGIN_SRC emacs-lisp
29 (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
30 ("melpa" . "https://melpa.org/packages/")
31 ("org" . "http://orgmode.org/elpa/") ))
34 ** [[https://github.com/jwiegley/use-package/][use-package]]
35 #+BEGIN_SRC emacs-lisp
36 (require 'use-package)
41 #+BEGIN_SRC emacs-lisp
42 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
43 ;; execute conditional code when loading libraries
44 (defmacro with-library (symbol &rest body)
45 `(when (require ,symbol nil t)
47 (put 'with-library 'lisp-indent-function 1)
52 #+BEGIN_SRC emacs-lisp
53 (setq global-mark-ring-max 128
57 (defun don/minibuffer-setup-hook ()
58 (setq gc-cons-threshold most-positive-fixnum))
60 (defun don/minibuffer-exit-hook ()
61 (setq gc-cons-threshold 1048576))
63 (add-hook 'minibuffer-setup-hook #'don/minibuffer-setup-hook)
64 (add-hook 'minibuffer-exit-hook #'don/minibuffer-exit-hook)
69 #+BEGIN_SRC emacs-lisp
71 (with-library 'tinyprocmail
72 ; (setq tinyprocmail--procmail-version "v3.22")
73 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
77 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
78 ; don't verify where we are pushing
79 (setq magit-push-always-verify nil)
80 ;; refine diffs always (hilight words)
81 (setq magit-diff-refine-hunk 'all)
84 (append '("~/lib/emacs_el/magit-annex")
86 (require 'magit-annex)
90 #+BEGIN_SRC emacs-lisp
92 ;; Use c-mode for perl .xs files
93 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
94 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
95 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
96 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
97 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
100 cperl-auto-newline nil
101 cperl-auto-newline-after-colon nil
102 cperl-continued-statement-offset 4
103 cperl-brace-offset -1
104 cperl-continued-brace-offset 0
105 cperl-label-offset -4
106 cperl-highlight-variables-indiscriminately t
107 cperl-electric-lbrace-space nil
108 cperl-indent-parens-as-block nil
109 cperl-close-paren-offset -1
110 cperl-tab-always-indent t)
111 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
115 #+BEGIN_SRC emacs-lisp
119 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
124 #+BEGIN_SRC emacs-lisp
125 (add-to-list 'tramp-methods '("vcsh"
126 (tramp-login-program "vcsh")
130 (tramp-remote-shell "/bin/sh")
131 (tramp-remote-shell-args
135 #+BEGIN_SRC emacs-lisp
136 (load "auctex.el" nil t t)
137 (load "preview-latex.el" nil t t)
138 (load "latex.el" nil t t)
140 ;; this is in the very newest auctex; avoid for now
141 (add-to-list 'LaTeX-fill-excluded-macros
143 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
144 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
145 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
146 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
147 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
148 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
149 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
150 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
151 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
152 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
154 ; use smart quotes by default instead of `` and ''
155 ; taken from http://kieranhealy.org/esk/kjhealy.html
156 (setq TeX-open-quote "“")
157 (setq TeX-close-quote "”")
159 ;; (TeX-add-style-hook
164 ;; (custom-set-variables
165 ;; '(font-latex-user-keyword-classes
168 ;; font-lock-function-name-face 2 (command 1 t))))
171 (require 'font-latex)
172 (setq font-latex-match-reference-keywords
188 ; (setq font-latex-match-warning-keywords
196 (setq-default TeX-parse-self t)
197 (setq-default TeX-auto-save t)
198 (setq-default TeX-master nil)
204 (if (boundp 'reftex-ref-style-alist)
206 'reftex-ref-style-alist
207 '("Cleveref" "cleveref"
208 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
209 (reftex-ref-style-activate "Cleveref")
211 '("cref" TeX-arg-ref)
212 '("Cref" TeX-arg-ref)
213 '("cpageref" TeX-arg-ref)
214 '("Cpageref" TeX-arg-ref)))))
215 ;; this doesn't seem to work; not currently sure why
216 ; (setq font-latex-user-keyword-classes
217 ; '(("my-warning-commands"
224 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
227 (setq-default reftex-default-bibliography
228 '("~/projects/research/references.bib"))
233 #+BEGIN_SRC emacs-lisp
234 (require 'org-mode-configuration)
237 #+BEGIN_SRC emacs-lisp
238 (require 'ess_configuration)
243 #+BEGIN_SRC emacs-lisp
245 (append '("~/lib/emacs_el/polymode/modes")
249 (require 'poly-noweb)
250 (require 'poly-markdown)
251 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
252 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
253 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
257 ** Override other things
258 #+BEGIN_SRC emacs-lisp
259 ; apparently things like to step on C-;, so we'll use a hack from
260 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
262 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
264 ; use iedit everywhere
265 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
266 ;; use outline mode keybindings everywhere
267 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
269 (define-minor-mode my-keys-minor-mode
270 "A minor mode so that my key settings override annoying major modes."
271 t " my-keys" 'my-keys-minor-mode-map)
273 (my-keys-minor-mode 1)
274 (defun my-minibuffer-setup-hook ()
275 (my-keys-minor-mode 0))
277 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
278 (defadvice load (after give-my-keybindings-priority)
279 "Try to ensure that my keybindings always have priority."
280 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
281 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
282 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
283 (add-to-list 'minor-mode-map-alist mykeys))))
287 * Misc (uncharacterized)
288 #+BEGIN_SRC emacs-lisp
289 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
290 (setq calendar-latitude 40.11)
291 (setq calendar-longitude -88.24)
292 (setq case-fold-search t)
293 (setq confirm-kill-emacs (quote y-or-n-p))
294 (setq cperl-lazy-help-time nil)
295 (setq debian-changelog-mailing-address "don@debian.org")
297 (setq display-time-24hr-format t)
298 (setq display-time-day-and-date t)
299 (display-time-mode 1)
300 (setq font-latex-fontify-script nil)
301 (setq font-latex-fontify-sectioning (quote color))
302 (setq font-latex-script-display (quote (nil)))
303 (global-auto-revert-mode 1)
304 (global-font-lock-mode 1)
306 (setq log-edit-keep-buffer t)
307 (setq mail-user-agent (quote sendmail-user-agent))
308 (setq markdown-enable-math t)
309 (setq markdown-follow-wiki-link-on-enter nil)
310 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
311 (setq post-email-address "don@donarmstrong.com")
312 (setq post-kill-quoted-sig nil)
313 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
314 (setq post-uses-fill-mode nil)
315 (setq ps-footer-font-size (quote (8 . 10)))
316 (setq ps-header-font-size (quote (8 . 10)))
317 (setq ps-header-title-font-size (quote (10 . 10)))
318 (setq ps-line-number-color "blue")
319 (setq ps-print-footer t)
320 (setq ps-print-footer-frame nil)
321 (setq ps-print-only-one-header t)
322 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
323 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
325 (setq sentence-end-double-space nil)
326 ; enable matching parenthesis
329 (setq user-mail-address "don@donarmstrong.com")
330 (setq vc-delete-logbuf-window nil)
331 (setq vc-follow-symlinks t)
333 ;; use git before SVN; use CVS earlier, because I have CVS
334 ;; repositories inside of git directories
335 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
337 ;; switch back to the old primary selection method
338 (setq x-select-enable-clipboard nil)
339 (setq x-select-enable-primary t)
340 ; (setq mouse-drag-copy-region t)
342 (fset 'perl-mode 'cperl-mode)
343 ;;(load-file "cperl-mode.el")
349 ;;(require 'ecasound)
350 ;;(require 'emacs-wiki)
354 ; (require 'google-weather)
355 ; (require 'org-google-weather)
356 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
358 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
359 ; this colorizes color strings
360 (require 'rainbow-mode)
361 ; add ess to the x major mode
362 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
363 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
365 (global-set-key "\C-xp" 'server-edit)
367 (setq-default auto-mode-alist (cons '("\.wml$" .
368 (lambda () (html-mode) (auto-fill-mode)))
372 ; use markdown mode for mdwn files
373 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
374 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
377 ;; tramp configuration
378 (setq tramp-use-ssh-controlmaster-options nil)
381 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
382 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
384 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
385 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
386 (defun my-message-mode-settings ()
387 (font-lock-add-keywords nil
388 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
389 (0 'message-multiply-quoted-text-face))
390 ("^[ \t]*>[ \t]*>.*$"
391 (0 'message-double-quoted-text-face))))
392 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
394 (add-hook 'message-mode-hook 'my-message-mode-settings)
396 (defun my-post-attach-file ()
397 "Prompt for an attachment."
399 (let ((file (read-file-name "Attach file: " nil nil t nil))
400 (description (string-read "Description: ")))
401 (my-header-attach-file file description)))
403 (symbol-function 'my-post-attach-file)
405 (defun my-header-attach-file (file description)
406 "Attach a FILE to the current message (works with Mutt).
407 Argument DESCRIPTION MIME description."
408 (interactive "fAttach file: \nsDescription: ")
409 (when (> (length file) 0)
414 (goto-char (point-min))
415 (search-forward-regexp "^$")
416 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
418 (message (concat "Attached '" file "'."))
419 (setq post-has-attachment t))))))
423 (setq mail-yank-prefix "> ")
425 (global-unset-key "\M-g")
426 (global-set-key "\M-g" 'goto-line)
428 ;; self-insert-command hack.
429 ;; Without this, "if<SP>" expands to
432 ;; which really should be,
438 ;(load-library "php-mode")
440 (setq-default c-indent-level 4)
441 (setq-default c-brace-imaginary-offset 0)
442 (setq-default c-brace-offset -4)
443 (setq-default c-argdecl-indent 4)
444 (setq-default c-label-offset -4)
445 (setq-default c-continued-statement-offset 4)
447 (setq-default indent-tabs-mode nil)
448 (setq-default tab-width 4)
451 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
452 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
453 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
454 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
455 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
458 (defun insert-date ()
459 "Insert date at point."
461 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
462 (global-set-key "\C-[d" 'insert-date)
464 (defun unfill-paragraph (arg)
465 "Pull this whole paragraph up onto one line."
467 (let ((fill-column 10000))
468 (fill-paragraph arg))
471 (column-number-mode t)
472 (setq-default reftex-plug-into-AUCTeX t)
476 ; (require 'mode-compile)
478 (defadvice server-process-filter (after post-mode-message first activate)
479 "If the buffer is in post mode, overwrite the server-edit
480 message with a post-save-current-buffer-and-exit message."
481 (if (eq major-mode 'post-mode)
483 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
484 ; This is also needed to see the magic message. Set to a higher
485 ; number if you have a faster computer or read slower than me.
486 '(font-lock-verbose 1000)
487 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
488 ; (add-hook 'server-switch-hook
489 ; (function (lambda()
490 ; (cond ((string-match "Post" mode-name)
492 ; set-buffer-file-coding-system 'utf-8
496 (add-hook 'post-mode-hook
499 ; abbrev mode settings
500 ; load abbreviations from
501 (setq abbrev-file-name
502 "~/.emacs_abbrev_def")
504 ; read the abbrev file if it exists
505 (if (file-exists-p abbrev-file-name)
506 (quietly-read-abbrev-file))
508 ; for now, use abbrev mode everywhere
509 (setq default-abbrev-mode t)
512 (defun insert-function-documentation ()
513 "Insert function documentation"
515 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
516 (global-set-key "\M-f" 'insert-function-documentation)
518 (eval-after-load "lilypond-mode"
520 (load-library "lyqi-mode")
521 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
523 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
525 (desktop-load-default)
529 ;; custom-set-faces was added by Custom.
530 ;; If you edit it by hand, you could mess it up, so be careful.
531 ;; Your init file should contain only one such instance.
532 ;; If there is more than one, they won't work right.
533 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
536 (put 'upcase-region 'disabled nil)
537 (put 'downcase-region 'disabled nil)
538 (put 'narrow-to-region 'disabled nil)
541 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
542 (add-hook 'message-mode-hook 'turn-on-flyspell)
543 (add-hook 'text-mode-hook 'turn-on-flyspell)
544 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
545 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
546 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
547 ; (defun turn-on-flyspell ()
548 ; "Force flyspell-mode on using a positive arg. For use in hooks."
553 ; Outline-minor-mode key map
554 (define-prefix-command 'cm-map nil "Outline-")
556 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
557 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
558 (define-key cm-map "o" 'hide-other) ; Hide other branches
559 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
560 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
561 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
563 (define-key cm-map "a" 'show-all) ; Show (expand) everything
564 (define-key cm-map "e" 'show-entry) ; Show this heading's body
565 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
566 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
567 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
569 (define-key cm-map "u" 'outline-up-heading) ; Up
570 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
571 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
572 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
573 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
574 (global-set-key "\M-o" cm-map)
578 (setq-default debian-changelog-mailing-address "don@debian.org")
579 (setq-default debian-changelog-full-name "Don Armstrong")
581 ; ediff configuration
582 ; don't use the multi-window configuration
583 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
587 (define-key global-map (kbd "C-;") 'iedit-mode)
588 (global-set-key (kbd "C-;") 'iedit-mode)
590 ; fix up css mode to not be silly
591 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
592 (setq cssm-indent-level 4)
593 (setq cssm-newline-before-closing-bracket t)
594 (setq cssm-indent-function #'cssm-c-style-indenter)
595 (setq cssm-mirror-mode nil)
597 (require 'multi-web-mode)
598 (setq mweb-default-major-mode 'html-mode)
599 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
600 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
601 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
602 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
603 (multi-web-global-mode 1)
605 ;;; alias the new `flymake-report-status-slim' to
606 ;;; `flymake-report-status'
607 (defalias 'flymake-report-status 'flymake-report-status-slim)
608 (defun flymake-report-status-slim (e-w &optional status)
609 "Show \"slim\" flymake status in mode line."
611 (setq flymake-mode-line-e-w e-w))
613 (setq flymake-mode-line-status status))
614 (let* ((mode-line " Φ"))
615 (when (> (length flymake-mode-line-e-w) 0)
616 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
617 (setq mode-line (concat mode-line flymake-mode-line-status))
618 (setq flymake-mode-line mode-line)
619 (force-mode-line-update)))
621 ; load sql-indent when sql is loaded
622 (eval-after-load "sql"
623 '(load-library "sql-indent"))
625 ; fix up tmux xterm keys
626 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
629 (let ((x 2) (tkey ""))
649 ;; ctrl + alt + shift
651 (setq tkey "C-M-S-"))
654 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
655 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
656 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
657 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
659 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
661 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
663 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
665 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
667 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
669 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
671 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
673 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
675 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
677 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
679 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
681 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
683 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
685 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
687 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
689 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
691 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
693 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
695 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
697 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
699 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
701 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
703 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
705 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
707 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
709 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
716 ; procmailmode configuration
717 (load "procmail_mode")
719 (load "mode-line-cleaner")
721 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
722 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
723 (if (or (buffer-modified-p)
724 (verify-visited-file-modtime)
725 (< (* 8 1024 1024) (buffer-size))
726 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
728 (clear-visited-file-modtime)
730 (ad-activate 'ask-user-about-supersession-threat)
732 ; apparently things like to step on C-;, so we'll use a hack from
733 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
735 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
737 ; use iedit everywhere
738 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
740 (define-minor-mode my-keys-minor-mode
741 "A minor mode so that my key settings override annoying major modes."
742 t " my-keys" 'my-keys-minor-mode-map)
744 (my-keys-minor-mode 1)
745 (defun my-minibuffer-setup-hook ()
746 (my-keys-minor-mode 0))
748 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
749 (defadvice load (after give-my-keybindings-priority)
750 "Try to ensure that my keybindings always have priority."
751 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
752 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
753 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
754 (add-to-list 'minor-mode-map-alist mykeys))))
756 (global-set-key "\M- " 'hippie-expand)
761 #+BEGIN_SRC emacs-lisp
762 (provide 'don-configuration)