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