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