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