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