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