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