emacs: Turn off semantic-excessive-code-helpers.
[profile] / emacs
1 ;;; -*- mode: emacs-lisp; coding: utf-8 -*-
2 ;;;
3 ;;; Emacs configuration file
4 ;;;
5 ;;; (c) 1996-1999 Mark Wooding
6 ;;;
7
8 ;;;----- Licensing notice ---------------------------------------------------
9 ;;;
10 ;;; This program is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 2 of the License, or
13 ;;; (at your option) any later version.
14 ;;;
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with this program; if not, write to the Free Software
22 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
23
24 (setq load-path (nconc load-path (list "~/lib/emacs")))
25 (require 'dot-emacs)
26
27 ;;;----- Some random initialisation -----------------------------------------
28
29 (setq mdw-init-window (selected-window))
30
31 ;; --- Load some other bits of code ---
32
33 (maybe-autoload 'cc-mode "cc-mode" nil t)
34 (maybe-autoload 'rexx-mode "rexx-mode" nil t)
35 (maybe-autoload 'cvs-update "pcl-cvs" nil t)
36 (maybe-autoload 'debian-changelog-mode "debian-changelog-mode" nil t)
37 (maybe-autoload 'git-status "git" nil t)
38 (maybe-autoload 'git-blame-mode "git-blame" nil t)
39 (maybe-autoload 'stgit "stgit" nil t)
40 (maybe-autoload 'nc-timesheet-prepare "nc-timesheet" nil t nil)
41 (maybe-autoload 'nc-timesheet-submit "nc-timesheet" nil t nil)
42
43 (and (library-exists-p "debian-changelog-mode")
44 (add-to-list 'auto-mode-alist
45 `(,(concat "/debian/"
46 "\\("
47 "[" "[:lower:][:digit:]]"
48 "[[:lower:][:digit:].+-" "]+"
49 "\\."
50 "\\)?"
51 "changelog\\'")
52 . debian-changelog-mode)))
53
54 (and (library-exists-p "vc-git")
55 (not (memq 'GIT vc-handled-backends))
56 (setq vc-handled-backends (cons 'GIT vc-handled-backends)))
57 (and (library-exists-p "quilt")
58 (not mdw-fast-startup)
59 (load "quilt"))
60
61 (trap (or mdw-fast-startup (require 'tex-site)))
62
63 (trap (or mdw-fast-startup (semantic-load-enable-minimum-features)))
64
65 ;; --- Skeleton stuff ---
66
67 (trap (or mdw-fast-startup (require 'skel-init)))
68
69 ;; --- Window system-dependent things ---
70
71 (require 'paren)
72 (trap (show-paren-mode t))
73 (or window-system (menu-bar-mode -1))
74
75 ;; --- Temporary directory handling ---
76
77 (defun mdw-check-dir-exists (dir)
78 (and dir
79 (file-directory-p dir)
80 dir))
81 (setq tmpdir (or (mdw-check-dir-exists (getenv "TMPDIR"))
82 (mdw-check-dir-exists (format "/tmp/%s" (user-login-name)))
83 "/tmp"))
84
85 ;; --- Emacs server behaviour ---
86
87 (and window-system
88 (trap (gnuserv-start)
89 (setq server-temp-file-regexp (concat "^" tmpdir "\\|/draft$"))))
90
91 ;; --- Control backup behaviour ---
92
93 (setq backup-by-copying nil)
94 (setq backup-by-copying-when-linked t)
95 (setq backup-by-copying-when-mismatch t)
96
97 (setq mdw-backup-disable-regexps
98 '("/\\.git/COMMIT_EDITMSG$"
99 "/\\.stgit\\(-edit\\.txt\\|msg\\.txt\\|\\.msg\\)$"))
100
101 ;; --- Safe variables ---
102
103 (setq safe-local-variable-values
104 '((make-backup-files . nil)))
105
106 ;; --- Calculator fiddling ---
107
108 (setq calc-settings-file "~/.emacs-calc")
109 (load calc-settings-file)
110
111 ;; ---- Some mail and news configuration ---
112
113 (setq mail-from-style 'parens)
114 (setq mail-signature t)
115 (setq mail-yank-prefix "> ")
116 (setq mail-archive-file-name "~/Mail/sent")
117
118 (setq rmail-display-summary t)
119 (setq rmail-file-name "~/Mail/rmail")
120
121 (setq sendmail-program "~/bin/sendmail-hack")
122
123 (setq mail-user-agent 'message-user-agent)
124 (setq message-signature-separator "^-- \\(\\|\\[mdw\\]\\)$"
125 message-yank-prefix "> "
126 message-yank-cited-prefix "> "
127 message-indent-citation-function '(message-indent-citation
128 mdw-trim-spaces-after-citing))
129
130 (defun mdw-trim-spaces-after-citing ()
131 (save-excursion
132 (save-restriction
133 (narrow-to-region (point) (mark t))
134 (while (re-search-forward "^> +$" nil t)
135 (replace-match ">")))))
136
137 (and (fboundp 'turn-on-gnus-dired-mode)
138 (not mdw-fast-startup)
139 (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode))
140
141 (or mdw-fast-startup
142 (trap (bbdb-initialize 'gnus 'sendmail 'message)))
143 (setq bbdb-north-american-phone-numbers-p nil)
144
145 ;; --- Customization ---
146
147 (setq custom-file "~/.emacs-custom")
148 (trap (load custom-file))
149
150 (trap (load "~/.emacs-local"))
151
152 ;; --- Internationalization twiddling ---
153
154 (trap
155 ;; Have top-bit-set characters work properly in terminals.
156 (let ((im (current-input-mode)))
157 (apply #'set-input-mode
158 (nconc (list (nth 0 im) (nth 1 im) 0) (nthcdr 3 im)))))
159
160 ;; --- Don't disable any commands ---
161
162 (mapatoms #'(lambda (sym) (put sym 'disabled nil)))
163
164 ;; --- Split a wide window ---
165
166 (mdw-divvy-window)
167
168 ;; --- Postscript printing ---
169
170 (setq ps-paper-type 'a4
171 ps-print-color-p nil
172 ps-landscape-mode t
173 ps-number-of-columns 3
174 ps-font-family 'Courier
175 ps-font-size 4)
176
177 ;; --- Splash screen stuff ---
178
179 (or window-system
180 (setq inhibit-splash-screen t
181 inhibit-startup-message t))
182
183 ;; --- Other goodies ---
184
185 (trap (resize-minibuffer-mode 1)) ;Make minibuffer grow dynamically
186 (auto-compression-mode 1) ;Enable automatic compression
187 (setq dabbrev-case-replace nil) ;Retain case when completing
188 (setq next-line-add-newlines nil) ;Don't add weird newlines
189 (setq split-height-threshold 45) ;Reuse windows where sensible
190 (setq display-buffer-reuse-frames nil ;Don't confuse me by showing buffers
191 iswitchb-default-method 'samewindow) ;in other random frames
192 (setq dired-deletion-confirmer ;Make deletion easier in dired
193 (symbol-function 'y-or-n-p))
194 (setq read-quoted-char-radix 16) ;C-q HEX-STUFF [RET]
195 (setq dired-listing-switches "-alF") ;Do `ls -F' things in dired windows
196 (setq wdired-allow-to-change-permissions t)
197 (setq case-fold-file-names nil) ;Don't translate file names (grr...)
198 (setq scroll-step 5) ;Don't scroll too much at a time
199 (setq-default fill-column 77) ;I use rather narrow windows
200 (setq-default comment-column 40) ;Set a standard comment column
201 (setq-default truncate-partial-width-windows nil)
202 (setq woman-use-own-frame nil) ;Keep man pages somewhere sensible
203 (setq diff-switches "-u" ;I like reading unified diffs
204 cvs-diff-flags (list diff-switches))
205 (setq echo-keystrokes 10) ;Long delay before keystrokes echo
206 (setq ange-ftp-ftp-program-name "pftp") ;Use passive FTP
207 (setq find-ls-option ;Build file lists efficiently
208 '("-print0 | xargs -0r ls -ld" . "ld"))
209 (setq bookmark-save-flag 0) ;Save bookmarks automatically
210 (setq Info-fontify-maximum-menu-size 100000)
211 (setq set-mark-command-repeat-pop t)
212 (setq ispell-program-name "aspell"
213 ispell-local-dictionary "en_GB-ize-w_accents"
214 flyspell-default-dictionary "en_GB-ize-w_accents"
215 ispell-silently-savep t)
216 (trap
217 (require 'uniquify)
218 (setq uniquify-buffer-name-style 'post-forward-angle-brackets)
219 (setq uniquify-after-kill-buffer-p t))
220 (transient-mark-mode t)
221 (setq mark-even-if-inactive t)
222 (trap
223 (tooltip-mode 0)
224 (tool-bar-mode 0))
225 (trap (or mdw-fast-startup (global-auto-revert-mode t)))
226 (setq psgml-html-build-new-buffer nil)
227
228 (defvar mdw-black-background t)
229
230 (eval-after-load "outline"
231 '(progn
232 (trap (require 'foldout))
233 (define-key outline-mode-prefix-map [?\C-r] 'reveal-mode)
234 (define-key outline-mode-prefix-map [?\C--] 'mdw-outline-collapse-all)))
235
236 (setq cltl2-root-url (mdw-config 'cltl-url))
237 (setq common-lisp-hyperspec-root (mdw-config 'hyperspec-url))
238
239 ;;;----- W3 and URL fetching stuff ------------------------------------------
240
241 (let ((proxy (mdw-config 'http-proxy)))
242 (setq url-proxy-services
243 `(("http" . ,proxy)
244 ("ftp" . ,proxy)
245 ("gopher" . ,proxy))))
246 (setq url-cookie-untrusted-urls '("."))
247
248 (setq browse-url-browser-function (mdw-good-url-browser)
249 browse-url-mozilla-program "firefox")
250
251 (setq w3m-default-display-inline-images t)
252
253 (setq w3-do-incremental-display t
254 w3-use-menus '(file edit view go bookmark options
255 buffers style search emacs nil help)
256 w3-display-inline-image t
257 w3-keybinding 'info)
258
259 ;;;----- Calendar configuration ---------------------------------------------
260
261 (setq diary-file "~/etc/diary")
262
263 ;; --- Trivial stuff for the sunrise/sunset calculations ---
264
265 (setq calendar-latitude 52.2)
266 (setq calendar-longitude 0.1)
267 (setq calendar-location-name "Cambridge, UK")
268
269 ;; --- Holidays ---
270
271 (and (not mdw-fast-startup)
272 (trap
273 (require 'ew-hols)
274 (setq other-holidays (append english-and-welsh-bank-holidays
275 other-holidays))))
276
277 ;; --- Date format fiddling ---
278
279 (setq european-calendar-style t)
280
281 (setq diary-date-forms '((day "[-/]" month "[^-/0-9]")
282 (day " *" monthname "[ \t]*\\(\^M\\|\n\\)")
283 (backup day " *" monthname "\\W+\\<[^*0-9]")
284 (day "[-/]" month "[-/]" year "[^0-9]")
285 (day " *" monthname " *" year "[^0-9]")
286 (year "[-/]" month "[-/]" day "[^0-9]")
287 (dayname "\\W")))
288
289 ;; --- Fancy diary handling ---
290
291 (add-hook 'diary-display-hook 'fancy-diary-display)
292 (setq diary-list-include-blanks t)
293 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
294 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
295 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
296
297 ;; --- Appointment management ---
298
299 (add-hook 'diary-hook 'appt-make-list)
300 (setq appt-issue-message t)
301 (setq appt-display-interval 3)
302 (setq appt-message-warning-time 10)
303
304 ;; --- Org-mode agenda ---
305
306 (setq org-agenda-include-diary t)
307
308 ;; --- Cosmetic stuff ---
309
310 (setq display-time-24hr-format t)
311 (display-time)
312 (trap
313 (if window-system
314 (let ((view-diary-entries-initially t))
315 (calendar))))
316
317 ;;;----- MailCrypt ----------------------------------------------------------
318
319 ;; --- Define more mode hooks for MailCrypt ---
320
321 (setq mdw-mc-modes
322 '((mdwmail-mode (encrypt . mdwmail-mc-encrypt)
323 (sign . mdwmail-mc-sign))))
324
325 ;; --- Load the MailCrypt support ---
326
327 (trap
328 (and (string-match "linux" (symbol-name system-type))
329 (not mdw-fast-startup)
330 (progn (require 'mailcrypt-init)
331 (require 'mailcrypt)
332 (setq mc-default-scheme 'mc-scheme-gpg)
333 (setq mc-pgp-user-id "mdw-nsict-pgp")
334 (setq mc-gpg-user-id "mdw-nsict-gpg")
335 (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes))
336 (setq mc-pgp-always-sign t)
337 (setq mc-gpg-always-sign t)
338 (setq mc-always-replace 'never)
339 (setq mc-passwd-timeout 3600)
340 (setq mc-temp-directory tmpdir)
341 (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes))
342 (define-key mc-write-mode-map "\C-c/S" 'mc-sign-region)
343 (define-key mc-write-mode-map "\C-c/E" 'mc-encrypt-region)
344 (add-hook 'text-mode-hook 'mc-install-write-mode))))
345
346 ;;;----- Other common declarations ------------------------------------------
347
348 ;; --- Default frame size ---
349
350 (setq default-frame-alist
351 (mdw-uniquify-alist
352 '((width . 78)
353 (height . 33)
354 (vertical-scroll-bars . right))
355 (and window-system
356 '((cursor-type . bar)
357 (cursor-blink . t)
358 (left-fringe . 5)
359 (right-fringe . 5)
360 (scroll-bar-width . 15)))
361 '((cursor-color . "red"))
362 (if mdw-black-background
363 '((background-color . "black")
364 (foreground-color . "white")
365 (background-mode . dark))
366 '((background-mode . light)))
367 (and (eq window-system 'pm)
368 '((font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850")
369 (menu-font . "8.Helv")
370 (background-color . "lightgrey")))
371 '((transparency . t))
372 default-frame-alist))
373
374 ;; --- Other frame fiddling ---
375
376 (setq frame-title-format '("" invocation-name "@" system-name ": %b"))
377
378 ;; --- Global keymap changes ---
379
380 (trap
381 (windmove-default-keybindings))
382 (setq windmove-wrap-around t)
383 (trap (iswitchb-mode))
384 (global-set-key [?\C-x ?w left] 'windmove-left)
385 (global-set-key [?\C-x ?w ?h] 'windmove-left)
386 (global-set-key [?\C-x ?w up] 'windmove-up)
387 (global-set-key [?\C-x ?w ?k] 'windmove-up)
388 (global-set-key [?\C-x ?w down] 'windmove-down)
389 (global-set-key [?\C-x ?w ?j] 'windmove-down)
390 (global-set-key [?\C-x ?w right] 'windmove-right)
391 (global-set-key [?\C-x ?w ?l] 'windmove-right)
392 (global-set-key [?\C-x ?g ?l] 'org-store-link)
393 (global-set-key [?\C-x ?g ?a] 'org-agenda)
394 (global-set-key [?\C-x ?g ?b] 'org-iswitchb)
395 (global-set-key [?\C-x ?t ?i] 'timeclock-in)
396 (global-set-key [?\C-x ?t ?c] 'timeclock-change)
397 (global-set-key [?\C-x ?t ?o] 'timeclock-out)
398 (global-set-key [?\C-x ?t ?r] 'timeclock-reread-log)
399 (global-set-key [?\C-x ?t ?w] 'timeclock-workday-remaining-string)
400 (global-set-key [?\C-x ?t ?s] 'timeclock-status-string)
401 (global-set-key [?\C-x ?t ?p] 'nc-timesheet-prepare)
402 (global-set-key [?\C-x ?t ?\C-m] 'nc-timesheet-submit)
403 (global-set-key [?\M-#] 'calc-dispatch)
404 (global-set-key [?\C-x ?/] 'auto-fill-mode)
405 (global-set-key [?\C-x ?w ?d] 'mdw-divvy-window)
406 (global-set-key [insertchar] 'overwrite-mode)
407 (global-set-key [?\C-x ?\C-n] 'skel-create-file)
408 (global-set-key [?\C-x ?4 ?n] 'skel-create-file-other-window)
409 (global-set-key [?\C-x ?5 ?n] 'skel-create-file-other-frame)
410 (global-set-key [delete] 'delete-char)
411 (global-set-key [?\M-q] 'mdw-fill-paragraph)
412 (global-set-key [?\C-h ?\C-m] 'manual-entry)
413 (global-set-key [C-M-backspace] 'backward-kill-sexp)
414 (global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window)
415 (global-set-key [vertical-scroll-bar C-down-mouse-1]
416 'mouse-drag-vertical-line)
417 (global-set-key [vertical-scroll-bar C-mouse-1]
418 #'(lambda () (interactive)))
419 (global-set-key [XF86WakeUp] "")
420 (and (not mdw-fast-startup) (fboundp 'hippie-expand)
421 (global-set-key [?\M-/] 'hippie-expand))
422
423 (add-hook 'org-mode-hook
424 #'(lambda () (mdw-clobber-evil-keymap org-mode-map)))
425 (add-hook 'org-agenda-mode-hook
426 #'(lambda () (mdw-clobber-evil-keymap org-agenda-mode-map)))
427
428 ;; --- Recognising types of files ---
429
430 (setq auto-mode-alist
431 (append `(("\\.p[lm]$" . perl-mode)
432 ("\\.m$" . objc-mode)
433 ("\\.mxd$" . c-mode)
434 ("\\.cs" . csharp-mode)
435 ("\\.org$" . org-mode)
436 ;; ("/[ch]/" . c-mode)
437 (,(concat "/\\("
438 "\\.stgit\\.msg" "\\|"
439 "\\.git/COMMIT_EDITMSG" "\\|"
440 "svn-commit\\.tmp" "\\|"
441 "svk-commit[^/.]*\\.tmp"
442 "\\)$")
443 . text-mode)
444 (,(concat "^" tmpdir "/\\("
445 "svk-commit[^/.]*\\.tmp" "\\|"
446 "gitci\\.[^/.]*" "\\|"
447 "cvs[^/.]\\{6\\}" "\\|"
448 "quilt_header\.[^/.]\\{6\\}"
449 "\\)$")
450 . text-mode)
451 ("\\.calc?$" . apcalc-mode)
452 ("/src/linux/.*\\.\\(c\\|h\\|cc\\)$" . linux-c-mode)
453 ("/\\(s\\|sh\\)/" . arm-assembler-mode)
454 ("\\.\\(cmd\\|exec\\|rexx\\)$" . rexx-mode)
455 ("\\.st$" . smalltalk-mode)
456 ("\\.msgs$" . messages-mode)
457 ("/all-cmds\\.in$" . cpp-messages-mode)
458 ("\\.\\(tex\\|dtx\\)$" . latex-mode)
459 ("\\.gc$" . haskell.-mode)
460 (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode)
461 (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\|mutt\\)")
462 . mdwmail-mode))
463 auto-mode-alist))
464
465 (setq interpreter-mode-alist
466 (append `(("runlisp" . lisp-mode))
467 interpreter-mode-alist))
468
469 (setq completion-ignored-extensions
470 (append `(".hc" ".hi") completion-ignored-extensions))
471
472 ;; --- Some common local definitions ---
473
474 (make-variable-buffer-local 'mdw-auto-indent)
475
476 (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config))
477 '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook
478 csharp-mode-hook perl-mode-hook cperl-mode-hook
479 python-mode-hook awk-mode-hook tcl-mode-hook
480 asm-mode-hook TeX-mode-hook LaTeX-mode-hook
481 TeXinfo-mode-hook tex-mode-hook latex-mode-hook
482 texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook
483 lisp-mode-hook lisp-interaction-mode-hook
484 inferior-lisp-mode-hook slime-repl-mode-hook
485 sml-mode-hook haskell-mode-hook erlang-mode-hook
486 smalltalk-mode-hook rexx-mode-hook
487 arm-assembler-mode-hook))
488
489 (global-font-lock-mode t)
490 (defalias 'perl-mode 'cperl-mode)
491
492 ;;;----- Rootly editingness -------------------------------------------------
493
494 (eval-after-load "tramp"
495 '(progn
496 (setq tramp-methods
497 (mdw-uniquify-alist
498 `(("become"
499 (tramp-connection-function tramp-open-connection-su)
500 (tramp-remote-sh "/bin/sh")
501 (tramp-login-program "become")
502 (tramp-copy-program nil)
503 (tramp-copy-args nil)
504 (tramp-copy-keep-date-arg nil)
505 (tramp-login-args ("TERM=dumb" "%u")))
506 ("really"
507 (tramp-connection-function tramp-open-connection-su)
508 (tramp-login-program "really")
509 (tramp-login-args ("-u" "%u" "--"
510 "env" "TERM=dumb" "/bin/sh"))
511 (tramp-copy-program nil)
512 (tramp-copy-args nil)
513 (tramp-copy-keep-date-arg nil)
514 (tramp-remote-sh "/bin/sh"))
515 ,@tramp-methods)))
516 (setq tramp-multi-connection-function-alist
517 (mdw-uniquify-alist
518 '(("bc" tramp-multi-connect-su "become TERM=dumb %u%n"))
519 '(("r" tramp-multi-connect-su "really -u %u%n"))
520 tramp-multi-connection-function-alist))
521 (setq tramp-default-method "ssh")
522 (setq tramp-default-method-alist
523 `(("\\`localhost\\'" ""
524 ,(cond ((executable-find "become") "become")
525 ((executable-find "really") "really")
526 (t "su")))))))
527
528 ;;;----- General fontification ----------------------------------------------
529
530 ;; --- Configure lazy fontification ---
531
532 (and (fboundp 'lazy-lock-mode)
533 (setq font-lock-support-mode 'lazy-lock-mode))
534 ; (setq lazy-lock-defer-contextually t)
535 (setq lazy-lock-defer-time nil)
536 (setq font-lock-maximum-decoration 3)
537 (setq lazy-lock-minimum-size 0)
538 (setq lazy-lock-stealth-time 5)
539 (setq lazy-lock-stealth-lines 100)
540 (setq lazy-lock-stealth-verbose t)
541
542 (add-hook 'after-make-frame-functions 'mdw-do-set-font)
543 (add-hook 'term-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
544 (add-hook 'window-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
545
546 (add-hook 'c-mode-hook 'mdw-fontify-c-and-c++ t)
547 (add-hook 'objc-mode-hook 'mdw-fontify-c-and-c++ t)
548 (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t)
549 (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8)))
550 (add-hook 'asm-mode-hook 'mdw-fontify-asm t)
551
552 (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t)
553 (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t)
554
555 (add-hook 'java-mode-hook 'mdw-fontify-java t)
556 (add-hook 'csharp-mode-hook 'mdw-fontify-csharp t)
557
558 (add-hook 'awk-mode-hook 'mdw-fontify-awk t)
559
560 (add-hook 'perl-mode-hook 'mdw-fontify-perl t)
561 (add-hook 'cperl-mode-hook 'mdw-fontify-perl t)
562
563 (setq-default py-indent-offset 2)
564 (add-hook 'python-mode-hook 'mdw-fontify-python t)
565 (setq py-python-command-args `("-i" "-colors" ,(if mdw-black-background
566 "Linux"
567 "LightBG")))
568
569 (setq-default tcl-indent-level 2)
570 (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t)
571
572 (add-hook 'rexx-mode-hook 'mdw-fontify-rexx t)
573
574 (setq sml-nested-if-indent t)
575 (setq sml-case-indent nil)
576 (setq sml-indent-level 4)
577 (setq sml-type-of-indent nil)
578 (add-hook 'sml-mode-hook 'mdw-fontify-sml t)
579
580 (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t)
581 (setq-default haskell-indent-offset 2)
582
583 (add-hook 'erlang-mode-hook 'mdw-fontify-erlang t)
584
585 (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t)
586 (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t)
587
588 (setq LaTeX-table-label "tbl:")
589 (setq TeX-auto-untabify nil)
590 (add-hook 'TeX-mode-hook 'mdw-fontify-tex t)
591 (add-hook 'tex-mode-hook 'mdw-fontify-tex t)
592 (add-hook 'LaTeX-mode-hook 'mdw-fontify-tex t)
593 (add-hook 'latex-mode-hook 'mdw-fontify-tex t)
594
595 (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode)
596 (add-hook 'autoconf-mode-hook #'mdw-setup-m4)
597 (add-hook 'm4-mode-hook #'mdw-setup-m4)
598
599 (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t)
600 (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t)
601
602 (add-hook 'emacs-lisp-mode-hook 'mdw-fontify-lispy t)
603 (add-hook 'scheme-mode-hook 'mdw-fontify-lispy t)
604 (add-hook 'lisp-mode-hook 'mdw-fontify-lispy t)
605 (add-hook 'inferior-lisp-mode-hook 'mdw-fontify-lispy t)
606 (add-hook 'lisp-interaction-mode-hook 'mdw-fontify-lispy t)
607 (add-hook 'slime-repl-mode-hook 'mdw-fontify-lispy t)
608 (add-hook 'lisp-mode-hook 'mdw-common-lisp-indent t)
609 (add-hook 'inferior-lisp-mode-hook
610 #'(lambda ()
611 (local-set-key "\C-m" 'comint-send-and-indent)) t)
612
613 (add-hook 'text-mode-hook 'mdw-text-mode t)
614
615 ;;;----- TeX stuff ----------------------------------------------------------
616
617 (setq TeX-output-view-style
618 '(("^dvi$"
619 ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$")
620 "%(o?)dvips -t landscape %d -o && evince %f")
621 ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$"
622 "%(o?)dvips %d -o && evince %f")
623 ("^dvi$"
624 ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$")
625 "%(o?)xdvi %dS -paper a4r -s 0 %d")
626 ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$"
627 "%(o?)xdvi %dS -paper a4 %d")
628 ("^dvi$"
629 ("^a5\\(?:comb\\|paper\\)$" "^landscape$")
630 "%(o?)xdvi %dS -paper a5r -s 0 %d")
631 ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d")
632 ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d")
633 ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d")
634 ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d")
635 ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d")
636 ("^dvi$" "." "%(o?)xdvi %dS %d")
637 ("^pdf$" "." "evince %o")
638 ("^html?$" "." "netscape %o")))
639
640 (setq reftex-use-external-file-finders t
641 reftex-auto-recenter-toc t)
642
643 (setq reftex-label-alist
644 '(("theorem" ?T "th:" "~\\ref{%s}" t ("theorems?" "th\\.") -2)
645 ("axiom" ?A "ax:" "~\\ref{%s}" t ("axioms?" "ax\\.") -2)
646 ("definition" ?D "def:" "~\\ref{%s}" t ("definitions?" "def\\.") -2)
647 ("proposition" ?P "prop:" "~\\ref{%s}" t
648 ("propositions?" "prop\\.") -2)
649 ("lemma" ?P "lem:" "~\\ref{%s}" t ("lemmas?" "lem\\.") -2)
650 ("example" ?X "eg:" "~\\ref{%s}" t ("examples?") -2)
651 ("exercise" ?E "ex:" "~\\ref{%s}" t ("exercises?" "ex\\.") -2)
652 ("enumerate" ?i "i:" "~\\ref{%s}" item ("items?"))))
653 (setq reftex-section-prefixes
654 '((0 . "part:")
655 (1 . "ch:")
656 (t . "sec:")))
657
658 (setq bibtex-field-delimiters 'double-quotes
659 bibtex-entry-format '(realign opts-or-alts required-fields
660 numerical-fields last-comma delimiters
661 unify-case)
662 bibtex-include-OPTkey nil)
663
664 ;;;----- SLIME setup --------------------------------------------------------
665
666 (trap
667 (if (not mdw-fast-startup)
668 (progn
669 (require 'slime-autoloads)
670 (slime-setup '(slime-autodoc slime-c-p-c)))))
671
672 (let ((stuff '((cmucl ("cmucl"))
673 (sbcl ("sbcl") :coding-system utf-8-unix)
674 (clisp ("clisp") :coding-system utf-8-unix))))
675 (or (boundp 'slime-lisp-implementations)
676 (setq slime-lisp-implementations nil))
677 (while stuff
678 (let* ((head (car stuff))
679 (found (assq (car head) slime-lisp-implementations)))
680 (setq stuff (cdr stuff))
681 (if found
682 (rplacd found (cdr head))
683 (setq slime-lisp-implementations
684 (cons head slime-lisp-implementations))))))
685 (setq slime-default-lisp 'sbcl)
686
687 ;;;----- Blogging -----------------------------------------------------------
688
689 (setq weblogger-config-alist
690 '(("vox"
691 ("user" . "mdw")
692 ("server-url" . "http://vox.distorted.org.uk/admin/mt-xmlrpc.cgi")
693 ("weblog" . "1"))))
694
695 ;;;----- Shell mode ---------------------------------------------------------
696
697 ;; --- Make the shell mode aware of my prompt ---
698
699 (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *")
700 (setq comint-password-prompt-regexp
701 (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)"
702 "[Pp]assword\\|pass phrase\\):\\s *\\'"))
703
704 ;; --- Notice passwords, and make C-a work right ---
705
706 (add-hook 'shell-mode-hook #'mdw-sh-mode-setup)
707 (add-hook 'shell-mode-hook #'ansi-color-for-comint-mode-on)
708 (setq shell-font-lock-keywords nil)
709
710 (add-hook 'term-mode-hook #'mdw-term-mode-setup)
711
712 ;;;----- Finishing touches --------------------------------------------------
713
714 (trap (select-window mdw-init-window))
715 (provide 'emacs-init)
716
717 ;;;----- That's all, folks --------------------------------------------------