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