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)
68 #+BEGIN_SRC emacs-lisp
73 #+BEGIN_SRC emacs-lisp
75 (with-library 'tinyprocmail
76 ; (setq tinyprocmail--procmail-version "v3.22")
77 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
81 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
82 ; don't verify where we are pushing
83 (setq magit-push-always-verify nil)
84 ;; refine diffs always (hilight words)
85 (setq magit-diff-refine-hunk 'all)
88 (append '("~/lib/emacs_el/magit-annex")
90 (require 'magit-annex)
94 #+BEGIN_SRC emacs-lisp
96 ;; Use c-mode for perl .xs files
97 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
98 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
99 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
100 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
101 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
104 cperl-auto-newline nil
105 cperl-auto-newline-after-colon nil
106 cperl-continued-statement-offset 4
107 cperl-brace-offset -1
108 cperl-continued-brace-offset 0
109 cperl-label-offset -4
110 cperl-highlight-variables-indiscriminately t
111 cperl-electric-lbrace-space nil
112 cperl-indent-parens-as-block nil
113 cperl-close-paren-offset -1
114 cperl-tab-always-indent t)
115 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
119 #+BEGIN_SRC emacs-lisp
123 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
128 #+BEGIN_SRC emacs-lisp
129 (add-to-list 'tramp-methods '("vcsh"
130 (tramp-login-program "vcsh")
134 (tramp-remote-shell "/bin/sh")
135 (tramp-remote-shell-args
139 #+BEGIN_SRC emacs-lisp
140 (load "auctex.el" nil t t)
141 (load "preview-latex.el" nil t t)
142 (load "latex.el" nil t t)
144 ;; this is in the very newest auctex; avoid for now
145 (add-to-list 'LaTeX-fill-excluded-macros
147 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
148 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
149 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
150 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
151 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
152 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
153 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
154 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
155 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
156 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
158 ; use smart quotes by default instead of `` and ''
159 ; taken from http://kieranhealy.org/esk/kjhealy.html
160 (setq TeX-open-quote "“")
161 (setq TeX-close-quote "”")
163 ;; (TeX-add-style-hook
168 ;; (custom-set-variables
169 ;; '(font-latex-user-keyword-classes
172 ;; font-lock-function-name-face 2 (command 1 t))))
175 (require 'font-latex)
176 (setq font-latex-match-reference-keywords
192 ; (setq font-latex-match-warning-keywords
200 (setq-default TeX-parse-self t)
201 (setq-default TeX-auto-save t)
202 (setq-default TeX-master nil)
208 (if (boundp 'reftex-ref-style-alist)
210 'reftex-ref-style-alist
211 '("Cleveref" "cleveref"
212 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
213 (reftex-ref-style-activate "Cleveref")
215 '("cref" TeX-arg-ref)
216 '("Cref" TeX-arg-ref)
217 '("cpageref" TeX-arg-ref)
218 '("Cpageref" TeX-arg-ref)))))
219 ;; this doesn't seem to work; not currently sure why
220 ; (setq font-latex-user-keyword-classes
221 ; '(("my-warning-commands"
228 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
231 (setq-default reftex-default-bibliography
232 '("~/projects/research/references.bib"))
237 #+BEGIN_SRC emacs-lisp
238 (require 'org-mode-configuration)
241 #+BEGIN_SRC emacs-lisp
242 (require 'ess_configuration)
247 #+BEGIN_SRC emacs-lisp
249 (append '("~/lib/emacs_el/polymode/modes")
253 (require 'poly-noweb)
254 (require 'poly-markdown)
255 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
256 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
257 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
261 ** Override other things
262 #+BEGIN_SRC emacs-lisp
263 ; apparently things like to step on C-;, so we'll use a hack from
264 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
266 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
268 ; use iedit everywhere
269 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
270 ;; use outline mode keybindings everywhere
271 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
273 (define-minor-mode my-keys-minor-mode
274 "A minor mode so that my key settings override annoying major modes."
275 t " my-keys" 'my-keys-minor-mode-map)
277 (my-keys-minor-mode 1)
278 (defun my-minibuffer-setup-hook ()
279 (my-keys-minor-mode 0))
281 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
282 (defadvice load (after give-my-keybindings-priority)
283 "Try to ensure that my keybindings always have priority."
284 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
285 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
286 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
287 (add-to-list 'minor-mode-map-alist mykeys))))
291 * Misc (uncharacterized)
292 #+BEGIN_SRC emacs-lisp
293 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
294 (setq calendar-latitude 40.11)
295 (setq calendar-longitude -88.24)
296 (setq case-fold-search t)
297 (setq confirm-kill-emacs (quote y-or-n-p))
298 (setq cperl-lazy-help-time nil)
299 (setq debian-changelog-mailing-address "don@debian.org")
301 (setq display-time-24hr-format t)
302 (setq display-time-day-and-date t)
303 (display-time-mode 1)
304 (setq font-latex-fontify-script nil)
305 (setq font-latex-fontify-sectioning (quote color))
306 (setq font-latex-script-display (quote (nil)))
307 (global-auto-revert-mode 1)
308 (global-font-lock-mode 1)
310 (setq log-edit-keep-buffer t)
311 (setq mail-user-agent (quote sendmail-user-agent))
312 (setq markdown-enable-math t)
313 (setq markdown-follow-wiki-link-on-enter nil)
314 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
315 (setq post-email-address "don@donarmstrong.com")
316 (setq post-kill-quoted-sig nil)
317 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
318 (setq post-uses-fill-mode nil)
319 (setq ps-footer-font-size (quote (8 . 10)))
320 (setq ps-header-font-size (quote (8 . 10)))
321 (setq ps-header-title-font-size (quote (10 . 10)))
322 (setq ps-line-number-color "blue")
323 (setq ps-print-footer t)
324 (setq ps-print-footer-frame nil)
325 (setq ps-print-only-one-header t)
326 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
327 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
329 (setq sentence-end-double-space nil)
330 ; enable matching parenthesis
333 (setq user-mail-address "don@donarmstrong.com")
334 (setq vc-delete-logbuf-window nil)
335 (setq vc-follow-symlinks t)
337 ;; use git before SVN; use CVS earlier, because I have CVS
338 ;; repositories inside of git directories
339 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
341 ;; switch back to the old primary selection method
342 (setq x-select-enable-clipboard nil)
343 (setq x-select-enable-primary t)
344 ; (setq mouse-drag-copy-region t)
346 (fset 'perl-mode 'cperl-mode)
347 ;;(load-file "cperl-mode.el")
353 ;;(require 'ecasound)
354 ;;(require 'emacs-wiki)
358 ; (require 'google-weather)
359 ; (require 'org-google-weather)
360 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
362 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
363 ; this colorizes color strings
364 (require 'rainbow-mode)
365 ; add ess to the x major mode
366 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
367 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
369 (global-set-key "\C-xp" 'server-edit)
371 (setq-default auto-mode-alist (cons '("\.wml$" .
372 (lambda () (html-mode) (auto-fill-mode)))
376 ; use markdown mode for mdwn files
377 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
378 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
381 ;; tramp configuration
382 (setq tramp-use-ssh-controlmaster-options nil)
385 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
386 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
388 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
389 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
390 (defun my-message-mode-settings ()
391 (font-lock-add-keywords nil
392 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
393 (0 'message-multiply-quoted-text-face))
394 ("^[ \t]*>[ \t]*>.*$"
395 (0 'message-double-quoted-text-face))))
396 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
398 (add-hook 'message-mode-hook 'my-message-mode-settings)
400 (defun my-post-attach-file ()
401 "Prompt for an attachment."
403 (let ((file (read-file-name "Attach file: " nil nil t nil))
404 (description (string-read "Description: ")))
405 (my-header-attach-file file description)))
407 (symbol-function 'my-post-attach-file)
409 (defun my-header-attach-file (file description)
410 "Attach a FILE to the current message (works with Mutt).
411 Argument DESCRIPTION MIME description."
412 (interactive "fAttach file: \nsDescription: ")
413 (when (> (length file) 0)
418 (goto-char (point-min))
419 (search-forward-regexp "^$")
420 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
422 (message (concat "Attached '" file "'."))
423 (setq post-has-attachment t))))))
427 (setq mail-yank-prefix "> ")
429 (global-unset-key "\M-g")
430 (global-set-key "\M-g" 'goto-line)
432 ;; self-insert-command hack.
433 ;; Without this, "if<SP>" expands to
436 ;; which really should be,
442 ;(load-library "php-mode")
444 (setq-default c-indent-level 4)
445 (setq-default c-brace-imaginary-offset 0)
446 (setq-default c-brace-offset -4)
447 (setq-default c-argdecl-indent 4)
448 (setq-default c-label-offset -4)
449 (setq-default c-continued-statement-offset 4)
451 (setq-default indent-tabs-mode nil)
452 (setq-default tab-width 4)
455 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
456 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
457 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
458 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
459 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
462 (defun insert-date ()
463 "Insert date at point."
465 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
466 (global-set-key "\C-[d" 'insert-date)
468 (defun unfill-paragraph (arg)
469 "Pull this whole paragraph up onto one line."
471 (let ((fill-column 10000))
472 (fill-paragraph arg))
475 (column-number-mode t)
476 (setq-default reftex-plug-into-AUCTeX t)
480 ; (require 'mode-compile)
482 (defadvice server-process-filter (after post-mode-message first activate)
483 "If the buffer is in post mode, overwrite the server-edit
484 message with a post-save-current-buffer-and-exit message."
485 (if (eq major-mode 'post-mode)
487 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
488 ; This is also needed to see the magic message. Set to a higher
489 ; number if you have a faster computer or read slower than me.
490 '(font-lock-verbose 1000)
491 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
492 ; (add-hook 'server-switch-hook
493 ; (function (lambda()
494 ; (cond ((string-match "Post" mode-name)
496 ; set-buffer-file-coding-system 'utf-8
500 (add-hook 'post-mode-hook
503 ; abbrev mode settings
504 ; load abbreviations from
505 (setq abbrev-file-name
506 "~/.emacs_abbrev_def")
508 ; read the abbrev file if it exists
509 (if (file-exists-p abbrev-file-name)
510 (quietly-read-abbrev-file))
512 ; for now, use abbrev mode everywhere
513 (setq default-abbrev-mode t)
516 (defun insert-function-documentation ()
517 "Insert function documentation"
519 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
520 (global-set-key "\M-f" 'insert-function-documentation)
522 (eval-after-load "lilypond-mode"
524 (load-library "lyqi-mode")
525 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
527 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
529 (desktop-load-default)
533 ;; custom-set-faces was added by Custom.
534 ;; If you edit it by hand, you could mess it up, so be careful.
535 ;; Your init file should contain only one such instance.
536 ;; If there is more than one, they won't work right.
537 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
540 (put 'upcase-region 'disabled nil)
541 (put 'downcase-region 'disabled nil)
542 (put 'narrow-to-region 'disabled nil)
545 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
546 (add-hook 'message-mode-hook 'turn-on-flyspell)
547 (add-hook 'text-mode-hook 'turn-on-flyspell)
548 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
549 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
550 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
551 ; (defun turn-on-flyspell ()
552 ; "Force flyspell-mode on using a positive arg. For use in hooks."
557 ; Outline-minor-mode key map
558 (define-prefix-command 'cm-map nil "Outline-")
560 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
561 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
562 (define-key cm-map "o" 'hide-other) ; Hide other branches
563 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
564 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
565 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
567 (define-key cm-map "a" 'show-all) ; Show (expand) everything
568 (define-key cm-map "e" 'show-entry) ; Show this heading's body
569 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
570 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
571 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
573 (define-key cm-map "u" 'outline-up-heading) ; Up
574 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
575 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
576 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
577 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
578 (global-set-key "\M-o" cm-map)
582 (setq-default debian-changelog-mailing-address "don@debian.org")
583 (setq-default debian-changelog-full-name "Don Armstrong")
585 ; ediff configuration
586 ; don't use the multi-window configuration
587 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
591 (define-key global-map (kbd "C-;") 'iedit-mode)
592 (global-set-key (kbd "C-;") 'iedit-mode)
594 ; fix up css mode to not be silly
595 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
596 (setq cssm-indent-level 4)
597 (setq cssm-newline-before-closing-bracket t)
598 (setq cssm-indent-function #'cssm-c-style-indenter)
599 (setq cssm-mirror-mode nil)
601 (require 'multi-web-mode)
602 (setq mweb-default-major-mode 'html-mode)
603 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
604 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
605 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
606 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
607 (multi-web-global-mode 1)
609 ;;; alias the new `flymake-report-status-slim' to
610 ;;; `flymake-report-status'
611 (defalias 'flymake-report-status 'flymake-report-status-slim)
612 (defun flymake-report-status-slim (e-w &optional status)
613 "Show \"slim\" flymake status in mode line."
615 (setq flymake-mode-line-e-w e-w))
617 (setq flymake-mode-line-status status))
618 (let* ((mode-line " Φ"))
619 (when (> (length flymake-mode-line-e-w) 0)
620 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
621 (setq mode-line (concat mode-line flymake-mode-line-status))
622 (setq flymake-mode-line mode-line)
623 (force-mode-line-update)))
625 ; load sql-indent when sql is loaded
626 (eval-after-load "sql"
627 '(load-library "sql-indent"))
629 ; fix up tmux xterm keys
630 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
633 (let ((x 2) (tkey ""))
653 ;; ctrl + alt + shift
655 (setq tkey "C-M-S-"))
658 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
659 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
660 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
661 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
663 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
665 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
667 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
669 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
671 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
673 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
675 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
677 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
679 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
681 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
683 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
685 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
687 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
689 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
691 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
693 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
695 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
697 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
699 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
701 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
703 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
705 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
707 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
709 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
711 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
713 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
720 ; procmailmode configuration
721 (load "procmail_mode")
723 (load "mode-line-cleaner")
725 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
726 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
727 (if (or (buffer-modified-p)
728 (verify-visited-file-modtime)
729 (< (* 8 1024 1024) (buffer-size))
730 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
732 (clear-visited-file-modtime)
734 (ad-activate 'ask-user-about-supersession-threat)
736 ; apparently things like to step on C-;, so we'll use a hack from
737 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
739 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
741 ; use iedit everywhere
742 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
744 (define-minor-mode my-keys-minor-mode
745 "A minor mode so that my key settings override annoying major modes."
746 t " my-keys" 'my-keys-minor-mode-map)
748 (my-keys-minor-mode 1)
749 (defun my-minibuffer-setup-hook ()
750 (my-keys-minor-mode 0))
752 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
753 (defadvice load (after give-my-keybindings-priority)
754 "Try to ensure that my keybindings always have priority."
755 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
756 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
757 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
758 (add-to-list 'minor-mode-map-alist mykeys))))
760 (global-set-key "\M- " 'hippie-expand)
765 #+BEGIN_SRC emacs-lisp
766 (provide 'don-configuration)