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