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