chiark / gitweb /
emacs, dot-emacs: Overhaul for Emacs22 compatibility.
[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               (left-fringe . 5)
271               (right-fringe . 5)
272               (scroll-bar-width . 15)))
273        '((cursor-color . "red"))
274        (if mdw-black-background
275            '((background-color . "black")
276              (foreground-color . "white")
277              (background-mode . dark))
278          '((background-mode . light)))
279        (and (eq window-system 'pm)
280             '((font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850")
281               (menu-font . "8.Helv")
282               (background-color . "lightgrey")))
283        '((transparency . t))
284        default-frame-alist))
285
286 ;; --- Other frame fiddling ---
287
288 (setq frame-title-format '("" invocation-name "@" system-name ": %b"))
289
290 ;; --- Global keymap changes ---
291
292 (trap
293   (windmove-default-keybindings)
294   (setq windmove-wrap-around t))
295 (trap (iswitchb-mode))
296 (global-set-key "\M-#" 'calc-dispatch)
297 (global-set-key [f4] 'query-replace-regexp)
298 (global-set-key [f5] 'goto-line)
299 (global-set-key [f6] 'auto-fill-mode)
300 (global-set-key [f7] 'occur)
301 (global-set-key [f8] 'undo)
302 (global-set-key [f9] 'mdw-divvy-window)
303 (global-set-key [insertchar] 'overwrite-mode)
304 (global-set-key "\C-xm" 'vm-mail)
305 (global-set-key "\C-x\C-n" 'skel-create-file)
306 (global-set-key "\C-x4n" 'skel-create-file-other-window)
307 (global-set-key "\C-x5n" 'skel-create-file-other-frame)
308 (global-set-key [delete] 'delete-char)
309 (global-set-key "\C-[\C-m" 'call-last-kbd-macro)
310 (global-set-key "\M-q" 'mdw-fill-paragraph)
311 (global-set-key "\C-h\C-m" 'manual-entry)
312 (global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window)
313 (global-set-key [vertical-scroll-bar C-down-mouse-1]
314                 'mouse-drag-vertical-line)
315 (global-set-key [vertical-scroll-bar C-mouse-1]
316                 #'(lambda () (interactive)))
317 (global-set-key [mouse-4] 'mdw-wheel-up)
318 (global-set-key [mouse-5] 'mdw-wheel-down)
319
320 ;; --- Recognising types of files ---
321
322 (setq auto-mode-alist
323       (append `(("\\.p[lm]$" . perl-mode)
324                 ("\\.m$" . objc-mode)
325                 ("\\.mxd$" . c-mode)
326                 ("\\.cs" . csharp-mode)
327                 ;; ("/[ch]/" . c-mode)
328                 (,(concat "/\\("
329                           "\\.stgit\\.msg" "\\|"
330                           "\\.git/COMMIT_EDITMSG" "\\|"
331                           "svn-commit\\.tmp" "\\|"
332                           "svk-commit[^/.]*\\.tmp"
333                           "\\)$")
334                  . text-mode)
335                 (,(concat "^" tmpdir "/\\("
336                           "svk-commit[^/.]*\\.tmp" "\\|"
337                           "gitci\\.[^/.]*" "\\|"
338                           "cvs[^/.]\\{6\\}" "\\|"
339                           "quilt_header\.[^/.]\\{6\\}"
340                           "\\)$")
341                  . text-mode)
342                 ("\\.calc?$" . apcalc-mode)
343                 ("/src/linux/.*\\.\\(c\\|h\\|cc\\)$" . linux-c-mode)
344                 ("/\\(s\\|sh\\)/" . arm-assembler-mode)
345                 ("\\.\\(cmd\\|exec\\|rexx\\)$" . rexx-mode)
346                 ("\\.st$" . smalltalk-mode)
347                 ("\\.msgs$" . messages-mode)
348                 ("/all-cmds\\.in$" . cpp-messages-mode)
349                 ("\\.\\(tex\\|dtx\\)$" . latex-mode)
350                 ("\\.gc$" . haskell.-mode)
351                 (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode)
352                 (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\)")
353                  . mdwmail-mode))
354               auto-mode-alist))
355
356 (setq interpreter-mode-alist
357       (append `(("runlisp" . lisp-mode))
358               interpreter-mode-alist))
359
360 (setq completion-ignored-extensions
361       (append `(".hc" ".hi") completion-ignored-extensions))
362
363 ;; --- Some common local definitions ---
364
365 (make-variable-buffer-local 'mdw-auto-indent)
366
367 (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config))
368         '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook
369           perl-mode-hook cperl-mode-hook python-mode-hook awk-mode-hook
370           tcl-mode-hook asm-mode-hook
371           TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook
372           tex-mode-hook latex-mode-hook texinfo-mode-hook
373           emacs-lisp-mode-hook scheme-mode-hook
374           lisp-mode-hook lisp-interaction-mode-hook inferior-lisp-mode-hook
375           slime-repl-mode-hook
376           sml-mode-hook haskell-mode-hook
377           smalltalk-mode-hook rexx-mode-hook
378           arm-assembler-mode-hook))
379
380 (global-font-lock-mode t)
381 (defalias 'perl-mode 'cperl-mode)
382
383 ;;;----- SGML hacking -------------------------------------------------------
384
385 (defun mdw-sgml-mode ()
386   (interactive)
387   (sgml-mode)
388   (mdw-standard-fill-prefix "")
389   (make-variable-buffer-local 'sgml-delimiters)
390   (setq sgml-delimiters
391         '("AND" "&" "COM" "--" "CRO" "&#" "DSC" "]" "DSO" "[" "DTGC" "]"
392           "DTGO" "[" "ERO" "&" "ETAGO" ":e" "GRPC" ")" "GRPO" "(" "LIT" "\""
393           "LITA" "'" "MDC" ">" "MDO" "<!" "MINUS" "-" "MSC" "]]" "NESTC" "{"
394           "NET" "}" "OPT" "?" "OR" "|" "PERO" "%" "PIC" ">" "PIO" "<?"
395           "PLUS" "+" "REFC" "." "REP" "*" "RNI" "#" "SEQ" "," "STAGO" ":"
396           "TAGC" "." "VI" "=" "MS-START" "<![" "MS-END" "]]>"
397           "XML-ECOM" "-->" "XML-PIC" "?>" "XML-SCOM" "<!--" "XML-TAGCE" "/>"
398           "NULL" ""))
399   (setq major-mode 'mdw-sgml-mode)
400   (setq mode-name "[mdw] SGML")
401   (run-hooks 'mdw-sgml-mode-hook))
402
403 ;;;----- Rootly editingness -------------------------------------------------
404
405 (eval-after-load "tramp"
406   '(progn
407      (setq tramp-methods
408            (mdw-uniquify-alist
409             `(("become"
410                (tramp-connection-function tramp-open-connection-su)
411                (tramp-remote-sh "/bin/sh")
412                (tramp-login-program "become")
413                (tramp-copy-program nil)
414                (tramp-copy-args nil)
415                (tramp-copy-keep-date-arg nil)
416                (tramp-login-args ("TERM=dumb" "%u")))
417               ("really"
418                (tramp-connection-function tramp-open-connection-su)
419                (tramp-login-program "really")
420                (tramp-login-args ("-u" "%u" "--"
421                                   "env" "TERM=dumb" "/bin/sh"))
422                (tramp-copy-program nil)
423                (tramp-copy-args nil)
424                (tramp-copy-keep-date-arg nil)
425                (tramp-remote-sh "/bin/sh"))
426               ,@tramp-methods)))
427      (setq tramp-multi-connection-function-alist
428            (mdw-uniquify-alist
429             '(("bc" tramp-multi-connect-su "become TERM=dumb %u%n"))
430             '(("r" tramp-multi-connect-su "really -u %u%n"))
431             tramp-multi-connection-function-alist))
432      (setq tramp-default-method "ssh")
433      (setq tramp-default-method-alist
434            `(("\\`localhost\\'" ""
435               ,(cond ((executable-find "become") "become")
436                      ((executable-find "really") "really")
437                      (t "su")))))))
438
439 ;;;----- General fontification ----------------------------------------------
440
441 ;; --- Configure lazy fontification ---
442
443 (and (fboundp 'lazy-lock-mode)
444      (setq font-lock-support-mode 'lazy-lock-mode))
445 ; (setq lazy-lock-defer-contextually t)
446 (setq lazy-lock-defer-time nil)
447 (setq font-lock-maximum-decoration 3)
448 (setq lazy-lock-minimum-size 0)
449 (setq lazy-lock-stealth-time 5)
450 (setq lazy-lock-stealth-lines 100)
451 (setq lazy-lock-stealth-verbose t)
452
453 (add-hook 'after-make-frame-functions 'mdw-do-set-font)
454 (add-hook 'term-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
455 (add-hook 'window-setup-hook (lambda () (mdw-do-set-font (selected-frame))))
456
457 (add-hook 'c-mode-hook 'mdw-fontify-c-and-c++ t)
458 (add-hook 'objc-mode-hook 'mdw-fontify-c-and-c++ t)
459 (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t)
460 (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8)))
461 (add-hook 'asm-mode-hook 'mdw-fontify-asm t)
462
463 (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t)
464 (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t)
465
466 (add-hook 'java-mode-hook 'mdw-fontify-java t)
467
468 (add-hook 'awk-mode-hook 'mdw-fontify-awk t)
469
470 (add-hook 'perl-mode-hook 'mdw-fontify-perl t)
471 (add-hook 'cperl-mode-hook 'mdw-fontify-perl t)
472
473 (setq-default py-indent-offset 2)
474 (add-hook 'python-mode-hook 'mdw-fontify-python t)
475
476 (setq-default tcl-indent-level 2)
477 (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t)
478
479 (add-hook 'rexx-mode-hook 'mdw-fontify-rexx t)
480
481 (setq sml-nested-if-indent t)
482 (setq sml-case-indent nil)
483 (setq sml-indent-level 4)
484 (setq sml-type-of-indent nil)
485 (add-hook 'sml-mode-hook 'mdw-fontify-sml t)
486
487 (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t)
488 (setq-default haskell-indent-offset 2)
489
490 (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t)
491 (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t)
492
493 (setq LaTeX-table-label "tbl:")
494 (setq-default TeX-master nil)
495 ;; (setq TeX-parse-self t)
496 ;; (setq TeX-auto-save t)
497 (setq TeX-auto-untabify nil)
498 (add-hook 'TeX-mode-hook 'mdw-fontify-tex t)
499 (add-hook 'tex-mode-hook 'mdw-fontify-tex t)
500 (add-hook 'LaTeX-mode-hook 'mdw-fontify-tex t)
501 (add-hook 'latex-mode-hook 'mdw-fontify-tex t)
502
503 (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode)
504
505 (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t)
506 (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t)
507
508 (add-hook 'emacs-lisp-mode-hook 'mdw-fontify-lispy t)
509 (add-hook 'scheme-mode-hook 'mdw-fontify-lispy t)
510 (add-hook 'lisp-mode-hook 'mdw-fontify-lispy t)
511 (add-hook 'inferior-lisp-mode-hook 'mdw-fontify-lispy t)
512 (add-hook 'lisp-interaction-mode-hook 'mdw-fontify-lispy t)
513 (add-hook 'slime-repl-mode-hook 'mdw-fontify-lispy t)
514 (add-hook 'lisp-mode-hook 'mdw-common-lisp-indent t)
515 (trap
516   (require 'slime-autoloads)
517   (slime-setup '(slime-autodoc)))
518 (trap (require 'xscheme))
519 (setq-default xscheme-process-command-line "scheme -large -emacs")
520 (add-hook 'inferior-lisp-mode-hook
521           #'(lambda ()
522               (local-set-key "\C-m" 'comint-send-and-indent)) t)
523
524 (add-hook 'text-mode-hook 'mdw-text-mode t)
525
526 ;;;----- TeX stuff ----------------------------------------------------------
527
528 (setq TeX-output-view-style
529       '(("^dvi$"
530          ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$")
531          "%(o?)dvips -t landscape %d -o && evince %f")
532         ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$"
533          "%(o?)dvips %d -o && evince %f")
534         ("^dvi$"
535          ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$")
536          "%(o?)xdvi %dS -paper a4r -s 0 %d")
537         ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$"
538          "%(o?)xdvi %dS -paper a4 %d")
539         ("^dvi$"
540          ("^a5\\(?:comb\\|paper\\)$" "^landscape$")
541          "%(o?)xdvi %dS -paper a5r -s 0 %d")
542         ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d")
543         ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d")
544         ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d")
545         ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d")
546         ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d")
547         ("^dvi$" "." "%(o?)xdvi %dS %d")
548         ("^pdf$" "." "evince %o")
549         ("^html?$" "." "netscape %o")))
550
551 ;;;----- Shell mode ---------------------------------------------------------
552
553 ;; --- Make the shell mode aware of my prompt ---
554
555 (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *")
556 (setq comint-password-prompt-regexp
557       (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)"
558               "[Pp]assword\\|pass phrase\\):\\s *\\'"))
559
560 ;; --- Notice passwords, and make C-a work right ---
561
562 (add-hook 'shell-mode-hook #'mdw-sh-mode-setup)
563
564 (add-hook 'term-mode-hook #'mdw-term-mode-setup)
565
566 ;;;----- Finishing touches --------------------------------------------------
567
568 (trap (select-window mdw-init-window))
569 (provide 'emacs-init)
570
571 ;;;----- That's all, folks --------------------------------------------------