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 ;; I don't use latex-preview-pane
102 ;; (require 'latex-preview-pane)
103 ;; (defun my/close-latex-preview-pane-before-eyebrowse-switch ()
104 ;; ;; latex-preview-pane uses window-parameters which are
105 ;; ;; not preserved by eyebrowse, so we close the preview
106 ;; ;; pane before switching, it will be regenerated when we
107 ;; ;; edit the TeX file.
108 ;; (when (lpp/window-containing-preview)
109 ;; (delete-window (lpp/window-containing-preview))))
111 ;; (add-to-list 'eyebrowse-pre-window-switch-hook
112 ;; #'my/close-latex-preview-pane-before-eyebrowse-switch)
114 (my/set-menu-key "[" #'my/eyebrowse-new-window-config)
115 (my/set-menu-key ";" #'eyebrowse-prev-window-config)
116 (my/set-menu-key "'" #'eyebrowse-next-window-config)
117 (my/set-menu-key "]" #'eyebrowse-close-window-config)
118 (my/set-menu-key "\\" #'eyebrowse-rename-window-config))
124 #+BEGIN_SRC emacs-lisp
126 (with-library 'tinyprocmail
127 ; (setq tinyprocmail--procmail-version "v3.22")
128 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
132 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
133 ; don't verify where we are pushing
134 (setq magit-push-always-verify nil)
135 ;; refine diffs always (hilight words)
136 (setq magit-diff-refine-hunk 'all)
139 (append '("~/lib/emacs_el/magit-annex")
141 (require 'magit-annex)
145 #+BEGIN_SRC emacs-lisp
146 (require 'cperl-mode)
147 ;; Use c-mode for perl .xs files
148 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
149 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
150 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
151 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
152 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
155 cperl-auto-newline nil
156 cperl-auto-newline-after-colon nil
157 cperl-continued-statement-offset 4
158 cperl-brace-offset -1
159 cperl-continued-brace-offset 0
160 cperl-label-offset -4
161 cperl-highlight-variables-indiscriminately t
162 cperl-electric-lbrace-space nil
163 cperl-indent-parens-as-block nil
164 cperl-close-paren-offset -1
165 cperl-tab-always-indent t)
166 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
170 #+BEGIN_SRC emacs-lisp
174 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
179 #+BEGIN_SRC emacs-lisp
180 (add-to-list 'tramp-methods '("vcsh"
181 (tramp-login-program "vcsh")
185 (tramp-remote-shell "/bin/sh")
186 (tramp-remote-shell-args
190 #+BEGIN_SRC emacs-lisp
191 (load "auctex.el" nil t t)
192 (load "preview-latex.el" nil t t)
193 (load "latex.el" nil t t)
195 ;; this is in the very newest auctex; avoid for now
196 (add-to-list 'LaTeX-fill-excluded-macros
198 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
199 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
200 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
201 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
202 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
203 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
204 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
205 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
206 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
207 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
209 ; use smart quotes by default instead of `` and ''
210 ; taken from http://kieranhealy.org/esk/kjhealy.html
211 (setq TeX-open-quote "“")
212 (setq TeX-close-quote "”")
214 ;; (TeX-add-style-hook
219 ;; (custom-set-variables
220 ;; '(font-latex-user-keyword-classes
223 ;; font-lock-function-name-face 2 (command 1 t))))
226 (require 'font-latex)
227 (setq font-latex-match-reference-keywords
243 ; (setq font-latex-match-warning-keywords
251 (setq-default TeX-parse-self t)
252 (setq-default TeX-auto-save t)
253 (setq-default TeX-master nil)
259 (if (boundp 'reftex-ref-style-alist)
261 'reftex-ref-style-alist
262 '("Cleveref" "cleveref"
263 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
264 (reftex-ref-style-activate "Cleveref")
266 '("cref" TeX-arg-ref)
267 '("Cref" TeX-arg-ref)
268 '("cpageref" TeX-arg-ref)
269 '("Cpageref" TeX-arg-ref)))))
270 ;; this doesn't seem to work; not currently sure why
271 ; (setq font-latex-user-keyword-classes
272 ; '(("my-warning-commands"
279 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
282 (setq-default reftex-default-bibliography
283 '("~/projects/research/references.bib"))
288 #+BEGIN_SRC emacs-lisp
289 (require 'org-mode-configuration)
292 #+BEGIN_SRC emacs-lisp
293 (require 'ess_configuration)
298 #+BEGIN_SRC emacs-lisp
300 (append '("~/lib/emacs_el/polymode/modes")
304 (require 'poly-noweb)
305 (require 'poly-markdown)
306 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
307 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
308 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
312 ** Override other things
313 #+BEGIN_SRC emacs-lisp
314 ; apparently things like to step on C-;, so we'll use a hack from
315 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
317 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
319 ; use iedit everywhere
320 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
321 ;; use outline mode keybindings everywhere
322 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
324 (define-minor-mode my-keys-minor-mode
325 "A minor mode so that my key settings override annoying major modes."
326 t " my-keys" 'my-keys-minor-mode-map)
328 (my-keys-minor-mode 1)
329 (defun my-minibuffer-setup-hook ()
330 (my-keys-minor-mode 0))
332 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
333 (defadvice load (after give-my-keybindings-priority)
334 "Try to ensure that my keybindings always have priority."
335 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
336 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
337 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
338 (add-to-list 'minor-mode-map-alist mykeys))))
342 * Misc (uncharacterized)
343 #+BEGIN_SRC emacs-lisp
344 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
345 (setq calendar-latitude 40.11)
346 (setq calendar-longitude -88.24)
347 (setq case-fold-search t)
348 (setq confirm-kill-emacs (quote y-or-n-p))
349 (setq cperl-lazy-help-time nil)
350 (setq debian-changelog-mailing-address "don@debian.org")
352 (setq display-time-24hr-format t)
353 (setq display-time-day-and-date t)
354 (display-time-mode 1)
355 (setq font-latex-fontify-script nil)
356 (setq font-latex-fontify-sectioning (quote color))
357 (setq font-latex-script-display (quote (nil)))
358 (global-auto-revert-mode 1)
359 (global-font-lock-mode 1)
361 (setq log-edit-keep-buffer t)
362 (setq mail-user-agent (quote sendmail-user-agent))
363 (setq markdown-enable-math t)
364 (setq markdown-follow-wiki-link-on-enter nil)
365 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
366 (setq post-email-address "don@donarmstrong.com")
367 (setq post-kill-quoted-sig nil)
368 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
369 (setq post-uses-fill-mode nil)
370 (setq ps-footer-font-size (quote (8 . 10)))
371 (setq ps-header-font-size (quote (8 . 10)))
372 (setq ps-header-title-font-size (quote (10 . 10)))
373 (setq ps-line-number-color "blue")
374 (setq ps-print-footer t)
375 (setq ps-print-footer-frame nil)
376 (setq ps-print-only-one-header t)
377 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
378 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
380 (setq sentence-end-double-space nil)
381 ; enable matching parenthesis
384 (setq user-mail-address "don@donarmstrong.com")
385 (setq vc-delete-logbuf-window nil)
386 (setq vc-follow-symlinks t)
388 ;; use git before SVN; use CVS earlier, because I have CVS
389 ;; repositories inside of git directories
390 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
392 ;; switch back to the old primary selection method
393 (setq x-select-enable-clipboard nil)
394 (setq x-select-enable-primary t)
395 ; (setq mouse-drag-copy-region t)
397 (fset 'perl-mode 'cperl-mode)
398 ;;(load-file "cperl-mode.el")
404 ;;(require 'ecasound)
405 ;;(require 'emacs-wiki)
409 ; (require 'google-weather)
410 ; (require 'org-google-weather)
411 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
413 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
414 ; this colorizes color strings
415 (require 'rainbow-mode)
416 ; add ess to the x major mode
417 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
418 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
420 (global-set-key "\C-xp" 'server-edit)
422 (setq-default auto-mode-alist (cons '("\.wml$" .
423 (lambda () (html-mode) (auto-fill-mode)))
427 ; use markdown mode for mdwn files
428 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
429 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
432 ;; tramp configuration
433 (setq tramp-use-ssh-controlmaster-options nil)
436 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
437 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
439 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
440 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
441 (defun my-message-mode-settings ()
442 (font-lock-add-keywords nil
443 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
444 (0 'message-multiply-quoted-text-face))
445 ("^[ \t]*>[ \t]*>.*$"
446 (0 'message-double-quoted-text-face))))
447 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
449 (add-hook 'message-mode-hook 'my-message-mode-settings)
451 (defun my-post-attach-file ()
452 "Prompt for an attachment."
454 (let ((file (read-file-name "Attach file: " nil nil t nil))
455 (description (string-read "Description: ")))
456 (my-header-attach-file file description)))
458 (symbol-function 'my-post-attach-file)
460 (defun my-header-attach-file (file description)
461 "Attach a FILE to the current message (works with Mutt).
462 Argument DESCRIPTION MIME description."
463 (interactive "fAttach file: \nsDescription: ")
464 (when (> (length file) 0)
469 (goto-char (point-min))
470 (search-forward-regexp "^$")
471 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
473 (message (concat "Attached '" file "'."))
474 (setq post-has-attachment t))))))
478 (setq mail-yank-prefix "> ")
480 (global-unset-key "\M-g")
481 (global-set-key "\M-g" 'goto-line)
483 ;; self-insert-command hack.
484 ;; Without this, "if<SP>" expands to
487 ;; which really should be,
493 ;(load-library "php-mode")
495 (setq-default c-indent-level 4)
496 (setq-default c-brace-imaginary-offset 0)
497 (setq-default c-brace-offset -4)
498 (setq-default c-argdecl-indent 4)
499 (setq-default c-label-offset -4)
500 (setq-default c-continued-statement-offset 4)
502 (setq-default indent-tabs-mode nil)
503 (setq-default tab-width 4)
506 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
507 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
508 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
509 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
510 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
513 (defun insert-date ()
514 "Insert date at point."
516 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
517 (global-set-key "\C-[d" 'insert-date)
519 (defun unfill-paragraph (arg)
520 "Pull this whole paragraph up onto one line."
522 (let ((fill-column 10000))
523 (fill-paragraph arg))
526 (column-number-mode t)
527 (setq-default reftex-plug-into-AUCTeX t)
531 ; (require 'mode-compile)
533 (defadvice server-process-filter (after post-mode-message first activate)
534 "If the buffer is in post mode, overwrite the server-edit
535 message with a post-save-current-buffer-and-exit message."
536 (if (eq major-mode 'post-mode)
538 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
539 ; This is also needed to see the magic message. Set to a higher
540 ; number if you have a faster computer or read slower than me.
541 '(font-lock-verbose 1000)
542 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
543 ; (add-hook 'server-switch-hook
544 ; (function (lambda()
545 ; (cond ((string-match "Post" mode-name)
547 ; set-buffer-file-coding-system 'utf-8
551 (add-hook 'post-mode-hook
554 ; abbrev mode settings
555 ; load abbreviations from
556 (setq abbrev-file-name
557 "~/.emacs_abbrev_def")
559 ; read the abbrev file if it exists
560 (if (file-exists-p abbrev-file-name)
561 (quietly-read-abbrev-file))
563 ; for now, use abbrev mode everywhere
564 (setq default-abbrev-mode t)
567 (defun insert-function-documentation ()
568 "Insert function documentation"
570 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
571 (global-set-key "\M-f" 'insert-function-documentation)
573 (eval-after-load "lilypond-mode"
575 (load-library "lyqi-mode")
576 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
578 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
580 (desktop-load-default)
584 ;; custom-set-faces was added by Custom.
585 ;; If you edit it by hand, you could mess it up, so be careful.
586 ;; Your init file should contain only one such instance.
587 ;; If there is more than one, they won't work right.
588 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
591 (put 'upcase-region 'disabled nil)
592 (put 'downcase-region 'disabled nil)
593 (put 'narrow-to-region 'disabled nil)
596 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
597 (add-hook 'message-mode-hook 'turn-on-flyspell)
598 (add-hook 'text-mode-hook 'turn-on-flyspell)
599 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
600 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
601 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
602 ; (defun turn-on-flyspell ()
603 ; "Force flyspell-mode on using a positive arg. For use in hooks."
608 ; Outline-minor-mode key map
609 (define-prefix-command 'cm-map nil "Outline-")
611 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
612 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
613 (define-key cm-map "o" 'hide-other) ; Hide other branches
614 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
615 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
616 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
618 (define-key cm-map "a" 'show-all) ; Show (expand) everything
619 (define-key cm-map "e" 'show-entry) ; Show this heading's body
620 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
621 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
622 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
624 (define-key cm-map "u" 'outline-up-heading) ; Up
625 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
626 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
627 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
628 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
629 (global-set-key "\M-o" cm-map)
633 (setq-default debian-changelog-mailing-address "don@debian.org")
634 (setq-default debian-changelog-full-name "Don Armstrong")
636 ; ediff configuration
637 ; don't use the multi-window configuration
638 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
642 (define-key global-map (kbd "C-;") 'iedit-mode)
643 (global-set-key (kbd "C-;") 'iedit-mode)
645 ; fix up css mode to not be silly
646 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
647 (setq cssm-indent-level 4)
648 (setq cssm-newline-before-closing-bracket t)
649 (setq cssm-indent-function #'cssm-c-style-indenter)
650 (setq cssm-mirror-mode nil)
652 (require 'multi-web-mode)
653 (setq mweb-default-major-mode 'html-mode)
654 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
655 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
656 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
657 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
658 (multi-web-global-mode 1)
660 ;;; alias the new `flymake-report-status-slim' to
661 ;;; `flymake-report-status'
662 (defalias 'flymake-report-status 'flymake-report-status-slim)
663 (defun flymake-report-status-slim (e-w &optional status)
664 "Show \"slim\" flymake status in mode line."
666 (setq flymake-mode-line-e-w e-w))
668 (setq flymake-mode-line-status status))
669 (let* ((mode-line " Φ"))
670 (when (> (length flymake-mode-line-e-w) 0)
671 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
672 (setq mode-line (concat mode-line flymake-mode-line-status))
673 (setq flymake-mode-line mode-line)
674 (force-mode-line-update)))
676 ; load sql-indent when sql is loaded
677 (eval-after-load "sql"
678 '(load-library "sql-indent"))
680 ; fix up tmux xterm keys
681 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
684 (let ((x 2) (tkey ""))
704 ;; ctrl + alt + shift
706 (setq tkey "C-M-S-"))
709 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
710 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
711 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
712 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
714 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
716 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
718 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
720 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
722 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
724 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
726 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
728 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
730 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
732 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
734 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
736 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
738 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
740 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
742 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
744 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
746 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
748 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
750 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
752 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
754 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
756 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
758 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
760 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
762 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
764 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
771 ; procmailmode configuration
772 (load "procmail_mode")
774 (load "mode-line-cleaner")
776 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
777 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
778 (if (or (buffer-modified-p)
779 (verify-visited-file-modtime)
780 (< (* 8 1024 1024) (buffer-size))
781 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
783 (clear-visited-file-modtime)
785 (ad-activate 'ask-user-about-supersession-threat)
787 ; apparently things like to step on C-;, so we'll use a hack from
788 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
790 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
792 ; use iedit everywhere
793 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
795 (define-minor-mode my-keys-minor-mode
796 "A minor mode so that my key settings override annoying major modes."
797 t " my-keys" 'my-keys-minor-mode-map)
799 (my-keys-minor-mode 1)
800 (defun my-minibuffer-setup-hook ()
801 (my-keys-minor-mode 0))
803 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
804 (defadvice load (after give-my-keybindings-priority)
805 "Try to ensure that my keybindings always have priority."
806 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
807 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
808 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
809 (add-to-list 'minor-mode-map-alist mykeys))))
811 (global-set-key "\M- " 'hippie-expand)
816 #+BEGIN_SRC emacs-lisp
817 (provide 'don-configuration)