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