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