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