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