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