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
79 (use-package eyebrowse
81 :diminish eyebrowse-mode
82 :init (setq eyebrowse-keymap-prefix (kbd "C-c C-\\"))
84 (setq eyebrowse-wrap-around t)
87 (defun my/eyebrowse-new-window-config ()
91 ;; start at 1 run till 0
92 (let ((j (mod (+ i 1) 10)))
94 (not (eyebrowse--window-config-present-p j)))
95 (eyebrowse-switch-to-window-config j)
96 (call-interactively 'eyebrowse-rename-window-config2 j)
101 (require 'latex-preview-pane)
102 (defun my/close-latex-preview-pane-before-eyebrowse-switch ()
103 ;; latex-preview-pane uses window-parameters which are
104 ;; not preserved by eyebrowse, so we close the preview
105 ;; pane before switching, it will be regenerated when we
106 ;; edit the TeX file.
107 (when (lpp/window-containing-preview)
108 (delete-window (lpp/window-containing-preview))))
110 (add-to-list 'eyebrowse-pre-window-switch-hook
111 #'my/close-latex-preview-pane-before-eyebrowse-switch)
113 (my/set-menu-key "[" #'my/eyebrowse-new-window-config)
114 (my/set-menu-key ";" #'eyebrowse-prev-window-config)
115 (my/set-menu-key "'" #'eyebrowse-next-window-config)
116 (my/set-menu-key "]" #'eyebrowse-close-window-config)
117 (my/set-menu-key "\\" #'eyebrowse-rename-window-config))
123 #+BEGIN_SRC emacs-lisp
125 (with-library 'tinyprocmail
126 ; (setq tinyprocmail--procmail-version "v3.22")
127 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
131 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
132 ; don't verify where we are pushing
133 (setq magit-push-always-verify nil)
134 ;; refine diffs always (hilight words)
135 (setq magit-diff-refine-hunk 'all)
138 (append '("~/lib/emacs_el/magit-annex")
140 (require 'magit-annex)
144 #+BEGIN_SRC emacs-lisp
145 (require 'cperl-mode)
146 ;; Use c-mode for perl .xs files
147 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
148 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
149 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
150 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
151 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
154 cperl-auto-newline nil
155 cperl-auto-newline-after-colon nil
156 cperl-continued-statement-offset 4
157 cperl-brace-offset -1
158 cperl-continued-brace-offset 0
159 cperl-label-offset -4
160 cperl-highlight-variables-indiscriminately t
161 cperl-electric-lbrace-space nil
162 cperl-indent-parens-as-block nil
163 cperl-close-paren-offset -1
164 cperl-tab-always-indent t)
165 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
169 #+BEGIN_SRC emacs-lisp
173 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
178 #+BEGIN_SRC emacs-lisp
179 (add-to-list 'tramp-methods '("vcsh"
180 (tramp-login-program "vcsh")
184 (tramp-remote-shell "/bin/sh")
185 (tramp-remote-shell-args
189 #+BEGIN_SRC emacs-lisp
190 (load "auctex.el" nil t t)
191 (load "preview-latex.el" nil t t)
192 (load "latex.el" nil t t)
194 ;; this is in the very newest auctex; avoid for now
195 (add-to-list 'LaTeX-fill-excluded-macros
197 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
198 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
199 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
200 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
201 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
202 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
203 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
204 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
205 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
206 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
208 ; use smart quotes by default instead of `` and ''
209 ; taken from http://kieranhealy.org/esk/kjhealy.html
210 (setq TeX-open-quote "“")
211 (setq TeX-close-quote "”")
213 ;; (TeX-add-style-hook
218 ;; (custom-set-variables
219 ;; '(font-latex-user-keyword-classes
222 ;; font-lock-function-name-face 2 (command 1 t))))
225 (require 'font-latex)
226 (setq font-latex-match-reference-keywords
242 ; (setq font-latex-match-warning-keywords
250 (setq-default TeX-parse-self t)
251 (setq-default TeX-auto-save t)
252 (setq-default TeX-master nil)
258 (if (boundp 'reftex-ref-style-alist)
260 'reftex-ref-style-alist
261 '("Cleveref" "cleveref"
262 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
263 (reftex-ref-style-activate "Cleveref")
265 '("cref" TeX-arg-ref)
266 '("Cref" TeX-arg-ref)
267 '("cpageref" TeX-arg-ref)
268 '("Cpageref" TeX-arg-ref)))))
269 ;; this doesn't seem to work; not currently sure why
270 ; (setq font-latex-user-keyword-classes
271 ; '(("my-warning-commands"
278 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
281 (setq-default reftex-default-bibliography
282 '("~/projects/research/references.bib"))
287 #+BEGIN_SRC emacs-lisp
288 (require 'org-mode-configuration)
291 #+BEGIN_SRC emacs-lisp
292 (require 'ess_configuration)
297 #+BEGIN_SRC emacs-lisp
299 (append '("~/lib/emacs_el/polymode/modes")
303 (require 'poly-noweb)
304 (require 'poly-markdown)
305 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
306 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
307 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
311 ** Override other things
312 #+BEGIN_SRC emacs-lisp
313 ; apparently things like to step on C-;, so we'll use a hack from
314 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
316 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
318 ; use iedit everywhere
319 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
320 ;; use outline mode keybindings everywhere
321 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
323 (define-minor-mode my-keys-minor-mode
324 "A minor mode so that my key settings override annoying major modes."
325 t " my-keys" 'my-keys-minor-mode-map)
327 (my-keys-minor-mode 1)
328 (defun my-minibuffer-setup-hook ()
329 (my-keys-minor-mode 0))
331 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
332 (defadvice load (after give-my-keybindings-priority)
333 "Try to ensure that my keybindings always have priority."
334 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
335 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
336 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
337 (add-to-list 'minor-mode-map-alist mykeys))))
341 * Misc (uncharacterized)
342 #+BEGIN_SRC emacs-lisp
343 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
344 (setq calendar-latitude 40.11)
345 (setq calendar-longitude -88.24)
346 (setq case-fold-search t)
347 (setq confirm-kill-emacs (quote y-or-n-p))
348 (setq cperl-lazy-help-time nil)
349 (setq debian-changelog-mailing-address "don@debian.org")
351 (setq display-time-24hr-format t)
352 (setq display-time-day-and-date t)
353 (display-time-mode 1)
354 (setq font-latex-fontify-script nil)
355 (setq font-latex-fontify-sectioning (quote color))
356 (setq font-latex-script-display (quote (nil)))
357 (global-auto-revert-mode 1)
358 (global-font-lock-mode 1)
360 (setq log-edit-keep-buffer t)
361 (setq mail-user-agent (quote sendmail-user-agent))
362 (setq markdown-enable-math t)
363 (setq markdown-follow-wiki-link-on-enter nil)
364 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
365 (setq post-email-address "don@donarmstrong.com")
366 (setq post-kill-quoted-sig nil)
367 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
368 (setq post-uses-fill-mode nil)
369 (setq ps-footer-font-size (quote (8 . 10)))
370 (setq ps-header-font-size (quote (8 . 10)))
371 (setq ps-header-title-font-size (quote (10 . 10)))
372 (setq ps-line-number-color "blue")
373 (setq ps-print-footer t)
374 (setq ps-print-footer-frame nil)
375 (setq ps-print-only-one-header t)
376 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
377 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
379 (setq sentence-end-double-space nil)
380 ; enable matching parenthesis
383 (setq user-mail-address "don@donarmstrong.com")
384 (setq vc-delete-logbuf-window nil)
385 (setq vc-follow-symlinks t)
387 ;; use git before SVN; use CVS earlier, because I have CVS
388 ;; repositories inside of git directories
389 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
391 ;; switch back to the old primary selection method
392 (setq x-select-enable-clipboard nil)
393 (setq x-select-enable-primary t)
394 ; (setq mouse-drag-copy-region t)
396 (fset 'perl-mode 'cperl-mode)
397 ;;(load-file "cperl-mode.el")
403 ;;(require 'ecasound)
404 ;;(require 'emacs-wiki)
408 ; (require 'google-weather)
409 ; (require 'org-google-weather)
410 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
412 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
413 ; this colorizes color strings
414 (require 'rainbow-mode)
415 ; add ess to the x major mode
416 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
417 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
419 (global-set-key "\C-xp" 'server-edit)
421 (setq-default auto-mode-alist (cons '("\.wml$" .
422 (lambda () (html-mode) (auto-fill-mode)))
426 ; use markdown mode for mdwn files
427 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
428 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
431 ;; tramp configuration
432 (setq tramp-use-ssh-controlmaster-options nil)
435 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
436 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
438 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
439 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
440 (defun my-message-mode-settings ()
441 (font-lock-add-keywords nil
442 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
443 (0 'message-multiply-quoted-text-face))
444 ("^[ \t]*>[ \t]*>.*$"
445 (0 'message-double-quoted-text-face))))
446 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
448 (add-hook 'message-mode-hook 'my-message-mode-settings)
450 (defun my-post-attach-file ()
451 "Prompt for an attachment."
453 (let ((file (read-file-name "Attach file: " nil nil t nil))
454 (description (string-read "Description: ")))
455 (my-header-attach-file file description)))
457 (symbol-function 'my-post-attach-file)
459 (defun my-header-attach-file (file description)
460 "Attach a FILE to the current message (works with Mutt).
461 Argument DESCRIPTION MIME description."
462 (interactive "fAttach file: \nsDescription: ")
463 (when (> (length file) 0)
468 (goto-char (point-min))
469 (search-forward-regexp "^$")
470 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
472 (message (concat "Attached '" file "'."))
473 (setq post-has-attachment t))))))
477 (setq mail-yank-prefix "> ")
479 (global-unset-key "\M-g")
480 (global-set-key "\M-g" 'goto-line)
482 ;; self-insert-command hack.
483 ;; Without this, "if<SP>" expands to
486 ;; which really should be,
492 ;(load-library "php-mode")
494 (setq-default c-indent-level 4)
495 (setq-default c-brace-imaginary-offset 0)
496 (setq-default c-brace-offset -4)
497 (setq-default c-argdecl-indent 4)
498 (setq-default c-label-offset -4)
499 (setq-default c-continued-statement-offset 4)
501 (setq-default indent-tabs-mode nil)
502 (setq-default tab-width 4)
505 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
506 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
507 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
508 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
509 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
512 (defun insert-date ()
513 "Insert date at point."
515 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
516 (global-set-key "\C-[d" 'insert-date)
518 (defun unfill-paragraph (arg)
519 "Pull this whole paragraph up onto one line."
521 (let ((fill-column 10000))
522 (fill-paragraph arg))
525 (column-number-mode t)
526 (setq-default reftex-plug-into-AUCTeX t)
530 ; (require 'mode-compile)
532 (defadvice server-process-filter (after post-mode-message first activate)
533 "If the buffer is in post mode, overwrite the server-edit
534 message with a post-save-current-buffer-and-exit message."
535 (if (eq major-mode 'post-mode)
537 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
538 ; This is also needed to see the magic message. Set to a higher
539 ; number if you have a faster computer or read slower than me.
540 '(font-lock-verbose 1000)
541 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
542 ; (add-hook 'server-switch-hook
543 ; (function (lambda()
544 ; (cond ((string-match "Post" mode-name)
546 ; set-buffer-file-coding-system 'utf-8
550 (add-hook 'post-mode-hook
553 ; abbrev mode settings
554 ; load abbreviations from
555 (setq abbrev-file-name
556 "~/.emacs_abbrev_def")
558 ; read the abbrev file if it exists
559 (if (file-exists-p abbrev-file-name)
560 (quietly-read-abbrev-file))
562 ; for now, use abbrev mode everywhere
563 (setq default-abbrev-mode t)
566 (defun insert-function-documentation ()
567 "Insert function documentation"
569 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
570 (global-set-key "\M-f" 'insert-function-documentation)
572 (eval-after-load "lilypond-mode"
574 (load-library "lyqi-mode")
575 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
577 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
579 (desktop-load-default)
583 ;; custom-set-faces was added by Custom.
584 ;; If you edit it by hand, you could mess it up, so be careful.
585 ;; Your init file should contain only one such instance.
586 ;; If there is more than one, they won't work right.
587 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
590 (put 'upcase-region 'disabled nil)
591 (put 'downcase-region 'disabled nil)
592 (put 'narrow-to-region 'disabled nil)
595 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
596 (add-hook 'message-mode-hook 'turn-on-flyspell)
597 (add-hook 'text-mode-hook 'turn-on-flyspell)
598 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
599 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
600 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
601 ; (defun turn-on-flyspell ()
602 ; "Force flyspell-mode on using a positive arg. For use in hooks."
607 ; Outline-minor-mode key map
608 (define-prefix-command 'cm-map nil "Outline-")
610 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
611 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
612 (define-key cm-map "o" 'hide-other) ; Hide other branches
613 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
614 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
615 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
617 (define-key cm-map "a" 'show-all) ; Show (expand) everything
618 (define-key cm-map "e" 'show-entry) ; Show this heading's body
619 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
620 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
621 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
623 (define-key cm-map "u" 'outline-up-heading) ; Up
624 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
625 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
626 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
627 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
628 (global-set-key "\M-o" cm-map)
632 (setq-default debian-changelog-mailing-address "don@debian.org")
633 (setq-default debian-changelog-full-name "Don Armstrong")
635 ; ediff configuration
636 ; don't use the multi-window configuration
637 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
641 (define-key global-map (kbd "C-;") 'iedit-mode)
642 (global-set-key (kbd "C-;") 'iedit-mode)
644 ; fix up css mode to not be silly
645 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
646 (setq cssm-indent-level 4)
647 (setq cssm-newline-before-closing-bracket t)
648 (setq cssm-indent-function #'cssm-c-style-indenter)
649 (setq cssm-mirror-mode nil)
651 (require 'multi-web-mode)
652 (setq mweb-default-major-mode 'html-mode)
653 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
654 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
655 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
656 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
657 (multi-web-global-mode 1)
659 ;;; alias the new `flymake-report-status-slim' to
660 ;;; `flymake-report-status'
661 (defalias 'flymake-report-status 'flymake-report-status-slim)
662 (defun flymake-report-status-slim (e-w &optional status)
663 "Show \"slim\" flymake status in mode line."
665 (setq flymake-mode-line-e-w e-w))
667 (setq flymake-mode-line-status status))
668 (let* ((mode-line " Φ"))
669 (when (> (length flymake-mode-line-e-w) 0)
670 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
671 (setq mode-line (concat mode-line flymake-mode-line-status))
672 (setq flymake-mode-line mode-line)
673 (force-mode-line-update)))
675 ; load sql-indent when sql is loaded
676 (eval-after-load "sql"
677 '(load-library "sql-indent"))
679 ; fix up tmux xterm keys
680 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
683 (let ((x 2) (tkey ""))
703 ;; ctrl + alt + shift
705 (setq tkey "C-M-S-"))
708 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
709 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
710 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
711 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
713 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
715 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
717 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
719 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
721 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
723 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
725 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
727 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
729 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
731 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
733 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
735 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
737 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
739 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
741 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
743 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
745 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
747 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
749 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
751 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
753 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
755 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
757 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
759 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
761 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
763 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
770 ; procmailmode configuration
771 (load "procmail_mode")
773 (load "mode-line-cleaner")
775 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
776 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
777 (if (or (buffer-modified-p)
778 (verify-visited-file-modtime)
779 (< (* 8 1024 1024) (buffer-size))
780 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
782 (clear-visited-file-modtime)
784 (ad-activate 'ask-user-about-supersession-threat)
786 ; apparently things like to step on C-;, so we'll use a hack from
787 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
789 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
791 ; use iedit everywhere
792 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
794 (define-minor-mode my-keys-minor-mode
795 "A minor mode so that my key settings override annoying major modes."
796 t " my-keys" 'my-keys-minor-mode-map)
798 (my-keys-minor-mode 1)
799 (defun my-minibuffer-setup-hook ()
800 (my-keys-minor-mode 0))
802 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
803 (defadvice load (after give-my-keybindings-priority)
804 "Try to ensure that my keybindings always have priority."
805 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
806 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
807 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
808 (add-to-list 'minor-mode-map-alist mykeys))))
810 (global-set-key "\M- " 'hippie-expand)
815 #+BEGIN_SRC emacs-lisp
816 (provide 'don-configuration)