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)) | |
168 | (setq dired-listing-switches "-alF") ;Do `ls -F' things in dired windows | |
c7a8da49 | 169 | (setq wdired-allow-to-change-permissions t) |
f617db13 MW |
170 | (setq case-fold-file-names nil) ;Don't translate file names (grr...) |
171 | (setq scroll-step 5) ;Don't scroll too much at a time | |
172 | (setq-default fill-column 77) ;I use rather narrow windows | |
173 | (setq-default comment-column 40) ;Set a standard comment column | |
174 | (setq-default truncate-partial-width-windows nil) | |
8c521a22 | 175 | (setq woman-use-own-frame nil) ;Keep man pages somewhere sensible |
f617db13 MW |
176 | (setq diff-switches "-u" ;I like reading unified diffs |
177 | cvs-diff-flags (list diff-switches)) | |
178 | (setq echo-keystrokes 10) ;Long delay before keystrokes echo | |
179 | (setq ange-ftp-ftp-program-name "pftp") ;Use passive FTP | |
180 | (setq find-ls-option ;Build file lists efficiently | |
181 | '("-print0 | xargs -0r ls -ld" . "ld")) | |
6006518e | 182 | (setq bookmark-save-flag 0) ;Save bookmarks automatically |
e34a133f | 183 | (setq Info-fontify-maximum-menu-size 100000) |
3af826d8 | 184 | (setq set-mark-command-repeat-pop t) |
cbffcf2b MW |
185 | (setq ispell-program-name "aspell" |
186 | ispell-local-dictionary "en_GB-ize-w_accents" | |
187 | flyspell-default-dictionary "en_GB-ize-w_accents" | |
689009c0 | 188 | ispell-silently-savep t) |
f617db13 MW |
189 | (trap |
190 | (require 'uniquify) | |
191 | (setq uniquify-buffer-name-style 'post-forward-angle-brackets) | |
192 | (setq uniquify-after-kill-buffer-p t)) | |
193 | (transient-mark-mode t) | |
9958af68 | 194 | (setq mark-even-if-inactive t) |
f617db13 MW |
195 | (trap |
196 | (tooltip-mode 0) | |
197 | (tool-bar-mode 0)) | |
4ae85887 | 198 | (trap (or mdw-fast-startup (global-auto-revert-mode t))) |
f617db13 MW |
199 | (setq psgml-html-build-new-buffer nil) |
200 | ||
3d6a7d27 MW |
201 | (defvar mdw-black-background t) |
202 | ||
5de5db48 MW |
203 | (eval-after-load "outline" |
204 | '(progn | |
205 | (trap (require 'foldout)) | |
206 | (define-key outline-mode-prefix-map [?\C-r] 'reveal-mode) | |
207 | (define-key outline-mode-prefix-map [?\C--] 'mdw-outline-collapse-all))) | |
8fd1960c | 208 | |
f141fe0f MW |
209 | (setq cltl2-root-url (mdw-config 'cltl-url)) |
210 | (setq common-lisp-hyperspec-root (mdw-config 'hyperspec-url)) | |
211 | ||
212 | ;;;----- W3 and URL fetching stuff ------------------------------------------ | |
213 | ||
45d17e24 | 214 | (let ((proxy (mdw-config 'http-proxy))) |
f141fe0f MW |
215 | (setq url-proxy-services |
216 | `(("http" . ,proxy) | |
217 | ("ftp" . ,proxy) | |
218 | ("gopher" . ,proxy)))) | |
219 | (setq url-cookie-untrusted-urls '(".")) | |
852cd5fb | 220 | |
a203fba8 MW |
221 | (setq browse-url-browser-function (mdw-good-url-browser) |
222 | browse-url-mozilla-program "firefox") | |
9b72460c MW |
223 | |
224 | (setq w3m-default-display-inline-images t) | |
225 | ||
f141fe0f MW |
226 | (setq w3-do-incremental-display t |
227 | w3-use-menus '(file edit view go bookmark options | |
228 | buffers style search emacs nil help) | |
229 | w3-display-inline-image t | |
230 | w3-keybinding 'info) | |
f617db13 MW |
231 | |
232 | ;;;----- Calendar configuration --------------------------------------------- | |
233 | ||
ea09c6cb MW |
234 | (setq diary-file "~/etc/diary") |
235 | ||
f617db13 MW |
236 | ;; --- Trivial stuff for the sunrise/sunset calculations --- |
237 | ||
238 | (setq calendar-latitude 52.2) | |
239 | (setq calendar-longitude 0.1) | |
240 | (setq calendar-location-name "Cambridge, UK") | |
241 | ||
a1293ade MW |
242 | ;; --- Holidays --- |
243 | ||
244 | (and (not mdw-fast-startup) | |
245 | (trap | |
246 | (require 'ew-hols) | |
247 | (setq other-holidays (append english-and-welsh-bank-holidays | |
248 | other-holidays)))) | |
249 | ||
f617db13 MW |
250 | ;; --- Date format fiddling --- |
251 | ||
252 | (setq european-calendar-style t) | |
253 | ||
254 | (setq diary-date-forms '((day "[-/]" month "[^-/0-9]") | |
255 | (day " *" monthname "[ \t]*\\(\^M\\|\n\\)") | |
256 | (backup day " *" monthname "\\W+\\<[^*0-9]") | |
257 | (day "[-/]" month "[-/]" year "[^0-9]") | |
258 | (day " *" monthname " *" year "[^0-9]") | |
259 | (year "[-/]" month "[-/]" day "[^0-9]") | |
260 | (dayname "\\W"))) | |
261 | ||
262 | ;; --- Fancy diary handling --- | |
263 | ||
264 | (add-hook 'diary-display-hook 'fancy-diary-display) | |
265 | (setq diary-list-include-blanks t) | |
266 | (add-hook 'list-diary-entries-hook 'sort-diary-entries t) | |
267 | (add-hook 'list-diary-entries-hook 'include-other-diary-files) | |
268 | (add-hook 'mark-diary-entries-hook 'mark-included-diary-files) | |
269 | ||
270 | ;; --- Appointment management --- | |
271 | ||
272 | (add-hook 'diary-hook 'appt-make-list) | |
273 | (setq appt-issue-message t) | |
274 | (setq appt-display-interval 3) | |
275 | (setq appt-message-warning-time 10) | |
276 | ||
277 | ;; --- Cosmetic stuff --- | |
278 | ||
279 | (setq display-time-24hr-format t) | |
280 | (display-time) | |
281 | (trap | |
282 | (if window-system | |
283 | (let ((view-diary-entries-initially t)) | |
284 | (calendar)))) | |
285 | ||
3d6a7d27 | 286 | ;;;----- MailCrypt ---------------------------------------------------------- |
f617db13 MW |
287 | |
288 | ;; --- Define more mode hooks for MailCrypt --- | |
289 | ||
290 | (setq mdw-mc-modes | |
291 | '((mdwmail-mode (encrypt . mdwmail-mc-encrypt) | |
292 | (sign . mdwmail-mc-sign)))) | |
293 | ||
294 | ;; --- Load the MailCrypt support --- | |
295 | ||
296 | (trap | |
297 | (and (string-match "linux" (symbol-name system-type)) | |
c7a8da49 | 298 | (not mdw-fast-startup) |
f617db13 MW |
299 | (progn (require 'mailcrypt-init) |
300 | (require 'mailcrypt) | |
301 | (setq mc-default-scheme 'mc-scheme-gpg) | |
302 | (setq mc-pgp-user-id "mdw-nsict-pgp") | |
303 | (setq mc-gpg-user-id "mdw-nsict-gpg") | |
304 | (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes)) | |
305 | (setq mc-pgp-always-sign t) | |
306 | (setq mc-gpg-always-sign t) | |
307 | (setq mc-always-replace 'never) | |
308 | (setq mc-passwd-timeout 3600) | |
309 | (setq mc-temp-directory tmpdir) | |
310 | (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes)) | |
311 | (define-key mc-write-mode-map "\C-c/S" 'mc-sign-region) | |
312 | (define-key mc-write-mode-map "\C-c/E" 'mc-encrypt-region) | |
313 | (add-hook 'text-mode-hook 'mc-install-write-mode)))) | |
314 | ||
315 | ;;;----- Other common declarations ------------------------------------------ | |
316 | ||
317 | ;; --- Default frame size --- | |
318 | ||
319 | (setq default-frame-alist | |
320 | (mdw-uniquify-alist | |
321 | '((width . 78) | |
322 | (height . 33) | |
323 | (vertical-scroll-bars . right)) | |
324 | (and window-system | |
325 | '((cursor-type . bar) | |
b5d724dd MW |
326 | (cursor-blink . t) |
327 | (left-fringe . 5) | |
328 | (right-fringe . 5) | |
329 | (scroll-bar-width . 15))) | |
f617db13 MW |
330 | '((cursor-color . "red")) |
331 | (if mdw-black-background | |
332 | '((background-color . "black") | |
333 | (foreground-color . "white") | |
334 | (background-mode . dark)) | |
335 | '((background-mode . light))) | |
336 | (and (eq window-system 'pm) | |
337 | '((font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850") | |
338 | (menu-font . "8.Helv") | |
339 | (background-color . "lightgrey"))) | |
340 | '((transparency . t)) | |
341 | default-frame-alist)) | |
342 | ||
343 | ;; --- Other frame fiddling --- | |
344 | ||
345 | (setq frame-title-format '("" invocation-name "@" system-name ": %b")) | |
346 | ||
347 | ;; --- Global keymap changes --- | |
348 | ||
349 | (trap | |
f110f932 MW |
350 | (windmove-default-keybindings)) |
351 | (setq windmove-wrap-around t) | |
f617db13 | 352 | (trap (iswitchb-mode)) |
f110f932 MW |
353 | (global-set-key [?\C-x ?w left] 'windmove-left) |
354 | (global-set-key [?\C-x ?w ?h] 'windmove-left) | |
355 | (global-set-key [?\C-x ?w up] 'windmove-up) | |
356 | (global-set-key [?\C-x ?w ?k] 'windmove-up) | |
357 | (global-set-key [?\C-x ?w down] 'windmove-down) | |
358 | (global-set-key [?\C-x ?w ?j] 'windmove-down) | |
359 | (global-set-key [?\C-x ?w right] 'windmove-right) | |
360 | (global-set-key [?\C-x ?w ?l] 'windmove-right) | |
133cf81d MW |
361 | (global-set-key [?\C-x ?g ?l] 'org-store-link) |
362 | (global-set-key [?\C-x ?g ?a] 'org-agenda) | |
5f21ac4f MW |
363 | (global-set-key [?\C-x ?t ?i] 'timeclock-in) |
364 | (global-set-key [?\C-x ?t ?c] 'timeclock-change) | |
365 | (global-set-key [?\C-x ?t ?o] 'timeclock-out) | |
366 | (global-set-key [?\C-x ?t ?r] 'timeclock-reread-log) | |
367 | (global-set-key [?\C-x ?t ?w] 'timeclock-workday-remaining-string) | |
368 | (global-set-key [?\C-x ?t ?s] 'timeclock-status-string) | |
b29312d0 MW |
369 | (global-set-key [?\C-x ?t ?p] 'nc-timesheet-prepare) |
370 | (global-set-key [?\C-x ?t ?\C-m] 'nc-timesheet-submit) | |
5d413218 | 371 | (global-set-key [?\M-#] 'calc-dispatch) |
c5e89bcd MW |
372 | (global-set-key [?\C-x ?/] 'auto-fill-mode) |
373 | (global-set-key [?\C-x ?w ?d] 'mdw-divvy-window) | |
f617db13 | 374 | (global-set-key [insertchar] 'overwrite-mode) |
5d413218 MW |
375 | (global-set-key [?\C-x ?m] 'vm-mail) |
376 | (global-set-key [?\C-x ?\C-n] 'skel-create-file) | |
377 | (global-set-key [?\C-x ?4 ?n] 'skel-create-file-other-window) | |
378 | (global-set-key [?\C-x ?5 ?n] 'skel-create-file-other-frame) | |
f617db13 | 379 | (global-set-key [delete] 'delete-char) |
5d413218 MW |
380 | (global-set-key [?\M-q] 'mdw-fill-paragraph) |
381 | (global-set-key [?\C-h ?\C-m] 'manual-entry) | |
f4450ac9 | 382 | (global-set-key [C-M-backspace] 'backward-kill-sexp) |
f617db13 MW |
383 | (global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window) |
384 | (global-set-key [vertical-scroll-bar C-down-mouse-1] | |
385 | 'mouse-drag-vertical-line) | |
386 | (global-set-key [vertical-scroll-bar C-mouse-1] | |
387 | #'(lambda () (interactive))) | |
f617db13 MW |
388 | |
389 | ;; --- Recognising types of files --- | |
390 | ||
391 | (setq auto-mode-alist | |
392 | (append `(("\\.p[lm]$" . perl-mode) | |
393 | ("\\.m$" . objc-mode) | |
394 | ("\\.mxd$" . c-mode) | |
e808c1e5 | 395 | ("\\.cs" . csharp-mode) |
133cf81d | 396 | ("\\.org$" . org-mode) |
f617db13 MW |
397 | ;; ("/[ch]/" . c-mode) |
398 | (,(concat "/\\(" | |
399 | "\\.stgit\\.msg" "\\|" | |
400 | "\\.git/COMMIT_EDITMSG" "\\|" | |
401 | "svn-commit\\.tmp" "\\|" | |
402 | "svk-commit[^/.]*\\.tmp" | |
403 | "\\)$") | |
404 | . text-mode) | |
405 | (,(concat "^" tmpdir "/\\(" | |
406 | "svk-commit[^/.]*\\.tmp" "\\|" | |
407 | "gitci\\.[^/.]*" "\\|" | |
408 | "cvs[^/.]\\{6\\}" "\\|" | |
400223a1 | 409 | "quilt_header\.[^/.]\\{6\\}" |
f617db13 MW |
410 | "\\)$") |
411 | . text-mode) | |
412 | ("\\.calc?$" . apcalc-mode) | |
413 | ("/src/linux/.*\\.\\(c\\|h\\|cc\\)$" . linux-c-mode) | |
414 | ("/\\(s\\|sh\\)/" . arm-assembler-mode) | |
415 | ("\\.\\(cmd\\|exec\\|rexx\\)$" . rexx-mode) | |
416 | ("\\.st$" . smalltalk-mode) | |
1e52f579 MW |
417 | ("\\.msgs$" . messages-mode) |
418 | ("/all-cmds\\.in$" . cpp-messages-mode) | |
f617db13 MW |
419 | ("\\.\\(tex\\|dtx\\)$" . latex-mode) |
420 | ("\\.gc$" . haskell.-mode) | |
421 | (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode) | |
870778ff | 422 | (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\|mutt\\)") |
f617db13 MW |
423 | . mdwmail-mode)) |
424 | auto-mode-alist)) | |
425 | ||
27cb4215 MW |
426 | (setq interpreter-mode-alist |
427 | (append `(("runlisp" . lisp-mode)) | |
428 | interpreter-mode-alist)) | |
429 | ||
f617db13 MW |
430 | (setq completion-ignored-extensions |
431 | (append `(".hc" ".hi") completion-ignored-extensions)) | |
432 | ||
433 | ;; --- Some common local definitions --- | |
434 | ||
435 | (make-variable-buffer-local 'mdw-auto-indent) | |
436 | ||
437 | (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config)) | |
438 | '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook | |
2ded9493 MW |
439 | csharp-mode-hook perl-mode-hook cperl-mode-hook |
440 | python-mode-hook awk-mode-hook tcl-mode-hook | |
441 | asm-mode-hook TeX-mode-hook LaTeX-mode-hook | |
442 | TeXinfo-mode-hook tex-mode-hook latex-mode-hook | |
443 | texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook | |
444 | lisp-mode-hook lisp-interaction-mode-hook | |
445 | inferior-lisp-mode-hook slime-repl-mode-hook | |
446 | sml-mode-hook haskell-mode-hook erlang-mode-hook | |
f617db13 MW |
447 | smalltalk-mode-hook rexx-mode-hook |
448 | arm-assembler-mode-hook)) | |
449 | ||
450 | (global-font-lock-mode t) | |
451 | (defalias 'perl-mode 'cperl-mode) | |
452 | ||
453 | ;;;----- Rootly editingness ------------------------------------------------- | |
454 | ||
455 | (eval-after-load "tramp" | |
456 | '(progn | |
457 | (setq tramp-methods | |
458 | (mdw-uniquify-alist | |
459 | `(("become" | |
460 | (tramp-connection-function tramp-open-connection-su) | |
461 | (tramp-remote-sh "/bin/sh") | |
462 | (tramp-login-program "become") | |
463 | (tramp-copy-program nil) | |
464 | (tramp-copy-args nil) | |
465 | (tramp-copy-keep-date-arg nil) | |
466 | (tramp-login-args ("TERM=dumb" "%u"))) | |
467 | ("really" | |
468 | (tramp-connection-function tramp-open-connection-su) | |
469 | (tramp-login-program "really") | |
470 | (tramp-login-args ("-u" "%u" "--" | |
471 | "env" "TERM=dumb" "/bin/sh")) | |
472 | (tramp-copy-program nil) | |
473 | (tramp-copy-args nil) | |
474 | (tramp-copy-keep-date-arg nil) | |
475 | (tramp-remote-sh "/bin/sh")) | |
476 | ,@tramp-methods))) | |
477 | (setq tramp-multi-connection-function-alist | |
478 | (mdw-uniquify-alist | |
479 | '(("bc" tramp-multi-connect-su "become TERM=dumb %u%n")) | |
480 | '(("r" tramp-multi-connect-su "really -u %u%n")) | |
481 | tramp-multi-connection-function-alist)) | |
482 | (setq tramp-default-method "ssh") | |
483 | (setq tramp-default-method-alist | |
484 | `(("\\`localhost\\'" "" | |
485 | ,(cond ((executable-find "become") "become") | |
486 | ((executable-find "really") "really") | |
487 | (t "su"))))))) | |
488 | ||
489 | ;;;----- General fontification ---------------------------------------------- | |
490 | ||
491 | ;; --- Configure lazy fontification --- | |
492 | ||
f29cc9b2 MW |
493 | (and (fboundp 'lazy-lock-mode) |
494 | (setq font-lock-support-mode 'lazy-lock-mode)) | |
f617db13 MW |
495 | ; (setq lazy-lock-defer-contextually t) |
496 | (setq lazy-lock-defer-time nil) | |
497 | (setq font-lock-maximum-decoration 3) | |
498 | (setq lazy-lock-minimum-size 0) | |
499 | (setq lazy-lock-stealth-time 5) | |
500 | (setq lazy-lock-stealth-lines 100) | |
501 | (setq lazy-lock-stealth-verbose t) | |
502 | ||
503 | (add-hook 'after-make-frame-functions 'mdw-do-set-font) | |
504 | (add-hook 'term-setup-hook (lambda () (mdw-do-set-font (selected-frame)))) | |
505 | (add-hook 'window-setup-hook (lambda () (mdw-do-set-font (selected-frame)))) | |
506 | ||
507 | (add-hook 'c-mode-hook 'mdw-fontify-c-and-c++ t) | |
508 | (add-hook 'objc-mode-hook 'mdw-fontify-c-and-c++ t) | |
509 | (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t) | |
510 | (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8))) | |
30c8a8fb | 511 | (add-hook 'asm-mode-hook 'mdw-fontify-asm t) |
f617db13 MW |
512 | |
513 | (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t) | |
514 | (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t) | |
515 | ||
516 | (add-hook 'java-mode-hook 'mdw-fontify-java t) | |
2ded9493 | 517 | (add-hook 'csharp-mode-hook 'mdw-fontify-csharp t) |
f617db13 MW |
518 | |
519 | (add-hook 'awk-mode-hook 'mdw-fontify-awk t) | |
520 | ||
521 | (add-hook 'perl-mode-hook 'mdw-fontify-perl t) | |
522 | (add-hook 'cperl-mode-hook 'mdw-fontify-perl t) | |
523 | ||
524 | (setq-default py-indent-offset 2) | |
525 | (add-hook 'python-mode-hook 'mdw-fontify-python t) | |
0b4dfa58 MW |
526 | (setq py-python-command-args `("-i" "-colors" ,(if mdw-black-background |
527 | "Linux" | |
528 | "LightBG"))) | |
f617db13 MW |
529 | |
530 | (setq-default tcl-indent-level 2) | |
531 | (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t) | |
532 | ||
533 | (add-hook 'rexx-mode-hook 'mdw-fontify-rexx t) | |
534 | ||
535 | (setq sml-nested-if-indent t) | |
536 | (setq sml-case-indent nil) | |
537 | (setq sml-indent-level 4) | |
538 | (setq sml-type-of-indent nil) | |
539 | (add-hook 'sml-mode-hook 'mdw-fontify-sml t) | |
540 | ||
541 | (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t) | |
542 | (setq-default haskell-indent-offset 2) | |
543 | ||
2ded9493 MW |
544 | (add-hook 'erlang-mode-hook 'mdw-fontify-erlang t) |
545 | ||
f617db13 MW |
546 | (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t) |
547 | (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t) | |
548 | ||
549 | (setq LaTeX-table-label "tbl:") | |
f617db13 MW |
550 | (setq TeX-auto-untabify nil) |
551 | (add-hook 'TeX-mode-hook 'mdw-fontify-tex t) | |
552 | (add-hook 'tex-mode-hook 'mdw-fontify-tex t) | |
553 | (add-hook 'LaTeX-mode-hook 'mdw-fontify-tex t) | |
554 | (add-hook 'latex-mode-hook 'mdw-fontify-tex t) | |
555 | ||
556 | (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode) | |
ec007bea MW |
557 | (add-hook 'autoconf-mode-hook #'mdw-setup-m4) |
558 | (add-hook 'm4-mode-hook #'mdw-setup-m4) | |
f617db13 MW |
559 | |
560 | (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t) | |
561 | (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t) | |
562 | ||
563 | (add-hook 'emacs-lisp-mode-hook 'mdw-fontify-lispy t) | |
564 | (add-hook 'scheme-mode-hook 'mdw-fontify-lispy t) | |
565 | (add-hook 'lisp-mode-hook 'mdw-fontify-lispy t) | |
566 | (add-hook 'inferior-lisp-mode-hook 'mdw-fontify-lispy t) | |
567 | (add-hook 'lisp-interaction-mode-hook 'mdw-fontify-lispy t) | |
568 | (add-hook 'slime-repl-mode-hook 'mdw-fontify-lispy t) | |
569 | (add-hook 'lisp-mode-hook 'mdw-common-lisp-indent t) | |
f617db13 MW |
570 | (add-hook 'inferior-lisp-mode-hook |
571 | #'(lambda () | |
572 | (local-set-key "\C-m" 'comint-send-and-indent)) t) | |
573 | ||
574 | (add-hook 'text-mode-hook 'mdw-text-mode t) | |
575 | ||
e9955c63 MW |
576 | ;;;----- TeX stuff ---------------------------------------------------------- |
577 | ||
578 | (setq TeX-output-view-style | |
579 | '(("^dvi$" | |
580 | ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$") | |
581 | "%(o?)dvips -t landscape %d -o && evince %f") | |
582 | ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" | |
583 | "%(o?)dvips %d -o && evince %f") | |
584 | ("^dvi$" | |
585 | ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$") | |
586 | "%(o?)xdvi %dS -paper a4r -s 0 %d") | |
587 | ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" | |
588 | "%(o?)xdvi %dS -paper a4 %d") | |
589 | ("^dvi$" | |
590 | ("^a5\\(?:comb\\|paper\\)$" "^landscape$") | |
591 | "%(o?)xdvi %dS -paper a5r -s 0 %d") | |
592 | ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d") | |
593 | ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d") | |
594 | ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") | |
595 | ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d") | |
596 | ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d") | |
597 | ("^dvi$" "." "%(o?)xdvi %dS %d") | |
598 | ("^pdf$" "." "evince %o") | |
599 | ("^html?$" "." "netscape %o"))) | |
600 | ||
ad21c20c MW |
601 | (setq reftex-use-external-file-finders t |
602 | reftex-auto-recenter-toc t) | |
603 | ||
604 | (setq reftex-label-alist | |
605 | '(("theorem" ?T "th:" "~\\ref{%s}" t ("theorems?" "th\\.") -2) | |
606 | ("axiom" ?A "ax:" "~\\ref{%s}" t ("axioms?" "ax\\.") -2) | |
607 | ("definition" ?D "def:" "~\\ref{%s}" t ("definitions?" "def\\.") -2) | |
608 | ("proposition" ?P "prop:" "~\\ref{%s}" t | |
609 | ("propositions?" "prop\\.") -2) | |
610 | ("lemma" ?P "lem:" "~\\ref{%s}" t ("lemmas?" "lem\\.") -2) | |
611 | ("example" ?X "eg:" "~\\ref{%s}" t ("examples?") -2) | |
612 | ("exercise" ?E "ex:" "~\\ref{%s}" t ("exercises?" "ex\\.") -2) | |
613 | ("enumerate" ?i "i:" "~\\ref{%s}" item ("items?")))) | |
614 | (setq reftex-section-prefixes | |
615 | '((0 . "part:") | |
616 | (1 . "ch:") | |
617 | (t . "sec:"))) | |
55f80fae | 618 | |
cfabf52c MW |
619 | (setq bibtex-field-delimiters 'double-quotes |
620 | bibtex-entry-format '(realign opts-or-alts required-fields | |
621 | numerical-fields last-comma delimiters | |
622 | unify-case) | |
623 | bibtex-include-OPTkey nil) | |
624 | ||
c70671f3 MW |
625 | ;;;----- SLIME setup -------------------------------------------------------- |
626 | ||
ea8a749b MW |
627 | (trap |
628 | (if (not mdw-fast-startup) | |
629 | (progn | |
630 | (require 'slime-autoloads) | |
631 | (slime-setup '(slime-autodoc slime-c-p-c))))) | |
632 | ||
c70671f3 MW |
633 | (let ((stuff '((cmucl ("cmucl")) |
634 | (sbcl ("sbcl") :coding-system utf-8-unix) | |
635 | (clisp ("clisp") :coding-system utf-8-unix)))) | |
636 | (or (boundp 'slime-lisp-implementations) | |
637 | (setq slime-lisp-implementations nil)) | |
638 | (while stuff | |
639 | (let* ((head (car stuff)) | |
640 | (found (assq (car head) slime-lisp-implementations))) | |
641 | (setq stuff (cdr stuff)) | |
642 | (if found | |
643 | (rplacd found (cdr head)) | |
644 | (setq slime-lisp-implementations | |
645 | (cons head slime-lisp-implementations)))))) | |
646 | (setq slime-default-lisp 'sbcl) | |
647 | ||
362f6ac4 MW |
648 | ;;;----- Blogging ----------------------------------------------------------- |
649 | ||
650 | (setq weblogger-config-alist | |
651 | '(("vox" | |
652 | ("user" . "mdw") | |
653 | ("server-url" . "http://vox.distorted.org.uk/admin/mt-xmlrpc.cgi") | |
654 | ("weblog" . "1")))) | |
655 | ||
f617db13 MW |
656 | ;;;----- Shell mode --------------------------------------------------------- |
657 | ||
658 | ;; --- Make the shell mode aware of my prompt --- | |
659 | ||
502f4699 | 660 | (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *") |
f617db13 MW |
661 | (setq comint-password-prompt-regexp |
662 | (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)" | |
663 | "[Pp]assword\\|pass phrase\\):\\s *\\'")) | |
664 | ||
665 | ;; --- Notice passwords, and make C-a work right --- | |
666 | ||
667 | (add-hook 'shell-mode-hook #'mdw-sh-mode-setup) | |
21409787 | 668 | (add-hook 'shell-mode-hook #'ansi-color-for-comint-mode-on) |
0805d57c | 669 | (setq shell-font-lock-keywords nil) |
f617db13 MW |
670 | |
671 | (add-hook 'term-mode-hook #'mdw-term-mode-setup) | |
672 | ||
673 | ;;;----- Finishing touches -------------------------------------------------- | |
674 | ||
675 | (trap (select-window mdw-init-window)) | |
676 | (provide 'emacs-init) | |
677 | ||
f617db13 | 678 | ;;;----- That's all, folks -------------------------------------------------- |