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