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)
39 #+BEGIN_SRC emacs-lisp
46 #+BEGIN_SRC emacs-lisp
47 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
48 ;; execute conditional code when loading libraries
49 (defmacro with-library (symbol &rest body)
50 `(when (require ,symbol nil t)
52 (put 'with-library 'lisp-indent-function 1)
57 #+BEGIN_SRC emacs-lisp
58 (setq global-mark-ring-max 128
62 (defun don/minibuffer-setup-hook ()
63 (setq gc-cons-threshold most-positive-fixnum))
65 (defun don/minibuffer-exit-hook ()
66 (setq gc-cons-threshold 1048576))
68 (add-hook 'minibuffer-setup-hook #'don/minibuffer-setup-hook)
69 (add-hook 'minibuffer-exit-hook #'don/minibuffer-exit-hook)
73 #+BEGIN_SRC emacs-lisp
78 #+BEGIN_SRC emacs-lisp
80 (with-library 'tinyprocmail
81 ; (setq tinyprocmail--procmail-version "v3.22")
82 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
86 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
87 ; don't verify where we are pushing
88 (setq magit-push-always-verify nil)
89 ;; refine diffs always (hilight words)
90 (setq magit-diff-refine-hunk 'all)
93 (append '("~/lib/emacs_el/magit-annex")
95 (require 'magit-annex)
99 #+BEGIN_SRC emacs-lisp
100 (require 'cperl-mode)
101 ;; Use c-mode for perl .xs files
102 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
103 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
104 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
105 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
106 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
109 cperl-auto-newline nil
110 cperl-auto-newline-after-colon nil
111 cperl-continued-statement-offset 4
112 cperl-brace-offset -1
113 cperl-continued-brace-offset 0
114 cperl-label-offset -4
115 cperl-highlight-variables-indiscriminately t
116 cperl-electric-lbrace-space nil
117 cperl-indent-parens-as-block nil
118 cperl-close-paren-offset -1
119 cperl-tab-always-indent t)
120 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
124 #+BEGIN_SRC emacs-lisp
128 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
133 #+BEGIN_SRC emacs-lisp
134 (add-to-list 'tramp-methods '("vcsh"
135 (tramp-login-program "vcsh")
139 (tramp-remote-shell "/bin/sh")
140 (tramp-remote-shell-args
144 #+BEGIN_SRC emacs-lisp
145 (load "auctex.el" nil t t)
146 (load "preview-latex.el" nil t t)
147 (load "latex.el" nil t t)
149 ;; this is in the very newest auctex; avoid for now
150 (add-to-list 'LaTeX-fill-excluded-macros
152 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
153 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
154 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
155 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
156 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
157 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
158 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
159 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
160 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
161 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
163 ; use smart quotes by default instead of `` and ''
164 ; taken from http://kieranhealy.org/esk/kjhealy.html
165 (setq TeX-open-quote "“")
166 (setq TeX-close-quote "”")
168 ;; (TeX-add-style-hook
173 ;; (custom-set-variables
174 ;; '(font-latex-user-keyword-classes
177 ;; font-lock-function-name-face 2 (command 1 t))))
180 (require 'font-latex)
181 (setq font-latex-match-reference-keywords
197 ; (setq font-latex-match-warning-keywords
205 (setq-default TeX-parse-self t)
206 (setq-default TeX-auto-save t)
207 (setq-default TeX-master nil)
213 (if (boundp 'reftex-ref-style-alist)
215 'reftex-ref-style-alist
216 '("Cleveref" "cleveref"
217 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
218 (reftex-ref-style-activate "Cleveref")
220 '("cref" TeX-arg-ref)
221 '("Cref" TeX-arg-ref)
222 '("cpageref" TeX-arg-ref)
223 '("Cpageref" TeX-arg-ref)))))
224 ;; this doesn't seem to work; not currently sure why
225 ; (setq font-latex-user-keyword-classes
226 ; '(("my-warning-commands"
233 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
236 (setq-default reftex-default-bibliography
237 '("~/projects/research/references.bib"))
242 #+BEGIN_SRC emacs-lisp
243 (require 'org-mode-configuration)
246 #+BEGIN_SRC emacs-lisp
247 (require 'ess_configuration)
252 #+BEGIN_SRC emacs-lisp
254 (append '("~/lib/emacs_el/polymode/modes")
258 (require 'poly-noweb)
259 (require 'poly-markdown)
260 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
261 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
262 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
266 ** Override other things
267 #+BEGIN_SRC emacs-lisp
268 ; apparently things like to step on C-;, so we'll use a hack from
269 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
271 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
273 ; use iedit everywhere
274 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
275 ;; use outline mode keybindings everywhere
276 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
278 (define-minor-mode my-keys-minor-mode
279 "A minor mode so that my key settings override annoying major modes."
280 t " my-keys" 'my-keys-minor-mode-map)
282 (my-keys-minor-mode 1)
283 (defun my-minibuffer-setup-hook ()
284 (my-keys-minor-mode 0))
286 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
287 (defadvice load (after give-my-keybindings-priority)
288 "Try to ensure that my keybindings always have priority."
289 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
290 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
291 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
292 (add-to-list 'minor-mode-map-alist mykeys))))
296 * Misc (uncharacterized)
297 #+BEGIN_SRC emacs-lisp
298 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
299 (setq calendar-latitude 40.11)
300 (setq calendar-longitude -88.24)
301 (setq case-fold-search t)
302 (setq confirm-kill-emacs (quote y-or-n-p))
303 (setq cperl-lazy-help-time nil)
304 (setq debian-changelog-mailing-address "don@debian.org")
306 (setq display-time-24hr-format t)
307 (setq display-time-day-and-date t)
308 (display-time-mode 1)
309 (setq font-latex-fontify-script nil)
310 (setq font-latex-fontify-sectioning (quote color))
311 (setq font-latex-script-display (quote (nil)))
312 (global-auto-revert-mode 1)
313 (global-font-lock-mode 1)
315 (setq log-edit-keep-buffer t)
316 (setq mail-user-agent (quote sendmail-user-agent))
317 (setq markdown-enable-math t)
318 (setq markdown-follow-wiki-link-on-enter nil)
319 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
320 (setq post-email-address "don@donarmstrong.com")
321 (setq post-kill-quoted-sig nil)
322 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
323 (setq post-uses-fill-mode nil)
324 (setq ps-footer-font-size (quote (8 . 10)))
325 (setq ps-header-font-size (quote (8 . 10)))
326 (setq ps-header-title-font-size (quote (10 . 10)))
327 (setq ps-line-number-color "blue")
328 (setq ps-print-footer t)
329 (setq ps-print-footer-frame nil)
330 (setq ps-print-only-one-header t)
331 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
332 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
334 (setq sentence-end-double-space nil)
335 ; enable matching parenthesis
338 (setq user-mail-address "don@donarmstrong.com")
339 (setq vc-delete-logbuf-window nil)
340 (setq vc-follow-symlinks t)
342 ;; use git before SVN; use CVS earlier, because I have CVS
343 ;; repositories inside of git directories
344 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
346 ;; switch back to the old primary selection method
347 (setq x-select-enable-clipboard nil)
348 (setq x-select-enable-primary t)
349 ; (setq mouse-drag-copy-region t)
351 (fset 'perl-mode 'cperl-mode)
352 ;;(load-file "cperl-mode.el")
358 ;;(require 'ecasound)
359 ;;(require 'emacs-wiki)
363 ; (require 'google-weather)
364 ; (require 'org-google-weather)
365 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
367 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
368 ; this colorizes color strings
369 (require 'rainbow-mode)
370 ; add ess to the x major mode
371 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
372 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
374 (global-set-key "\C-xp" 'server-edit)
376 (setq-default auto-mode-alist (cons '("\.wml$" .
377 (lambda () (html-mode) (auto-fill-mode)))
381 ; use markdown mode for mdwn files
382 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
383 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
386 ;; tramp configuration
387 (setq tramp-use-ssh-controlmaster-options nil)
390 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
391 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
393 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
394 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
395 (defun my-message-mode-settings ()
396 (font-lock-add-keywords nil
397 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
398 (0 'message-multiply-quoted-text-face))
399 ("^[ \t]*>[ \t]*>.*$"
400 (0 'message-double-quoted-text-face))))
401 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
403 (add-hook 'message-mode-hook 'my-message-mode-settings)
405 (defun my-post-attach-file ()
406 "Prompt for an attachment."
408 (let ((file (read-file-name "Attach file: " nil nil t nil))
409 (description (string-read "Description: ")))
410 (my-header-attach-file file description)))
412 (symbol-function 'my-post-attach-file)
414 (defun my-header-attach-file (file description)
415 "Attach a FILE to the current message (works with Mutt).
416 Argument DESCRIPTION MIME description."
417 (interactive "fAttach file: \nsDescription: ")
418 (when (> (length file) 0)
423 (goto-char (point-min))
424 (search-forward-regexp "^$")
425 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
427 (message (concat "Attached '" file "'."))
428 (setq post-has-attachment t))))))
432 (setq mail-yank-prefix "> ")
434 (global-unset-key "\M-g")
435 (global-set-key "\M-g" 'goto-line)
437 ;; self-insert-command hack.
438 ;; Without this, "if<SP>" expands to
441 ;; which really should be,
447 ;(load-library "php-mode")
449 (setq-default c-indent-level 4)
450 (setq-default c-brace-imaginary-offset 0)
451 (setq-default c-brace-offset -4)
452 (setq-default c-argdecl-indent 4)
453 (setq-default c-label-offset -4)
454 (setq-default c-continued-statement-offset 4)
456 (setq-default indent-tabs-mode nil)
457 (setq-default tab-width 4)
460 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
461 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
462 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
463 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
464 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
467 (defun insert-date ()
468 "Insert date at point."
470 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
471 (global-set-key "\C-[d" 'insert-date)
473 (defun unfill-paragraph (arg)
474 "Pull this whole paragraph up onto one line."
476 (let ((fill-column 10000))
477 (fill-paragraph arg))
480 (column-number-mode t)
481 (setq-default reftex-plug-into-AUCTeX t)
485 ; (require 'mode-compile)
487 (defadvice server-process-filter (after post-mode-message first activate)
488 "If the buffer is in post mode, overwrite the server-edit
489 message with a post-save-current-buffer-and-exit message."
490 (if (eq major-mode 'post-mode)
492 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
493 ; This is also needed to see the magic message. Set to a higher
494 ; number if you have a faster computer or read slower than me.
495 '(font-lock-verbose 1000)
496 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
497 ; (add-hook 'server-switch-hook
498 ; (function (lambda()
499 ; (cond ((string-match "Post" mode-name)
501 ; set-buffer-file-coding-system 'utf-8
505 (add-hook 'post-mode-hook
508 ; abbrev mode settings
509 ; load abbreviations from
510 (setq abbrev-file-name
511 "~/.emacs_abbrev_def")
513 ; read the abbrev file if it exists
514 (if (file-exists-p abbrev-file-name)
515 (quietly-read-abbrev-file))
517 ; for now, use abbrev mode everywhere
518 (setq default-abbrev-mode t)
521 (defun insert-function-documentation ()
522 "Insert function documentation"
524 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
525 (global-set-key "\M-f" 'insert-function-documentation)
527 (eval-after-load "lilypond-mode"
529 (load-library "lyqi-mode")
530 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
532 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
534 (desktop-load-default)
538 ;; custom-set-faces was added by Custom.
539 ;; If you edit it by hand, you could mess it up, so be careful.
540 ;; Your init file should contain only one such instance.
541 ;; If there is more than one, they won't work right.
542 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
545 (put 'upcase-region 'disabled nil)
546 (put 'downcase-region 'disabled nil)
547 (put 'narrow-to-region 'disabled nil)
550 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
551 (add-hook 'message-mode-hook 'turn-on-flyspell)
552 (add-hook 'text-mode-hook 'turn-on-flyspell)
553 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
554 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
555 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
556 ; (defun turn-on-flyspell ()
557 ; "Force flyspell-mode on using a positive arg. For use in hooks."
562 ; Outline-minor-mode key map
563 (define-prefix-command 'cm-map nil "Outline-")
565 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
566 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
567 (define-key cm-map "o" 'hide-other) ; Hide other branches
568 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
569 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
570 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
572 (define-key cm-map "a" 'show-all) ; Show (expand) everything
573 (define-key cm-map "e" 'show-entry) ; Show this heading's body
574 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
575 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
576 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
578 (define-key cm-map "u" 'outline-up-heading) ; Up
579 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
580 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
581 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
582 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
583 (global-set-key "\M-o" cm-map)
587 (setq-default debian-changelog-mailing-address "don@debian.org")
588 (setq-default debian-changelog-full-name "Don Armstrong")
590 ; ediff configuration
591 ; don't use the multi-window configuration
592 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
596 (define-key global-map (kbd "C-;") 'iedit-mode)
597 (global-set-key (kbd "C-;") 'iedit-mode)
599 ; fix up css mode to not be silly
600 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
601 (setq cssm-indent-level 4)
602 (setq cssm-newline-before-closing-bracket t)
603 (setq cssm-indent-function #'cssm-c-style-indenter)
604 (setq cssm-mirror-mode nil)
606 (require 'multi-web-mode)
607 (setq mweb-default-major-mode 'html-mode)
608 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
609 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
610 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
611 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
612 (multi-web-global-mode 1)
614 ;;; alias the new `flymake-report-status-slim' to
615 ;;; `flymake-report-status'
616 (defalias 'flymake-report-status 'flymake-report-status-slim)
617 (defun flymake-report-status-slim (e-w &optional status)
618 "Show \"slim\" flymake status in mode line."
620 (setq flymake-mode-line-e-w e-w))
622 (setq flymake-mode-line-status status))
623 (let* ((mode-line " Φ"))
624 (when (> (length flymake-mode-line-e-w) 0)
625 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
626 (setq mode-line (concat mode-line flymake-mode-line-status))
627 (setq flymake-mode-line mode-line)
628 (force-mode-line-update)))
630 ; load sql-indent when sql is loaded
631 (eval-after-load "sql"
632 '(load-library "sql-indent"))
634 ; fix up tmux xterm keys
635 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
638 (let ((x 2) (tkey ""))
658 ;; ctrl + alt + shift
660 (setq tkey "C-M-S-"))
663 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
664 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
665 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
666 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
668 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
670 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
672 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
674 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
676 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
678 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
680 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
682 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
684 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
686 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
688 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
690 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
692 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
694 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
696 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
698 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
700 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
702 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
704 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
706 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
708 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
710 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
712 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
714 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
716 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
718 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
725 ; procmailmode configuration
726 (load "procmail_mode")
728 (load "mode-line-cleaner")
730 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
731 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
732 (if (or (buffer-modified-p)
733 (verify-visited-file-modtime)
734 (< (* 8 1024 1024) (buffer-size))
735 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
737 (clear-visited-file-modtime)
739 (ad-activate 'ask-user-about-supersession-threat)
741 ; apparently things like to step on C-;, so we'll use a hack from
742 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
744 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
746 ; use iedit everywhere
747 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
749 (define-minor-mode my-keys-minor-mode
750 "A minor mode so that my key settings override annoying major modes."
751 t " my-keys" 'my-keys-minor-mode-map)
753 (my-keys-minor-mode 1)
754 (defun my-minibuffer-setup-hook ()
755 (my-keys-minor-mode 0))
757 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
758 (defadvice load (after give-my-keybindings-priority)
759 "Try to ensure that my keybindings always have priority."
760 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
761 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
762 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
763 (add-to-list 'minor-mode-map-alist mykeys))))
765 (global-set-key "\M- " 'hippie-expand)
770 #+BEGIN_SRC emacs-lisp
771 (provide 'don-configuration)