]> git.donarmstrong.com Git - lib.git/blob - emacs_el/configuration/don-configuration.org
require ess configuration; use polymode
[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
166   ;; this doesn't seem to work; not currently sure why
167   ; (setq font-latex-user-keyword-classes
168   ;       '(("my-warning-commands"
169   ;          (("DLA" "{")
170   ;           ("RZ" "{")
171   ;           ("OM" "{")
172   ;           ("DL" "{")
173   ;           ("fixme" "{")
174   ;           )
175   ;          (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
176   ;         ))
177
178   (setq-default reftex-default-bibliography
179         '("~/projects/research/references.bib"))
180
181
182 #+END_SRC
183 ** Org
184 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
185   (require 'org-mode-configuration)
186 #+END_SRC
187 ** ESS
188 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
189   (require 'ess_configuration)
190 #+END_SRC
191
192
193 ** Polymode
194 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
195   (setq load-path
196         (append '("~/lib/emacs_el/polymode/modes")
197                 load-path))
198   (require 'polymode)
199   (require 'poly-R)
200   (require 'poly-noweb)
201   (require 'poly-markdown)
202   (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
203   (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
204   (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
205 #+END_SRC
206
207 * Keybindings
208 ** Override other things
209 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
210   ; apparently things like to step on C-;, so we'll use a hack from
211   ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
212
213   (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
214
215   ; use iedit everywhere
216   (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
217   ;; use outline mode keybindings everywhere
218   (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
219
220   (define-minor-mode my-keys-minor-mode
221     "A minor mode so that my key settings override annoying major modes."
222     t " my-keys" 'my-keys-minor-mode-map)
223
224   (my-keys-minor-mode 1)
225   (defun my-minibuffer-setup-hook ()
226     (my-keys-minor-mode 0))
227
228   (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
229   (defadvice load (after give-my-keybindings-priority)
230     "Try to ensure that my keybindings always have priority."
231     (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
232         (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
233           (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
234           (add-to-list 'minor-mode-map-alist mykeys))))
235   (ad-activate 'load)
236 #+END_SRC
237
238 * END
239 #+BEGIN_SRC emacs-lisp  :tangle don-configuration.el
240   (provide 'don-configuration)
241 #+END_SRC