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