chiark / gitweb /
emacs: Postscript wrangling.
[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 ;; --- Postscript printing ---
128
129 (setq ps-paper-type 'a4
130       ps-print-color-p nil
131       ps-landscape-mode t
132       ps-number-of-columns 3
133       ps-font-family 'Courier
134       ps-font-size 9)
135
136 ;; --- Splash screen stuff ---
137
138 (or window-system
139     (setq inhibit-splash-screen t
140           inhibit-startup-message t))
141
142 ;; --- Other goodies ---
143
144 (trap (resize-minibuffer-mode 1))       ;Make minibuffer grow dynamically
145 (auto-compression-mode 1)               ;Enable automatic compression
146 (setq dabbrev-case-replace nil)         ;Retain case when completing
147 (setq next-line-add-newlines nil)       ;Don't add weird newlines
148 (setq split-height-threshold 45)        ;Reuse windows where sensible
149 (setq dired-deletion-confirmer          ;Make deletion easier in dired
150       (symbol-function 'y-or-n-p))
151 (setq dired-listing-switches "-alF")    ;Do `ls -F' things in dired windows
152 (setq case-fold-file-names nil)         ;Don't translate file names (grr...)
153 (setq scroll-step 5)                    ;Don't scroll too much at a time
154 (setq-default fill-column 77)           ;I use rather narrow windows
155 (setq-default comment-column 40)        ;Set a standard comment column
156 (setq-default truncate-partial-width-windows nil)
157 (setq diff-switches "-u"                ;I like reading unified diffs
158       cvs-diff-flags (list diff-switches))
159 (setq echo-keystrokes 10)               ;Long delay before keystrokes echo
160 (setq ange-ftp-ftp-program-name "pftp") ;Use passive FTP
161 (setq find-ls-option                    ;Build file lists efficiently
162       '("-print0 | xargs -0r ls -ld" . "ld"))
163 (setq Info-fontify-maximum-menu-size 60000)
164 (setq ispell-dictionary "british"
165       flyspell-default-dictionary "british"
166       ispell-silently-savep t)
167 (trap
168   (require 'uniquify)
169   (setq uniquify-buffer-name-style 'post-forward-angle-brackets)
170   (setq uniquify-after-kill-buffer-p t))
171 (transient-mark-mode t)
172 (trap
173   (tooltip-mode 0)
174   (tool-bar-mode 0))
175 (trap (global-auto-revert-mode t))
176 (setq psgml-html-build-new-buffer nil)
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 ;; --- Date format fiddling ---
210
211 (setq european-calendar-style t)
212
213 (setq diary-date-forms '((day "[-/]" month "[^-/0-9]")
214                          (day " *" monthname "[ \t]*\\(\^M\\|\n\\)")
215                          (backup day " *" monthname "\\W+\\<[^*0-9]")
216                          (day "[-/]" month "[-/]" year "[^0-9]")
217                          (day " *" monthname " *" year "[^0-9]")
218                          (year "[-/]" month "[-/]" day "[^0-9]")
219                          (dayname "\\W")))
220
221 ;; --- Fancy diary handling ---
222
223 (add-hook 'diary-display-hook 'fancy-diary-display)
224 (setq diary-list-include-blanks t)
225 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
226 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
227 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
228
229 ;; --- Appointment management ---
230
231 (add-hook 'diary-hook 'appt-make-list)
232 (setq appt-issue-message t)
233 (setq appt-display-interval 3)
234 (setq appt-message-warning-time 10)
235
236 ;; --- Cosmetic stuff ---
237
238 (setq display-time-24hr-format t)
239 (display-time)
240 (trap
241   (if window-system
242       (let ((view-diary-entries-initially t))
243         (calendar))))
244
245 (defvar mdw-black-background t)
246
247 ;; --- Define more mode hooks for MailCrypt ---
248
249 (setq mdw-mc-modes
250       '((mdwmail-mode (encrypt . mdwmail-mc-encrypt)
251                       (sign . mdwmail-mc-sign))))
252
253 ;; --- Load the MailCrypt support ---
254
255 (trap
256   (and (string-match "linux" (symbol-name system-type))
257        (progn (require 'mailcrypt-init)
258               (require 'mailcrypt)
259               (setq mc-default-scheme 'mc-scheme-gpg)
260               (setq mc-pgp-user-id "mdw-nsict-pgp")
261               (setq mc-gpg-user-id "mdw-nsict-gpg")
262               (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes))
263               (setq mc-pgp-always-sign t)
264               (setq mc-gpg-always-sign t)
265               (setq mc-always-replace 'never)
266               (setq mc-passwd-timeout 3600)
267               (setq mc-temp-directory tmpdir)
268               (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes))
269               (define-key mc-write-mode-map "\C-c/S" 'mc-sign-region)
270               (define-key mc-write-mode-map "\C-c/E" 'mc-encrypt-region)
271               (add-hook 'text-mode-hook 'mc-install-write-mode))))
272
273 ;;;----- Other common declarations ------------------------------------------
274
275 ;; --- Default frame size ---
276
277 (setq default-frame-alist
278       (mdw-uniquify-alist
279        '((width . 78)
280          (height . 33)
281          (vertical-scroll-bars . right))
282        (and window-system
283             '((cursor-type . bar)
284               (cursor-blink . t)
285               (left-fringe . 5)
286               (right-fringe . 5)
287               (scroll-bar-width . 15)))
288        '((cursor-color . "red"))
289        (if mdw-black-background
290            '((background-color . "black")
291              (foreground-color . "white")
292              (background-mode . dark))
293          '((background-mode . light)))
294        (and (eq window-system 'pm)
295             '((font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850")
296               (menu-font . "8.Helv")
297               (background-color . "lightgrey")))
298        '((transparency . t))
299        default-frame-alist))
300
301 ;; --- Other frame fiddling ---
302
303 (setq frame-title-format '("" invocation-name "@" system-name ": %b"))
304
305 ;; --- Global keymap changes ---
306
307 (trap
308   (windmove-default-keybindings)
309   (setq windmove-wrap-around t))
310 (trap (iswitchb-mode))
311 (global-set-key "\M-#" 'calc-dispatch)
312 (global-set-key [f4] 'query-replace-regexp)
313 (global-set-key [f5] 'goto-line)
314 (global-set-key [f6] 'auto-fill-mode)
315 (global-set-key [f7] 'occur)
316 (global-set-key [f8] 'undo)
317 (global-set-key [f9] 'mdw-divvy-window)
318 (global-set-key [insertchar] 'overwrite-mode)
319 (global-set-key "\C-xm" 'vm-mail)
320 (global-set-key "\C-x\C-n" 'skel-create-file)
321 (global-set-key "\C-x4n" 'skel-create-file-other-window)
322 (global-set-key "\C-x5n" 'skel-create-file-other-frame)
323 (global-set-key [delete] 'delete-char)
324 (global-set-key "\C-[\C-m" 'call-last-kbd-macro)
325 (global-set-key "\M-q" 'mdw-fill-paragraph)
326 (global-set-key "\C-h\C-m" 'manual-entry)
327 (global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window)
328 (global-set-key [vertical-scroll-bar C-down-mouse-1]
329                 'mouse-drag-vertical-line)
330 (global-set-key [vertical-scroll-bar C-mouse-1]
331                 #'(lambda () (interactive)))
332 (global-set-key [mouse-4] 'mdw-wheel-up)
333 (global-set-key [mouse-5] 'mdw-wheel-down)
334
335 ;; --- Recognising types of files ---
336
337 (setq auto-mode-alist
338       (append `(("\\.p[lm]$" . perl-mode)
339                 ("\\.m$" . objc-mode)
340                 ("\\.mxd$" . c-mode)
341                 ("\\.cs" . csharp-mode)
342                 ;; ("/[ch]/" . c-mode)
343                 (,(concat "/\\("
344                           "\\.stgit\\.msg" "\\|"
345                           "\\.git/COMMIT_EDITMSG" "\\|"
346                           "svn-commit\\.tmp" "\\|"
347                           "svk-commit[^/.]*\\.tmp"
348                           "\\)$")
349                  . text-mode)
350                 (,(concat "^" tmpdir "/\\("
351                           "svk-commit[^/.]*\\.tmp" "\\|"
352                           "gitci\\.[^/.]*" "\\|"
353                           "cvs[^/.]\\{6\\}" "\\|"
354                           "quilt_header\.[^/.]\\{6\\}"
355                           "\\)$")
356                  . text-mode)
357                 ("\\.calc?$" . apcalc-mode)
358                 ("/src/linux/.*\\.\\(c\\|h\\|cc\\)$" . linux-c-mode)
359                 ("/\\(s\\|sh\\)/" . arm-assembler-mode)
360                 ("\\.\\(cmd\\|exec\\|rexx\\)$" . rexx-mode)
361                 ("\\.st$" . smalltalk-mode)
362                 ("\\.msgs$" . messages-mode)
363                 ("/all-cmds\\.in$" . cpp-messages-mode)
364                 ("\\.\\(tex\\|dtx\\)$" . latex-mode)
365                 ("\\.gc$" . haskell.-mode)
366                 (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode)
367                 (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\)")
368                  . mdwmail-mode))
369               auto-mode-alist))
370
371 (setq interpreter-mode-alist
372       (append `(("runlisp" . lisp-mode))
373               interpreter-mode-alist))
374
375 (setq completion-ignored-extensions
376       (append `(".hc" ".hi") completion-ignored-extensions))
377
378 ;; --- Some common local definitions ---
379
380 (make-variable-buffer-local 'mdw-auto-indent)
381
382 (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config))
383         '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook
384           perl-mode-hook cperl-mode-hook python-mode-hook awk-mode-hook
385           tcl-mode-hook asm-mode-hook
386           TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook
387           tex-mode-hook latex-mode-hook texinfo-mode-hook
388           emacs-lisp-mode-hook scheme-mode-hook
389           lisp-mode-hook lisp-interaction-mode-hook inferior-lisp-mode-hook
390           slime-repl-mode-hook
391           sml-mode-hook haskell-mode-hook
392           smalltalk-mode-hook rexx-mode-hook
393           arm-assembler-mode-hook))
394
395 (global-font-lock-mode t)
396 (defalias 'perl-mode 'cperl-mode)
397
398 ;;;----- SGML hacking -------------------------------------------------------
399
400 (defun mdw-sgml-mode ()
401   (interactive)
402   (sgml-mode)
403   (mdw-standard-fill-prefix "")
404   (make-variable-buffer-local 'sgml-delimiters)
405   (setq sgml-delimiters
406         '("AND" "&" "COM" "--" "CRO" "&#" "DSC" "]" "DSO" "[" "DTGC" "]"
407           "DTGO" "[" "ERO" "&" "ETAGO" ":e" "GRPC" ")" "GRPO" "(" "LIT" "\""
408           "LITA" "'" "MDC" ">" "MDO" "<!" "MINUS" "-" "MSC" "]]" "NESTC" "{"
409           "NET" "}" "OPT" "?" "OR" "|" "PERO" "%" "PIC" ">" "PIO" "<?"
410           "PLUS" "+" "REFC" "." "REP" "*" "RNI" "#" "SEQ" "," "STAGO" ":"
411           "TAGC" "." "VI" "=" "MS-START" "<![" "MS-END" "]]>"
412           "XML-ECOM" "-->" "XML-PIC" "?>" "XML-SCOM" "<!--" "XML-TAGCE" "/>"
413           "NULL" ""))
414   (setq major-mode 'mdw-sgml-mode)
415   (setq mode-name "[mdw] SGML")
416   (run-hooks 'mdw-sgml-mode-hook))
417
418 ;;;----- Rootly editingness -------------------------------------------------
419
420 (eval-after-load "tramp"
421   '(progn
422      (setq tramp-methods
423            (mdw-uniquify-alist
424             `(("become"
425                (tramp-connection-function tramp-open-connection-su)
426                (tramp-remote-sh "/bin/sh")
427                (tramp-login-program "become")
428                (tramp-copy-program nil)
429                (tramp-copy-args nil)
430                (tramp-copy-keep-date-arg nil)
431                (tramp-login-args ("TERM=dumb" "%u")))
432               ("really"
433                (tramp-connection-function tramp-open-connection-su)
434                (tramp-login-program "really")
435                (tramp-login-args ("-u" "%u" "--"
436                                   "env" "TERM=dumb" "/bin/sh"))
437                (tramp-copy-program nil)
438                (tramp-copy-args nil)
439                (tramp-copy-keep-date-arg nil)
440                (tramp-remote-sh "/bin/sh"))
441               ,@tramp-methods)))
442      (setq tramp-multi-connection-function-alist
443            (mdw-uniquify-alist
444             '(("bc" tramp-multi-connect-su "become TERM=dumb %u%n"))
445             '(("r" tramp-multi-connect-su "really -u %u%n"))
446             tramp-multi-connection-function-alist))
447      (setq tramp-default-method "ssh")
448      (setq tramp-default-method-alist
449            `(("\\`localhost\\'" ""
450               ,(cond ((executable-find "become") "become")
451                      ((executable-find "really") "really")
452                      (t "su")))))))
453
454 ;;;----- General fontification ----------------------------------------------
455
456 ;; --- Configure lazy fontification ---
457
458 (and (fboundp 'lazy-lock-mode)
459      (setq font-lock-support-mode 'lazy-lock-mode))
460 ; (setq lazy-lock-defer-contextually t)
461 (setq lazy-lock-defer-time nil)
462 (setq font-lock-maximum-decoration 3)
463 (setq lazy-lock-minimum-size 0)
464 (setq lazy-lock-stealth-time 5)
465 (setq lazy-lock-stealth-lines 100)
466 (setq lazy-lock-stealth-verbose t)
467
468 (add-hook 'after-make-frame-functions 'mdw-do-set-font)
469 (add-hook 'term-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
470 (add-hook 'window-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
471
472 (add-hook 'c-mode-hook 'mdw-fontify-c-and-c++ t)
473 (add-hook 'objc-mode-hook 'mdw-fontify-c-and-c++ t)
474 (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t)
475 (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8)))
476 (add-hook 'asm-mode-hook 'mdw-fontify-asm t)
477
478 (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t)
479 (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t)
480
481 (add-hook 'java-mode-hook 'mdw-fontify-java t)
482
483 (add-hook 'awk-mode-hook 'mdw-fontify-awk t)
484
485 (add-hook 'perl-mode-hook 'mdw-fontify-perl t)
486 (add-hook 'cperl-mode-hook 'mdw-fontify-perl t)
487
488 (setq-default py-indent-offset 2)
489 (add-hook 'python-mode-hook 'mdw-fontify-python t)
490
491 (setq-default tcl-indent-level 2)
492 (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t)
493
494 (add-hook 'rexx-mode-hook 'mdw-fontify-rexx t)
495
496 (setq sml-nested-if-indent t)
497 (setq sml-case-indent nil)
498 (setq sml-indent-level 4)
499 (setq sml-type-of-indent nil)
500 (add-hook 'sml-mode-hook 'mdw-fontify-sml t)
501
502 (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t)
503 (setq-default haskell-indent-offset 2)
504
505 (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t)
506 (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t)
507
508 (setq LaTeX-table-label "tbl:")
509 (setq-default TeX-master nil)
510 ;; (setq TeX-parse-self t)
511 ;; (setq TeX-auto-save t)
512 (setq TeX-auto-untabify nil)
513 (add-hook 'TeX-mode-hook 'mdw-fontify-tex t)
514 (add-hook 'tex-mode-hook 'mdw-fontify-tex t)
515 (add-hook 'LaTeX-mode-hook 'mdw-fontify-tex t)
516 (add-hook 'latex-mode-hook 'mdw-fontify-tex t)
517
518 (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode)
519
520 (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t)
521 (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t)
522
523 (add-hook 'emacs-lisp-mode-hook 'mdw-fontify-lispy t)
524 (add-hook 'scheme-mode-hook 'mdw-fontify-lispy t)
525 (add-hook 'lisp-mode-hook 'mdw-fontify-lispy t)
526 (add-hook 'inferior-lisp-mode-hook 'mdw-fontify-lispy t)
527 (add-hook 'lisp-interaction-mode-hook 'mdw-fontify-lispy t)
528 (add-hook 'slime-repl-mode-hook 'mdw-fontify-lispy t)
529 (add-hook 'lisp-mode-hook 'mdw-common-lisp-indent t)
530 (trap
531   (require 'slime-autoloads)
532   (slime-setup '(slime-autodoc)))
533 (trap (require 'xscheme))
534 (setq-default xscheme-process-command-line "scheme -large -emacs")
535 (add-hook 'inferior-lisp-mode-hook
536           #'(lambda ()
537               (local-set-key "\C-m" 'comint-send-and-indent)) t)
538
539 (add-hook 'text-mode-hook 'mdw-text-mode t)
540
541 ;;;----- TeX stuff ----------------------------------------------------------
542
543 (setq TeX-output-view-style
544       '(("^dvi$"
545          ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$")
546          "%(o?)dvips -t landscape %d -o && evince %f")
547         ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$"
548          "%(o?)dvips %d -o && evince %f")
549         ("^dvi$"
550          ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$")
551          "%(o?)xdvi %dS -paper a4r -s 0 %d")
552         ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$"
553          "%(o?)xdvi %dS -paper a4 %d")
554         ("^dvi$"
555          ("^a5\\(?:comb\\|paper\\)$" "^landscape$")
556          "%(o?)xdvi %dS -paper a5r -s 0 %d")
557         ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d")
558         ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d")
559         ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d")
560         ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d")
561         ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d")
562         ("^dvi$" "." "%(o?)xdvi %dS %d")
563         ("^pdf$" "." "evince %o")
564         ("^html?$" "." "netscape %o")))
565
566 ;;;----- Shell mode ---------------------------------------------------------
567
568 ;; --- Make the shell mode aware of my prompt ---
569
570 (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *")
571 (setq comint-password-prompt-regexp
572       (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)"
573               "[Pp]assword\\|pass phrase\\):\\s *\\'"))
574
575 ;; --- Notice passwords, and make C-a work right ---
576
577 (add-hook 'shell-mode-hook #'mdw-sh-mode-setup)
578
579 (add-hook 'term-mode-hook #'mdw-term-mode-setup)
580
581 ;;;----- Finishing touches --------------------------------------------------
582
583 (trap (select-window mdw-init-window))
584 (provide 'emacs-init)
585
586 ;;;----- That's all, folks --------------------------------------------------