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