2 ;; custom-set-variables was added by Custom.
3 ;; If you edit it by hand, you could mess it up, so be careful.
4 ;; Your init file should contain only one such instance.
5 ;; If there is more than one, they won't work right.
6 '(bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
7 '(calendar-latitude [33 57 north])
8 '(calendar-longitude [117 24 west])
10 '(confirm-kill-emacs (quote y-or-n-p))
11 '(cperl-lazy-help-time nil)
12 '(debian-changelog-mailing-address "don@debian.org")
14 '(display-time-24hr-format t)
15 '(display-time-day-and-date t)
16 '(display-time-mode t)
17 '(font-latex-fontify-script nil)
18 '(font-latex-fontify-sectioning (quote color))
19 '(font-latex-script-display (quote (nil)))
20 '(global-auto-revert-mode t)
21 '(global-font-lock-mode t nil (font-lock))
22 '(global-set-key "\347" t)
24 '(iswitchb-prompt-newbuffer nil)
25 '(log-edit-keep-buffer t)
26 '(mail-user-agent (quote sendmail-user-agent))
27 '(markdown-enable-math t)
28 '(markdown-follow-wiki-link-on-enter nil)
29 '(mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
30 '(post-email-address "don@donarmstrong.com")
31 '(post-kill-quoted-sig nil)
32 '(post-mail-message "mutt\\(ng\\|\\)-[a-z0-9]+-[0-9]+-.*")
33 '(post-uses-fill-mode nil)
34 '(ps-footer-font-size (quote (8 . 10)))
35 '(ps-header-font-size (quote (8 . 10)))
36 '(ps-header-title-font-size (quote (10 . 10)))
37 '(ps-line-number-color "blue")
39 '(ps-print-footer-frame nil)
40 '(ps-print-only-one-header t)
41 '(safe-local-variable-values (quote ((auto-save-default) (make-backup-files))))
42 '(sentence-end "[.?!][]\"')]*\\($\\| \\| \\)[
44 '(sentence-end-double-space nil)
46 '(tool-bar-mode nil nil (tool-bar))
47 '(user-mail-address "don@donarmstrong.com")
48 '(vc-delete-logbuf-window nil)
49 '(vc-follow-symlinks t))
52 ;; switch back to the old primary selection method
53 (setq x-select-enable-clipboard nil)
54 (setq x-select-enable-primary t)
55 ; (setq mouse-drag-copy-region t)
57 (fset 'perl-mode 'cperl-mode)
58 ;;(load-file "cperl-mode.el")
59 (add-to-list 'load-path '"~/lib/emacs_el/")
60 ;; this is the tiny-tools module from https://github.com/jaalto/project--emacs-tiny-tools.git
61 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/tiny")
62 (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/other")
63 ;;(add-to-list 'Tex-style-path '"~/lib/emacs_el/auctex/")
65 (setq tinyprocmail--procmail-version "v3.22")
66 (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install)
67 (require 'tinyprocmail)
73 ;;(require 'emacs-wiki)
77 (require 'google-weather)
78 (require 'org-google-weather)
79 (setq-default org-google-weather-format "%i %c, [%l,%h] %s %C")
81 ; org mode agenda files
82 (setq org-agenda-files
83 (quote ("~/projects/debbugs/notes.org"
84 "~/projects/notes/notes.org"
85 "~/projects/origins_of_life/ool.org"
86 "~/projects/sysadmin/sndservers/sndservers.org"
87 "~/projects/chaim/chaim.org"
88 "~/projects/fh/fh.org")))
90 (setq org-global-properties '(("Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")))
91 (setq org-global-columns-default-format "%40ITEM(Task) %TAGS %PRIORITY %TODO %17Effort(Estimated Effort){:} %CLOCKSUM")
93 (setq org-default-notes-file "~/projects/notes/notes.org")
94 (setq org-capture-templates ;; mail-specific note template, identified by "m"
95 '(("m" "Mail" entry (file+headline "~/projects/notes/refile.org" "Mail")
96 "* %?\n\n Source: %u, %c\n %i")
97 ("t" "todo" entry (file "~/projects/notes/refile.org")
98 "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
99 ("r" "respond" entry (file "~/projects/notes/refile.org")
100 "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
101 ("n" "note" entry (file "~/projects/notes/refile.org")
102 "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
103 ("j" "Journal" entry (file+datetree "~/projects/notes/diary.org")
104 "* %?\n%U\n" :clock-in t :clock-resume t)
105 ("w" "org-protocol" entry (file "~/projects/notes/refile.org")
106 "* TODO Review %c\n%U\n" :immediate-finish t)
107 ("p" "Phone call" entry (file "~/projects/notes/refile.org")
108 "* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
109 ("h" "Habit" entry (file "~/projects/notes/refile.org")
110 "* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n")
114 ;; Remove empty LOGBOOK drawers on clock out
115 (defun bh/remove-empty-drawer-on-clock-out ()
118 (beginning-of-line 0)
119 (org-remove-empty-drawer-at "LOGBOOK" (point))))
121 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
124 ; this is from http://doc.norang.ca/org-mode.html#Capture
125 ; use C-M-r for org mode capture
126 (global-set-key (kbd "C-M-r") 'org-capture)
128 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
129 (setq org-refile-targets (quote ((nil :maxlevel . 9)
130 (org-agenda-files :maxlevel . 9))))
132 ; Use full outline paths for refile targets - we file directly with IDO
133 (setq org-refile-use-outline-path t)
135 ; Targets complete directly with IDO
136 (setq org-outline-path-complete-in-steps nil)
138 ; Allow refile to create parent tasks with confirmation
139 (setq org-refile-allow-creating-parent-nodes (quote confirm))
141 ; Use IDO for both buffer and file completion and ido-everywhere to t
142 (setq org-completion-use-ido t)
143 (setq ido-everywhere t)
144 (setq ido-max-directory-size 100000)
145 (ido-mode (quote both))
148 ; Exclude DONE state tasks from refile targets
149 (defun bh/verify-refile-target ()
150 "Exclude todo keywords with a done state from refile targets"
151 (not (member (nth 2 (org-heading-components)) org-done-keywords)))
153 (setq org-refile-target-verify-function 'bh/verify-refile-target)
155 ;; ensure that emacsclient will show just the note to be edited when invoked
156 ;; from Mutt, and that it will shut down emacsclient once finished;
157 ;; fallback to legacy behavior when not invoked via org-protocol.
158 (require 'org-protocol)
159 (add-hook 'org-capture-mode-hook 'delete-other-windows)
160 (setq my-org-protocol-flag nil)
161 (defadvice org-capture-finalize (after delete-frame-at-end activate)
162 "Delete frame at remember finalization"
163 (progn (if my-org-protocol-flag (delete-frame))
164 (setq my-org-protocol-flag nil)))
165 (defadvice org-capture-kill (after delete-frame-at-end activate)
166 "Delete frame at remember abort"
167 (progn (if my-org-protocol-flag (delete-frame))
168 (setq my-org-protocol-flag nil)))
169 (defadvice org-protocol-capture (before set-org-protocol-flag activate)
170 (setq my-org-protocol-flag t))
172 (global-set-key "\C-xp" 'server-edit)
174 (setq-default auto-mode-alist (cons '("\.wml$" .
175 (lambda () (html-mode) (auto-fill-mode)))
178 ;; Use c-mode for perl .xs files
179 (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
180 (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
181 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
182 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
183 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
185 (add-to-list 'auto-mode-alist '("muttng-[a-z0-9]+-[0-9]+-" . post-mode))
186 (add-to-list 'auto-mode-alist '("muttngrc" . muttrc-mode))
188 (add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-" . post-mode))
189 (add-to-list 'auto-mode-alist '("muttrc" . muttrc-mode))
191 (add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
195 (global-unset-key "\M-g")
196 (global-set-key "\M-g" 'goto-line)
198 ;;(autoload 'perl-mode "cperl-mode"
199 ;; "alternate mode for editing Perl programs" t)
201 ;; self-insert-command hack.
202 ;; Without this, "if<SP>" expands to
205 ;; which really should be,
208 (setq-default cperl-hairy t
210 ;; cperl-auto-newline t
211 ;; cperl-auto-newline-after-colon t
212 cperl-continued-statement-offset 4
213 cperl-brace-offset -4
214 cperl-label-offset -4
215 cperl-highlight-variables-indiscriminately t
216 cperl-electric-lbrace-space nil
218 (add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
222 ;(load-library "php-mode")
224 (setq-default c-indent-level 8)
225 (setq-default c-brace-imaginary-offset 0)
226 (setq-default c-brace-offset -8)
227 (setq-default c-argdecl-indent 8)
228 (setq-default c-label-offset -8)
229 (setq-default c-continued-statement-offset 8)
231 (setq-default indent-tabs-mode nil)
232 (setq-default tab-width 8)
235 ;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
236 ;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . php-mode))
237 ;; (add-to-list 'auto-mode-alist '("\\.phtml?\\'" . php-mode))
238 ;; (add-to-list 'auto-mode-alist '("\\.php?\\'" . php-mode))
239 ;; (add-to-list 'auto-mode-alist '("\\.php4?\\'" . php-mode))
241 ;; REFTEX (much enhanced management of cross-ref, labels, etc)
242 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
243 (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
244 (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
245 (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
246 (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
247 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
248 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
249 (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode
250 (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode
252 ;; (TeX-add-style-hook
257 ;; (custom-set-variables
258 ;; '(font-latex-user-keyword-classes
261 ;; font-lock-function-name-face 2 (command 1 t))))
264 (require 'font-latex)
265 (add-to-list 'font-latex-match-reference-keywords "fref")
266 (add-to-list 'font-latex-match-reference-keywords "Fref")
267 (add-to-list 'font-latex-match-reference-keywords "citep")
268 (add-to-list 'font-latex-match-reference-keywords "citet")
269 (font-latex-match-reference-make)
270 (add-to-list 'font-latex-match-function-keywords "DLA")
271 (add-to-list 'font-latex-match-function-keywords "RZ")
272 (add-to-list 'font-latex-match-function-keywords "OM")
273 (add-to-list 'font-latex-match-function-keywords "DL")
274 (add-to-list 'font-latex-match-function-keywords "fixme")
275 (add-to-list 'font-latex-match-function-keywords "acs")
276 (add-to-list 'font-latex-match-function-keywords "acsp")
277 (add-to-list 'font-latex-match-function-keywords "ac")
278 (add-to-list 'font-latex-match-function-keywords "acp")
279 (add-to-list 'font-latex-match-function-keywords "acl")
280 (add-to-list 'font-latex-match-function-keywords "aclp")
281 (add-to-list 'font-latex-match-function-keywords "acsu")
282 (add-to-list 'font-latex-match-function-keywords "aclu")
283 (add-to-list 'font-latex-match-function-keywords "acused")
284 (font-latex-match-function-make)
285 (setq-default TeX-parse-self t)
286 (setq-default TeX-auto-save t)
287 (setq-default TeX-master nil)
289 (defun insert-date ()
290 "Insert date at point."
292 (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %Z")))
293 (global-set-key "\C-[d" 'insert-date)
295 (defun unfill-paragraph (arg)
296 "Pull this whole paragraph up onto one line."
298 (let ((fill-column 10000))
299 (fill-paragraph arg))
302 ;(iswitchb-default-keybindings)
304 (column-number-mode t)
305 (setq-default reftex-plug-into-AUCTeX t)
309 (require 'mode-compile)
311 (setq-default reftex-default-bibliography
314 (defadvice server-process-filter (after post-mode-message first activate)
315 "If the buffer is in post mode, overwrite the server-edit
316 message with a post-save-current-buffer-and-exit message."
317 (if (eq major-mode 'post-mode)
319 (substitute-command-keys "Type \\[describe-mode] for help composing; \\[post-save-current-buffer-and-exit] when done."))))
320 ; This is also needed to see the magic message. Set to a higher
321 ; number if you have a faster computer or read slower than me.
322 '(font-lock-verbose 1000)
323 ;(setq-default server-temp-file-regexp "mutt\(-\|ng-\)")
324 ; (add-hook 'server-switch-hook
325 ; (function (lambda()
326 ; (cond ((string-match "Post" mode-name)
328 ; set-buffer-file-coding-system 'utf-8
332 (add-hook 'post-mode-hook
336 (fset 'insert-function-documentation
337 [?\C-x ?i home ?\C-k ?/ ?h ?o ?m ?e ?/ ?d ?o ?n ?/ ?l ?i ?b ?/ ?t ?e ?m ?p ?l ?a ?t ?e ?s ?/ ?p ?e ?r ?l ?_ ?f ?u ?n ?c ?t ?i ?o ?n ?_ ?d ?o ?c ?u ?m ?e ?n ?t ?a ?t ?i ?o ?n return])
338 (global-set-key "\M-f" 'insert-function-documentation)
340 (eval-after-load "lilypond-mode"
342 (load-library "lyqi-mode")
343 (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
345 (autoload 'spamassassin-mode "spamassassin-mode" nil t)
347 (desktop-load-default)
351 ;; custom-set-faces was added by Custom.
352 ;; If you edit it by hand, you could mess it up, so be careful.
353 ;; Your init file should contain only one such instance.
354 ;; If there is more than one, they won't work right.
355 '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
357 (defun ess-change-directory (path)
358 "Set the current working directory to PATH for both *R* and Emacs."
359 (interactive "DDirectory to change to: ")
361 (when (file-exists-p path)
362 (ess-command (concat "setwd(\"" path "\")\n"))
363 ;; use file-name-as-directory to ensure it has trailing /
364 (setq default-directory (file-name-as-directory path))))
366 (put 'upcase-region 'disabled nil)
367 (put 'downcase-region 'disabled nil)
368 (put 'narrow-to-region 'disabled nil)
370 ;; The following lines are always needed. Choose your own keys.
371 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
372 (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
373 (global-set-key "\C-cl" 'org-store-link)
374 (global-set-key "\C-ca" 'org-agenda)
375 (global-set-key "\C-cb" 'org-iswitchb)
376 (setq-default org-log-done 'time)
377 (setq-default org-agenda-ndays 5)
380 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
381 (add-hook 'message-mode-hook 'turn-on-flyspell)
382 (add-hook 'text-mode-hook 'turn-on-flyspell)
383 (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
384 (add-hook 'cperl-mode-hook 'flyspell-prog-mode)
385 (add-hook 'tcl-mode-hook 'flyspell-prog-mode)
386 (add-hook 'ess-mode-hook 'flyspell-prog-mode)
387 (defun turn-on-flyspell ()
388 "Force flyspell-mode on using a positive arg. For use in hooks."
392 ;;; outlining support for ess modes
393 (add-hook 'ess-mode-hook
396 (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function(.*{\\)")
398 (lambda () (interactive) (cond ((looking-at "^##### ") 1)((looking-at "^#### ") 2)((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3) (t 1000)))
401 ; Outline-minor-mode key map
402 (define-prefix-command 'cm-map nil "Outline-")
404 (define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
405 (define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
406 (define-key cm-map "o" 'hide-other) ; Hide other branches
407 (define-key cm-map "c" 'hide-entry) ; Hide this entry's body
408 (define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
409 (define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
411 (define-key cm-map "a" 'show-all) ; Show (expand) everything
412 (define-key cm-map "e" 'show-entry) ; Show this heading's body
413 (define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
414 (define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
415 (define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
417 (define-key cm-map "u" 'outline-up-heading) ; Up
418 (define-key cm-map "n" 'outline-next-visible-heading) ; Next
419 (define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
420 (define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
421 (define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
422 (global-set-key "\M-o" cm-map)
424 (defun my-org-mode-setup ()
425 (when (and (buffer-file-name)
426 (file-exists-p (buffer-file-name)))
427 (load-library "reftex")
428 (and (buffer-file-name)
429 (file-exists-p (buffer-file-name))
431 (reftex-set-cite-format
432 '((?b . "[[bib::%l]]")
433 (?n . "[[note::%l]]"))))
434 (define-key org-mode-map "\C-c\C-g" 'reftex-citation)
436 (add-hook 'org-mode-hook 'my-org-mode-setup)
438 (setq-default org-mobile-directory "/rzlab.ucr.edu:/sites/dav.donarmstrong.com/root/org/")
439 (setq-default org-directory "/home/don/org-mode/")
440 (setq-default org-mobile-inbox-for-pull "/home/don/org-mode/from-mobile.org")
443 (setq-default debian-changelog-mailing-address "don@debian.org")
444 (setq-default debian-changelog-full-name "Don Armstrong")
448 (define-key global-map (kbd "C-;") 'iedit-mode)
449 (global-set-key (kbd "C-;") 'iedit-mode)
451 (require 'multi-web-mode)
452 (setq mweb-default-major-mode 'html-mode)
453 (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
454 (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
455 (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
456 (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
457 (multi-web-global-mode 1)
459 ; clean-mode-line from http://www.masteringemacs.org/articles/2012/09/10/hiding-replacing-modeline-strings/
460 (defvar mode-line-cleaner-alist
461 `((auto-complete-mode . " α")
462 (yas/minor-mode . " υ")
463 (paredit-mode . " π")
466 (my-keys-minor-mode . "")
468 (lisp-interaction-mode . "λ")
473 (org-agenda-mode . "øα")
475 (emacs-lisp-mode . "EL")
476 (nxhtml-mode . "nx"))
477 "Alist for `clean-mode-line'.
479 When you add a new element to the alist, keep in mind that you
480 must pass the correct minor/major mode symbol and a string you
481 want to use in the modeline *in lieu of* the original.")
484 (defun clean-mode-line ()
486 (loop for cleaner in mode-line-cleaner-alist
487 do (let* ((mode (car cleaner))
488 (mode-str (cdr cleaner))
489 (old-mode-str (cdr (assq mode minor-mode-alist))))
491 (setcar old-mode-str mode-str))
493 (when (eq mode major-mode)
494 (setq mode-name mode-str)))))
497 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
499 ;;; alias the new `flymake-report-status-slim' to
500 ;;; `flymake-report-status'
501 (defalias 'flymake-report-status 'flymake-report-status-slim)
502 (defun flymake-report-status-slim (e-w &optional status)
503 "Show \"slim\" flymake status in mode line."
505 (setq flymake-mode-line-e-w e-w))
507 (setq flymake-mode-line-status status))
508 (let* ((mode-line " Φ"))
509 (when (> (length flymake-mode-line-e-w) 0)
510 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
511 (setq mode-line (concat mode-line flymake-mode-line-status))
512 (setq flymake-mode-line mode-line)
513 (force-mode-line-update)))
515 ; apparently things like to step on C-;, so we'll use a hack from
516 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
518 (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
520 ; use iedit everywhere
521 (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
523 (define-minor-mode my-keys-minor-mode
524 "A minor mode so that my key settings override annoying major modes."
525 t " my-keys" 'my-keys-minor-mode-map)
527 (my-keys-minor-mode 1)
528 (defun my-minibuffer-setup-hook ()
529 (my-keys-minor-mode 0))
531 (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
532 (defadvice load (after give-my-keybindings-priority)
533 "Try to ensure that my keybindings always have priority."
534 (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
535 (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
536 (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
537 (add-to-list 'minor-mode-map-alist mykeys))))