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