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)
126 #+BEGIN_SRC emacs-lisp
127 (defun my/vsplit-last-buffer ()
128 "Split the window vertically and display the previous buffer."
130 (split-window-vertically)
132 (switch-to-next-buffer))
134 (defun my/hsplit-last-buffer ()
135 "Split the window horizontally and display the previous buffer."
137 (split-window-horizontally)
139 (switch-to-next-buffer))
141 (bind-key "C-x 2" 'my/vsplit-last-buffer)
142 (bind-key "C-x 3" 'my/hsplit-last-buffer)
144 (setq split-width-threshold 100)
145 (setq split-height-threshold 60)
147 (defun my/split-window-prefer-horizontally (window)
148 "If there's only one window (excluding any possibly active
149 minibuffer), then split the current window horizontally."
150 (if (and (one-window-p t)
151 (not (active-minibuffer-window))
152 ( > (frame-width) (frame-height))
154 (let ((split-height-threshold nil))
155 (split-window-sensibly window))
156 (split-window-sensibly window)))
158 (setq split-window-preferred-function #'my/split-window-prefer-horizontally)
159 (setq window-combination-resize t)
162 *** Compilation window
164 If there is no compilation window, open one at the bottom, spanning
165 the complete width of the frame. Otherwise, reuse existing window. In
166 the former case, if there was no error the window closes
169 #+BEGIN_SRC emacs-lisp
170 (add-to-list 'display-buffer-alist
171 `(,(rx bos "*compilation*" eos)
172 (display-buffer-reuse-window
173 display-buffer-in-side-window)
174 (reusable-frames . visible)
176 (window-height . 0.4)))
179 #+BEGIN_SRC emacs-lisp
180 (defun my/compilation-exit-autoclose (status code msg)
181 ;; If M-x compile exists with a 0
182 (when (and (eq status 'exit) (zerop code))
183 ;; and delete the *compilation* window
184 (let ((compilation-window (get-buffer-window (get-buffer "*compilation*"))))
185 (when (and (not (window-at-side-p compilation-window 'top))
186 (window-at-side-p compilation-window 'left)
187 (window-at-side-p compilation-window 'right))
188 (delete-window compilation-window))))
189 ;; Always return the anticipated result of compilation-exit-message-function
192 ;; Specify my function (maybe I should have done a lambda function)
193 (setq compilation-exit-message-function #'my/compilation-exit-autoclose)
196 If you change the variable ~compilation-scroll-output~ to a ~non-nil~
197 value, the compilation buffer scrolls automatically to follow the
198 output. If the value is ~first-error~, scrolling stops when the first
199 error appears, leaving point at that error. For any other non-nil
200 value, scrolling continues until there is no more output.
202 #+BEGIN_SRC emacs-lisp
203 (setq compilation-scroll-output 'first-error)
206 ** Mode line cleaning
208 #+BEGIN_SRC emacs-lisp
209 (use-package diminish
214 #+BEGIN_SRC emacs-lisp
221 #+BEGIN_SRC emacs-lisp
223 (with-library 'tinyprocmail
224 ; (setq tinyprocmail--procmail-version "v3.22")
225 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
229 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
230 ; don't verify where we are pushing
231 (setq magit-push-always-verify nil)
232 ;; refine diffs always (hilight words)
233 (setq magit-diff-refine-hunk nil)
236 (append '("~/lib/emacs_el/magit-annex")
238 (require 'magit-annex)
242 #+BEGIN_SRC emacs-lisp
243 (require 'cperl-mode)
244 ;; Use c-mode for perl .xs files
245 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
246 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
247 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
248 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
249 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
252 cperl-auto-newline nil
253 cperl-auto-newline-after-colon nil
254 cperl-continued-statement-offset 4
255 cperl-brace-offset -1
256 cperl-continued-brace-offset 0
257 cperl-label-offset -4
258 cperl-highlight-variables-indiscriminately t
259 cperl-electric-lbrace-space nil
260 cperl-indent-parens-as-block nil
261 cperl-close-paren-offset -1
262 cperl-tab-always-indent t)
263 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
267 #+BEGIN_SRC emacs-lisp
271 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
276 #+BEGIN_SRC emacs-lisp
277 (add-to-list 'tramp-methods '("vcsh"
278 (tramp-login-program "vcsh")
282 (tramp-remote-shell "/bin/sh")
283 (tramp-remote-shell-args
287 #+BEGIN_SRC emacs-lisp
288 (load "auctex.el" nil t t)
289 (load "preview-latex.el" nil t t)
290 (load "latex.el" nil t t)
292 ;; this is in the very newest auctex; avoid for now
293 (add-to-list 'LaTeX-fill-excluded-macros
295 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
296 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
297 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
298 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
299 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
300 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
301 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
302 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
303 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
304 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
306 ; use smart quotes by default instead of `` and ''
307 ; taken from http://kieranhealy.org/esk/kjhealy.html
308 (setq TeX-open-quote "“")
309 (setq TeX-close-quote "”")
311 ;; (TeX-add-style-hook
316 ;; (custom-set-variables
317 ;; '(font-latex-user-keyword-classes
320 ;; font-lock-function-name-face 2 (command 1 t))))
323 (require 'font-latex)
324 (setq font-latex-match-reference-keywords
340 ; (setq font-latex-match-warning-keywords
348 (setq-default TeX-parse-self t)
349 (setq-default TeX-auto-save t)
350 (setq-default TeX-master nil)
356 (if (boundp 'reftex-ref-style-alist)
358 'reftex-ref-style-alist
359 '("Cleveref" "cleveref"
360 (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
361 (reftex-ref-style-activate "Cleveref")
363 '("cref" TeX-arg-ref)
364 '("Cref" TeX-arg-ref)
365 '("cpageref" TeX-arg-ref)
366 '("Cpageref" TeX-arg-ref)))))
367 ;; this doesn't seem to work; not currently sure why
368 ; (setq font-latex-user-keyword-classes
369 ; '(("my-warning-commands"
376 ; (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
379 (setq-default reftex-default-bibliography
380 '("~/projects/research/references.bib"))
385 #+BEGIN_SRC emacs-lisp
386 (require 'org-mode-configuration)
389 #+BEGIN_SRC emacs-lisp
390 (require 'ess_configuration)
395 #+BEGIN_SRC emacs-lisp
397 (append '("~/lib/emacs_el/polymode/modes")
401 (require 'poly-noweb)
402 (require 'poly-markdown)
403 (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
404 (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
405 (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
409 ** Override other things
410 #+BEGIN_SRC emacs-lisp
411 ; apparently things like to step on C-;, so we'll use a hack from
412 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
414 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
416 ; use iedit everywhere
417 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
418 ;; use outline mode keybindings everywhere
419 (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
421 (define-minor-mode my-keys-minor-mode
422 "A minor mode so that my key settings override annoying major modes."
423 t " my-keys" 'my-keys-minor-mode-map)
425 (my-keys-minor-mode 1)
426 (defun my-minibuffer-setup-hook ()
427 (my-keys-minor-mode 0))
429 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
430 (defadvice load (after give-my-keybindings-priority)
431 "Try to ensure that my keybindings always have priority."
432 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
433 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
434 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
435 (add-to-list 'minor-mode-map-alist mykeys))))
439 * Mis1c (uncharacterized)
440 #+BEGIN_SRC emacs-lisp
441 (setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
442 (setq calendar-latitude 40.11)
443 (setq calendar-longitude -88.24)
444 (setq case-fold-search t)
445 (setq confirm-kill-emacs (quote y-or-n-p))
446 (setq cperl-lazy-help-time nil)
447 (setq debian-changelog-mailing-address "don@debian.org")
449 (setq display-time-24hr-format t)
450 (setq display-time-day-and-date t)
451 (display-time-mode 1)
452 (setq font-latex-fontify-script nil)
453 (setq font-latex-fontify-sectioning (quote color))
454 (setq font-latex-script-display (quote (nil)))
455 (global-auto-revert-mode 1)
456 (global-font-lock-mode 1)
458 (setq log-edit-keep-buffer t)
459 (setq mail-user-agent (quote sendmail-user-agent))
460 (setq markdown-enable-math t)
461 (setq markdown-follow-wiki-link-on-enter nil)
462 (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
463 (setq post-email-address "don@donarmstrong.com")
464 (setq post-kill-quoted-sig nil)
465 (setq post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
466 (setq post-uses-fill-mode nil)
467 (setq ps-footer-font-size (quote (8 . 10)))
468 (setq ps-header-font-size (quote (8 . 10)))
469 (setq ps-header-title-font-size (quote (10 . 10)))
470 (setq ps-line-number-color "blue")
471 (setq ps-print-footer t)
472 (setq ps-print-footer-frame nil)
473 (setq ps-print-only-one-header t)
474 (setq safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
475 (setq sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
477 (setq sentence-end-double-space nil)
478 ; enable matching parenthesis
481 (setq user-mail-address "don@donarmstrong.com")
482 (setq vc-delete-logbuf-window nil)
483 (setq vc-follow-symlinks t)
485 ;; use git before SVN; use CVS earlier, because I have CVS
486 ;; repositories inside of git directories
487 (setq vc-handled-backends (quote (CVS Git RCS SVN SCCS Bzr Hg Mtn Arch)))
489 ;; switch back to the old primary selection method
490 (setq x-select-enable-clipboard nil)
491 (setq x-select-enable-primary t)
492 ; (setq mouse-drag-copy-region t)
494 (fset 'perl-mode 'cperl-mode)
495 ;;(load-file "cperl-mode.el")
501 ;;(require 'ecasound)
502 ;;(require 'emacs-wiki)
506 ; (require 'google-weather)
507 ; (require 'org-google-weather)
508 ; (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
510 ; http://julien.danjou.info/projects/emacs-packages#rainbow-mode
511 ; this colorizes color strings
512 (require 'rainbow-mode)
513 ; add ess to the x major mode
514 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
515 (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
517 (global-set-key "\C-xp" 'server-edit)
519 (setq-default auto-mode-alist (cons '("\.wml$" .
520 (lambda () (html-mode) (auto-fill-mode)))
524 ; use markdown mode for mdwn files
525 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
526 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
529 ;; tramp configuration
530 (setq tramp-use-ssh-controlmaster-options nil)
533 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . message-mode))
534 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
536 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . message-mode))
537 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
538 (defun my-message-mode-settings ()
539 (font-lock-add-keywords nil
540 '(("^[ \t]*>[ \t]*>[ \t]*>.*$"
541 (0 'message-multiply-quoted-text-face))
542 ("^[ \t]*>[ \t]*>.*$"
543 (0 'message-double-quoted-text-face))))
544 (local-set-key (kbd "C-c C-a") 'my-post-attach-file)
546 (add-hook 'message-mode-hook 'my-message-mode-settings)
548 (defun my-post-attach-file ()
549 "Prompt for an attachment."
551 (let ((file (read-file-name "Attach file: " nil nil t nil))
552 (description (string-read "Description: ")))
553 (my-header-attach-file file description)))
555 (symbol-function 'my-post-attach-file)
557 (defun my-header-attach-file (file description)
558 "Attach a FILE to the current message (works with Mutt).
559 Argument DESCRIPTION MIME description."
560 (interactive "fAttach file: \nsDescription: ")
561 (when (> (length file) 0)
566 (goto-char (point-min))
567 (search-forward-regexp "^$")
568 (insert (concat "Attach: " (replace-regexp-in-string "\\([[:space:]\\]\\)" "\\\\\\1" (file-truename file)) " "
570 (message (concat "Attached '" file "'."))
571 (setq post-has-attachment t))))))
575 (setq mail-yank-prefix "> ")
577 (global-unset-key "\M-g")
578 (global-set-key "\M-g" 'goto-line)
580 ;; self-insert-command hack.
581 ;; Without this, "if<SP>" expands to
584 ;; which really should be,
590 ;(load-library "php-mode")
592 (setq-default c-indent-level 4)
593 (setq-default c-brace-imaginary-offset 0)
594 (setq-default c-brace-offset -4)
595 (setq-default c-argdecl-indent 4)
596 (setq-default c-label-offset -4)
597 (setq-default c-continued-statement-offset 4)
599 (setq-default indent-tabs-mode nil)
600 (setq-default tab-width 4)
603 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
604 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
605 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
606 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
607 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
610 (defun insert-date ()
611 "Insert date at point."
613 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
614 (global-set-key "\C-[d" 'insert-date)
616 (defun unfill-paragraph (arg)
617 "Pull this whole paragraph up onto one line."
619 (let ((fill-column 10000))
620 (fill-paragraph arg))
623 (column-number-mode t)
624 (setq-default reftex-plug-into-AUCTeX t)
628 ; (require 'mode-compile)
630 (defadvice server-process-filter (after post-mode-message first activate)
631 "If the buffer is in post mode, overwrite the server-edit
632 message with a post-save-current-buffer-and-exit message."
633 (if (eq major-mode 'post-mode)
635 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
636 ; This is also needed to see the magic message. Set to a higher
637 ; number if you have a faster computer or read slower than me.
638 '(font-lock-verbose 1000)
639 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
640 ; (add-hook 'server-switch-hook
641 ; (function (lambda()
642 ; (cond ((string-match "Post" mode-name)
644 ; set-buffer-file-coding-system 'utf-8
648 (add-hook 'post-mode-hook
651 ; abbrev mode settings
652 ; load abbreviations from
653 (setq abbrev-file-name
654 "~/.emacs_abbrev_def")
656 ; read the abbrev file if it exists
657 (if (file-exists-p abbrev-file-name)
658 (quietly-read-abbrev-file))
660 ; for now, use abbrev mode everywhere
661 (setq default-abbrev-mode t)
664 (defun insert-function-documentation ()
665 "Insert function documentation"
667 (insert-file-contents "/home/don/lib/templates/perl_function_documentation" nil))
668 (global-set-key "\M-f" 'insert-function-documentation)
670 (eval-after-load "lilypond-mode"
672 (load-library "lyqi-mode")
673 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
675 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
677 (desktop-load-default)
681 ;; custom-set-faces was added by Custom.
682 ;; If you edit it by hand, you could mess it up, so be careful.
683 ;; Your init file should contain only one such instance.
684 ;; If there is more than one, they won't work right.
685 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
688 (put 'upcase-region 'disabled nil)
689 (put 'downcase-region 'disabled nil)
690 (put 'narrow-to-region 'disabled nil)
693 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
694 (add-hook 'message-mode-hook 'turn-on-flyspell)
695 (add-hook 'text-mode-hook 'turn-on-flyspell)
696 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
697 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
698 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
699 ; (defun turn-on-flyspell ()
700 ; "Force flyspell-mode on using a positive arg. For use in hooks."
705 ; Outline-minor-mode key map
706 (define-prefix-command 'cm-map nil "Outline-")
708 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
709 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
710 (define-key cm-map "o" 'hide-other) ; Hide other branches
711 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
712 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
713 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
715 (define-key cm-map "a" 'show-all) ; Show (expand) everything
716 (define-key cm-map "e" 'show-entry) ; Show this heading's body
717 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
718 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
719 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
721 (define-key cm-map "u" 'outline-up-heading) ; Up
722 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
723 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
724 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
725 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
726 (global-set-key "\M-o" cm-map)
730 (setq-default debian-changelog-mailing-address "don@debian.org")
731 (setq-default debian-changelog-full-name "Don Armstrong")
733 ; ediff configuration
734 ; don't use the multi-window configuration
735 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
739 (define-key global-map (kbd "C-;") 'iedit-mode)
740 (global-set-key (kbd "C-;") 'iedit-mode)
742 ; fix up css mode to not be silly
743 ; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
744 (setq cssm-indent-level 4)
745 (setq cssm-newline-before-closing-bracket t)
746 (setq cssm-indent-function #'cssm-c-style-indenter)
747 (setq cssm-mirror-mode nil)
749 (require 'multi-web-mode)
750 (setq mweb-default-major-mode 'html-mode)
751 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
752 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
753 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
754 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
755 (multi-web-global-mode 1)
757 ;;; alias the new `flymake-report-status-slim' to
758 ;;; `flymake-report-status'
759 (defalias 'flymake-report-status 'flymake-report-status-slim)
760 (defun flymake-report-status-slim (e-w &optional status)
761 "Show \"slim\" flymake status in mode line."
763 (setq flymake-mode-line-e-w e-w))
765 (setq flymake-mode-line-status status))
766 (let* ((mode-line " Φ"))
767 (when (> (length flymake-mode-line-e-w) 0)
768 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
769 (setq mode-line (concat mode-line flymake-mode-line-status))
770 (setq flymake-mode-line mode-line)
771 (force-mode-line-update)))
773 ; load sql-indent when sql is loaded
774 (eval-after-load "sql"
775 '(load-library "sql-indent"))
777 ; fix up tmux xterm keys
778 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
781 (let ((x 2) (tkey ""))
801 ;; ctrl + alt + shift
803 (setq tkey "C-M-S-"))
806 (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
807 (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
808 (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
809 (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
811 (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
813 (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
815 (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
817 (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
819 (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
821 (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
823 (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
825 (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
827 (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
829 (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
831 (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
833 (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
835 (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
837 (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
839 (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
841 (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
843 (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
845 (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
847 (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
849 (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
851 (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
853 (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
855 (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
857 (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
859 (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
861 (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
868 ; procmailmode configuration
869 (load "procmail_mode")
871 (load "mode-line-cleaner")
873 (defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
874 "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
875 (if (or (buffer-modified-p)
876 (verify-visited-file-modtime)
877 (< (* 8 1024 1024) (buffer-size))
878 (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
880 (clear-visited-file-modtime)
882 (ad-activate 'ask-user-about-supersession-threat)
884 ; apparently things like to step on C-;, so we'll use a hack from
885 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
887 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
889 ; use iedit everywhere
890 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
892 (define-minor-mode my-keys-minor-mode
893 "A minor mode so that my key settings override annoying major modes."
894 t " my-keys" 'my-keys-minor-mode-map)
896 (my-keys-minor-mode 1)
897 (defun my-minibuffer-setup-hook ()
898 (my-keys-minor-mode 0))
900 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
901 (defadvice load (after give-my-keybindings-priority)
902 "Try to ensure that my keybindings always have priority."
903 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
904 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
905 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
906 (add-to-list 'minor-mode-map-alist mykeys))))
908 (global-set-key "\M- " 'hippie-expand)
913 #+BEGIN_SRC emacs-lisp
914 (provide 'don-configuration)