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