]> git.donarmstrong.com Git - lib.git/blob - emacs_el/configuration/don-configuration.org
move reftex to don-configuration
[lib.git] / emacs_el / configuration / don-configuration.org
1 * Load debugger
2
3 # if for some reason, things get pear-shaped, we want to be able to
4 # enter the debugger by sending -USR2 to emacs
5
6 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
7 (setq debug-on-event 'siguser2)
8 #+END_SRC
9 * Add library paths
10
11 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
12   (add-to-list 'load-path '"~/lib/emacs_el/")
13   (add-to-list 'load-path '"~/lib/emacs_el/helm")
14   (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/tiny")
15   (add-to-list 'load-path '"~/lib/emacs_el/tiny-tools/lisp/other")
16   (add-to-list 'load-path '"~/lib/emacs_el/auctex/lisp")
17   (add-to-list 'load-path '"~/lib/emacs_el/ESS/lisp")
18 #+END_SRC
19
20
21 * Misc functions
22 ** with-library
23 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
24 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
25 ;; execute conditional code when loading libraries
26 (defmacro with-library (symbol &rest body)
27   `(when (require ,symbol nil t)
28      ,@body))
29 (put 'with-library 'lisp-indent-function 1)
30 #+END_SRC
31
32
33
34 * Modules
35 ** Tinyprocmail
36
37 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
38   ;; load tinyprocmail
39   (with-library 'tinyprocmail
40     ; (setq tinyprocmail--procmail-version "v3.22")
41     (add-hook 'tinyprocmail--load-hook 'tinyprocmail-install))
42 #+END_SRC
43
44 ** Magit
45 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
46   ; don't verify where we are pushing
47   (setq magit-push-always-verify nil)
48 #+END_SRC
49
50 ** Perl
51 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
52   (require 'cperl-mode)
53   ;; Use c-mode for perl .xs files
54   (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
55   (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
56   (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
57   (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
58   (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
59   (setq cperl-hairy t
60         cperl-indent-level 4
61         cperl-auto-newline nil
62         cperl-auto-newline-after-colon nil
63         cperl-continued-statement-offset 4
64         cperl-brace-offset -1
65         cperl-continued-brace-offset 0
66         cperl-label-offset -4
67         cperl-highlight-variables-indiscriminately t
68         cperl-electric-lbrace-space nil
69         cperl-indent-parens-as-block nil
70         cperl-close-paren-offset -1
71         cperl-tab-always-indent t)
72   ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
73 #+END_SRC
74
75 ** Helm
76 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
77 (require 'don-helm)
78 #+END_SRC
79 ** Hydra
80 #+BEGIN_SRC emacs-lisp :tangle don-configuration.el
81 (require 'don-hydra)
82 #+END_SRC
83
84 ** Tramp
85 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
86   (add-to-list 'tramp-methods '("vcsh"
87                                 (tramp-login-program "vcsh")
88                                 (tramp-login-args
89                                  (("enter")
90                                   ("%h")))
91                                 (tramp-remote-shell "/bin/sh")
92                                 (tramp-remote-shell-args
93                                  ("-c"))))
94 #+END_SRC
95 ** LaTeX
96 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
97   ; this is in the very newest auctex; avoid for now
98   (add-to-list 'LaTeX-fill-excluded-macros
99                '("Sexpr"))
100   ;; REFTEX (much enhanced management of cross-ref, labels, etc)
101   ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
102   (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
103   (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
104   (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
105   (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
106   (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
107   (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
108   (add-hook 'LaTeX-mode-hook 'outline-minor-mode)   ; with AUCTeX LaTeX mode
109   (add-hook 'latex-mode-hook 'outline-minor-mode)   ; with Emacs latex mode
110
111   ; use smart quotes by default instead of `` and ''
112   ; taken from http://kieranhealy.org/esk/kjhealy.html
113   (setq TeX-open-quote "“")
114   (setq TeX-close-quote "”")
115
116   ;; (TeX-add-style-hook
117   ;;  "latex"
118   ;;  (lambda ()
119   ;;    (TeX-add-symbols
120   ;;     '("DLA" 1))))
121   ;; (custom-set-variables
122   ;;  '(font-latex-user-keyword-classes 
123   ;;    '(("fixme" 
124   ;;       ("DLA" "RZ")
125   ;;       font-lock-function-name-face 2 (command 1 t))))
126   ;; ) 
127
128   (require 'font-latex)
129   (setq font-latex-match-reference-keywords
130         '(
131           ("fref" "{")
132           ("Fref" "{")
133           ("citep" "{")
134           ("citet" "{")
135           ("acs" "{")
136           ("acsp" "{")
137           ("ac" "{")
138           ("acp" "{")
139           ("acl" "{")
140           ("aclp" "{")
141           ("acsu" "{")
142           ("aclu" "{")
143           ("acused" "{")
144   ;         ))
145   ; (setq font-latex-match-warning-keywords
146   ;       '(
147           ("DLA" "{")
148           ("RZ" "{")
149           ("OM" "{")
150           ("DL" "{")
151           ("fixme" "{")))
152         
153   (setq-default TeX-parse-self t)
154   (setq-default TeX-auto-save t)
155   (setq-default TeX-master nil)
156
157   ;; this doesn't seem to work; not currently sure why
158   ; (setq font-latex-user-keyword-classes
159   ;       '(("my-warning-commands"
160   ;          (("DLA" "{")
161   ;           ("RZ" "{")
162   ;           ("OM" "{")
163   ;           ("DL" "{")
164   ;           ("fixme" "{")
165   ;           )
166   ;          (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
167   ;         ))
168
169   (setq-default reftex-default-bibliography
170         '("~/projects/research/references.bib"))
171
172
173 #+END_SRC
174 * Keybindings
175 ** Override other things
176 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
177   ; apparently things like to step on C-;, so we'll use a hack from
178   ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
179
180   (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
181
182   ; use iedit everywhere
183   (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
184   ;; use outline mode keybindings everywhere
185   (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
186
187   (define-minor-mode my-keys-minor-mode
188     "A minor mode so that my key settings override annoying major modes."
189     t " my-keys" 'my-keys-minor-mode-map)
190
191   (my-keys-minor-mode 1)
192   (defun my-minibuffer-setup-hook ()
193     (my-keys-minor-mode 0))
194
195   (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
196   (defadvice load (after give-my-keybindings-priority)
197     "Try to ensure that my keybindings always have priority."
198     (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
199         (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
200           (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
201           (add-to-list 'minor-mode-map-alist mykeys))))
202   (ad-activate 'load)
203 #+END_SRC
204
205 * END
206 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
207   (provide 'don-configuration)
208 #+END_SRC