chiark / gitweb /
emacs: Move the diary file to ~/etc/diary.
[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 (setq diary-file "~/etc/diary")
204
205 ;; --- Trivial stuff for the sunrise/sunset calculations ---
206
207 (setq calendar-latitude 52.2)
208 (setq calendar-longitude 0.1)
209 (setq calendar-location-name "Cambridge, UK")
210
211 ;; --- Holidays ---
212
213 (and (not mdw-fast-startup)
214      (trap
215        (require 'ew-hols)
216        (setq other-holidays (append english-and-welsh-bank-holidays
217                                     other-holidays))))
218
219 ;; --- Date format fiddling ---
220
221 (setq european-calendar-style t)
222
223 (setq diary-date-forms '((day "[-/]" month "[^-/0-9]")
224                          (day " *" monthname "[ \t]*\\(\^M\\|\n\\)")
225                          (backup day " *" monthname "\\W+\\<[^*0-9]")
226                          (day "[-/]" month "[-/]" year "[^0-9]")
227                          (day " *" monthname " *" year "[^0-9]")
228                          (year "[-/]" month "[-/]" day "[^0-9]")
229                          (dayname "\\W")))
230
231 ;; --- Fancy diary handling ---
232
233 (add-hook 'diary-display-hook 'fancy-diary-display)
234 (setq diary-list-include-blanks t)
235 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
236 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
237 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
238
239 ;; --- Appointment management ---
240
241 (add-hook 'diary-hook 'appt-make-list)
242 (setq appt-issue-message t)
243 (setq appt-display-interval 3)
244 (setq appt-message-warning-time 10)
245
246 ;; --- Cosmetic stuff ---
247
248 (setq display-time-24hr-format t)
249 (display-time)
250 (trap
251   (if window-system
252       (let ((view-diary-entries-initially t))
253         (calendar))))
254
255 ;;;----- MailCrypt ----------------------------------------------------------
256
257 ;; --- Define more mode hooks for MailCrypt ---
258
259 (setq mdw-mc-modes
260       '((mdwmail-mode (encrypt . mdwmail-mc-encrypt)
261                       (sign . mdwmail-mc-sign))))
262
263 ;; --- Load the MailCrypt support ---
264
265 (trap
266   (and (string-match "linux" (symbol-name system-type))
267        (not mdw-fast-startup)
268        (progn (require 'mailcrypt-init)
269               (require 'mailcrypt)
270               (setq mc-default-scheme 'mc-scheme-gpg)
271               (setq mc-pgp-user-id "mdw-nsict-pgp")
272               (setq mc-gpg-user-id "mdw-nsict-gpg")
273               (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes))
274               (setq mc-pgp-always-sign t)
275               (setq mc-gpg-always-sign t)
276               (setq mc-always-replace 'never)
277               (setq mc-passwd-timeout 3600)
278               (setq mc-temp-directory tmpdir)
279               (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes))
280               (define-key mc-write-mode-map "\C-c/S" 'mc-sign-region)
281               (define-key mc-write-mode-map "\C-c/E" 'mc-encrypt-region)
282               (add-hook 'text-mode-hook 'mc-install-write-mode))))
283
284 ;;;----- Other common declarations ------------------------------------------
285
286 ;; --- Default frame size ---
287
288 (setq default-frame-alist
289       (mdw-uniquify-alist
290        '((width . 78)
291          (height . 33)
292          (vertical-scroll-bars . right))
293        (and window-system
294             '((cursor-type . bar)
295               (cursor-blink . t)
296               (left-fringe . 5)
297               (right-fringe . 5)
298               (scroll-bar-width . 15)))
299        '((cursor-color . "red"))
300        (if mdw-black-background
301            '((background-color . "black")
302              (foreground-color . "white")
303              (background-mode . dark))
304          '((background-mode . light)))
305        (and (eq window-system 'pm)
306             '((font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850")
307               (menu-font . "8.Helv")
308               (background-color . "lightgrey")))
309        '((transparency . t))
310        default-frame-alist))
311
312 ;; --- Other frame fiddling ---
313
314 (setq frame-title-format '("" invocation-name "@" system-name ": %b"))
315
316 ;; --- Global keymap changes ---
317
318 (trap
319   (windmove-default-keybindings)
320   (setq windmove-wrap-around t))
321 (trap (iswitchb-mode))
322 (global-set-key "\M-#" 'calc-dispatch)
323 (global-set-key [f4] 'query-replace-regexp)
324 (global-set-key [f5] 'goto-line)
325 (global-set-key [f6] 'auto-fill-mode)
326 (global-set-key [f7] 'occur)
327 (global-set-key [f8] 'undo)
328 (global-set-key [f9] 'mdw-divvy-window)
329 (global-set-key [insertchar] 'overwrite-mode)
330 (global-set-key "\C-xm" 'vm-mail)
331 (global-set-key "\C-x\C-n" 'skel-create-file)
332 (global-set-key "\C-x4n" 'skel-create-file-other-window)
333 (global-set-key "\C-x5n" 'skel-create-file-other-frame)
334 (global-set-key [delete] 'delete-char)
335 (global-set-key "\C-[\C-m" 'call-last-kbd-macro)
336 (global-set-key "\M-q" 'mdw-fill-paragraph)
337 (global-set-key "\C-h\C-m" 'manual-entry)
338 (global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window)
339 (global-set-key [vertical-scroll-bar C-down-mouse-1]
340                 'mouse-drag-vertical-line)
341 (global-set-key [vertical-scroll-bar C-mouse-1]
342                 #'(lambda () (interactive)))
343 (global-set-key [mouse-4] 'mdw-wheel-up)
344 (global-set-key [mouse-5] 'mdw-wheel-down)
345
346 ;; --- Recognising types of files ---
347
348 (setq auto-mode-alist
349       (append `(("\\.p[lm]$" . perl-mode)
350                 ("\\.m$" . objc-mode)
351                 ("\\.mxd$" . c-mode)
352                 ("\\.cs" . csharp-mode)
353                 ;; ("/[ch]/" . c-mode)
354                 (,(concat "/\\("
355                           "\\.stgit\\.msg" "\\|"
356                           "\\.git/COMMIT_EDITMSG" "\\|"
357                           "svn-commit\\.tmp" "\\|"
358                           "svk-commit[^/.]*\\.tmp"
359                           "\\)$")
360                  . text-mode)
361                 (,(concat "^" tmpdir "/\\("
362                           "svk-commit[^/.]*\\.tmp" "\\|"
363                           "gitci\\.[^/.]*" "\\|"
364                           "cvs[^/.]\\{6\\}" "\\|"
365                           "quilt_header\.[^/.]\\{6\\}"
366                           "\\)$")
367                  . text-mode)
368                 ("\\.calc?$" . apcalc-mode)
369                 ("/src/linux/.*\\.\\(c\\|h\\|cc\\)$" . linux-c-mode)
370                 ("/\\(s\\|sh\\)/" . arm-assembler-mode)
371                 ("\\.\\(cmd\\|exec\\|rexx\\)$" . rexx-mode)
372                 ("\\.st$" . smalltalk-mode)
373                 ("\\.msgs$" . messages-mode)
374                 ("/all-cmds\\.in$" . cpp-messages-mode)
375                 ("\\.\\(tex\\|dtx\\)$" . latex-mode)
376                 ("\\.gc$" . haskell.-mode)
377                 (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode)
378                 (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\)")
379                  . mdwmail-mode))
380               auto-mode-alist))
381
382 (setq interpreter-mode-alist
383       (append `(("runlisp" . lisp-mode))
384               interpreter-mode-alist))
385
386 (setq completion-ignored-extensions
387       (append `(".hc" ".hi") completion-ignored-extensions))
388
389 ;; --- Some common local definitions ---
390
391 (make-variable-buffer-local 'mdw-auto-indent)
392
393 (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config))
394         '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook
395           perl-mode-hook cperl-mode-hook python-mode-hook awk-mode-hook
396           tcl-mode-hook asm-mode-hook
397           TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook
398           tex-mode-hook latex-mode-hook texinfo-mode-hook
399           emacs-lisp-mode-hook scheme-mode-hook
400           lisp-mode-hook lisp-interaction-mode-hook inferior-lisp-mode-hook
401           slime-repl-mode-hook
402           sml-mode-hook haskell-mode-hook
403           smalltalk-mode-hook rexx-mode-hook
404           arm-assembler-mode-hook))
405
406 (global-font-lock-mode t)
407 (defalias 'perl-mode 'cperl-mode)
408
409 ;;;----- Rootly editingness -------------------------------------------------
410
411 (eval-after-load "tramp"
412   '(progn
413      (setq tramp-methods
414            (mdw-uniquify-alist
415             `(("become"
416                (tramp-connection-function tramp-open-connection-su)
417                (tramp-remote-sh "/bin/sh")
418                (tramp-login-program "become")
419                (tramp-copy-program nil)
420                (tramp-copy-args nil)
421                (tramp-copy-keep-date-arg nil)
422                (tramp-login-args ("TERM=dumb" "%u")))
423               ("really"
424                (tramp-connection-function tramp-open-connection-su)
425                (tramp-login-program "really")
426                (tramp-login-args ("-u" "%u" "--"
427                                   "env" "TERM=dumb" "/bin/sh"))
428                (tramp-copy-program nil)
429                (tramp-copy-args nil)
430                (tramp-copy-keep-date-arg nil)
431                (tramp-remote-sh "/bin/sh"))
432               ,@tramp-methods)))
433      (setq tramp-multi-connection-function-alist
434            (mdw-uniquify-alist
435             '(("bc" tramp-multi-connect-su "become TERM=dumb %u%n"))
436             '(("r" tramp-multi-connect-su "really -u %u%n"))
437             tramp-multi-connection-function-alist))
438      (setq tramp-default-method "ssh")
439      (setq tramp-default-method-alist
440            `(("\\`localhost\\'" ""
441               ,(cond ((executable-find "become") "become")
442                      ((executable-find "really") "really")
443                      (t "su")))))))
444
445 ;;;----- General fontification ----------------------------------------------
446
447 ;; --- Configure lazy fontification ---
448
449 (and (fboundp 'lazy-lock-mode)
450      (setq font-lock-support-mode 'lazy-lock-mode))
451 ; (setq lazy-lock-defer-contextually t)
452 (setq lazy-lock-defer-time nil)
453 (setq font-lock-maximum-decoration 3)
454 (setq lazy-lock-minimum-size 0)
455 (setq lazy-lock-stealth-time 5)
456 (setq lazy-lock-stealth-lines 100)
457 (setq lazy-lock-stealth-verbose t)
458
459 (add-hook 'after-make-frame-functions 'mdw-do-set-font)
460 (add-hook 'term-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
461 (add-hook 'window-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
462
463 (add-hook 'c-mode-hook 'mdw-fontify-c-and-c++ t)
464 (add-hook 'objc-mode-hook 'mdw-fontify-c-and-c++ t)
465 (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t)
466 (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8)))
467 (add-hook 'asm-mode-hook 'mdw-fontify-asm t)
468
469 (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t)
470 (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t)
471
472 (add-hook 'java-mode-hook 'mdw-fontify-java t)
473
474 (add-hook 'awk-mode-hook 'mdw-fontify-awk t)
475
476 (add-hook 'perl-mode-hook 'mdw-fontify-perl t)
477 (add-hook 'cperl-mode-hook 'mdw-fontify-perl t)
478
479 (setq-default py-indent-offset 2)
480 (add-hook 'python-mode-hook 'mdw-fontify-python t)
481
482 (setq-default tcl-indent-level 2)
483 (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t)
484
485 (add-hook 'rexx-mode-hook 'mdw-fontify-rexx t)
486
487 (setq sml-nested-if-indent t)
488 (setq sml-case-indent nil)
489 (setq sml-indent-level 4)
490 (setq sml-type-of-indent nil)
491 (add-hook 'sml-mode-hook 'mdw-fontify-sml t)
492
493 (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t)
494 (setq-default haskell-indent-offset 2)
495
496 (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t)
497 (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t)
498
499 (setq LaTeX-table-label "tbl:")
500 (setq-default TeX-master nil)
501 ;; (setq TeX-parse-self t)
502 ;; (setq TeX-auto-save t)
503 (setq TeX-auto-untabify nil)
504 (add-hook 'TeX-mode-hook 'mdw-fontify-tex t)
505 (add-hook 'tex-mode-hook 'mdw-fontify-tex t)
506 (add-hook 'LaTeX-mode-hook 'mdw-fontify-tex t)
507 (add-hook 'latex-mode-hook 'mdw-fontify-tex t)
508
509 (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode)
510 (add-hook 'autoconf-mode-hook #'mdw-setup-m4)
511 (add-hook 'm4-mode-hook #'mdw-setup-m4)
512
513 (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t)
514 (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t)
515
516 (add-hook 'emacs-lisp-mode-hook 'mdw-fontify-lispy t)
517 (add-hook 'scheme-mode-hook 'mdw-fontify-lispy t)
518 (add-hook 'lisp-mode-hook 'mdw-fontify-lispy t)
519 (add-hook 'inferior-lisp-mode-hook 'mdw-fontify-lispy t)
520 (add-hook 'lisp-interaction-mode-hook 'mdw-fontify-lispy t)
521 (add-hook 'slime-repl-mode-hook 'mdw-fontify-lispy t)
522 (add-hook 'lisp-mode-hook 'mdw-common-lisp-indent t)
523 (trap
524  (if (not mdw-fast-startup)
525      (progn
526        (require 'slime-autoloads)
527        (slime-setup '(slime-autodoc)))))
528 (add-hook 'inferior-lisp-mode-hook
529           #'(lambda ()
530               (local-set-key "\C-m" 'comint-send-and-indent)) t)
531
532 (add-hook 'text-mode-hook 'mdw-text-mode t)
533
534 ;;;----- TeX stuff ----------------------------------------------------------
535
536 (setq TeX-output-view-style
537       '(("^dvi$"
538          ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$")
539          "%(o?)dvips -t landscape %d -o && evince %f")
540         ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$"
541          "%(o?)dvips %d -o && evince %f")
542         ("^dvi$"
543          ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$")
544          "%(o?)xdvi %dS -paper a4r -s 0 %d")
545         ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$"
546          "%(o?)xdvi %dS -paper a4 %d")
547         ("^dvi$"
548          ("^a5\\(?:comb\\|paper\\)$" "^landscape$")
549          "%(o?)xdvi %dS -paper a5r -s 0 %d")
550         ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d")
551         ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d")
552         ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d")
553         ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d")
554         ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d")
555         ("^dvi$" "." "%(o?)xdvi %dS %d")
556         ("^pdf$" "." "evince %o")
557         ("^html?$" "." "netscape %o")))
558
559 ;;;----- SLIME setup --------------------------------------------------------
560
561 (let ((stuff '((cmucl ("cmucl"))
562                (sbcl ("sbcl") :coding-system utf-8-unix)
563                (clisp ("clisp") :coding-system utf-8-unix))))
564   (or (boundp 'slime-lisp-implementations)
565       (setq slime-lisp-implementations nil))
566   (while stuff
567     (let* ((head (car stuff))
568            (found (assq (car head) slime-lisp-implementations)))
569       (setq stuff (cdr stuff))
570       (if found
571           (rplacd found (cdr head))
572         (setq slime-lisp-implementations
573               (cons head slime-lisp-implementations))))))
574 (setq slime-default-lisp 'sbcl)
575
576 ;;;----- Shell mode ---------------------------------------------------------
577
578 ;; --- Make the shell mode aware of my prompt ---
579
580 (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *")
581 (setq comint-password-prompt-regexp
582       (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)"
583               "[Pp]assword\\|pass phrase\\):\\s *\\'"))
584
585 ;; --- Notice passwords, and make C-a work right ---
586
587 (add-hook 'shell-mode-hook #'mdw-sh-mode-setup)
588
589 (add-hook 'term-mode-hook #'mdw-term-mode-setup)
590
591 ;;;----- Finishing touches --------------------------------------------------
592
593 (trap (select-window mdw-init-window))
594 (provide 'emacs-init)
595
596 ;;;----- That's all, folks --------------------------------------------------