Commit | Line | Data |
---|---|---|
502f4699 | 1 | ;;; -*- mode: emacs-lisp; coding: utf-8 -*- |
f617db13 MW |
2 | ;;; |
3 | ;;; $Id$ | |
4 | ;;; | |
5 | ;;; Functions and macros for .emacs | |
6 | ;;; | |
7 | ;;; (c) 2004 Mark Wooding | |
8 | ;;; | |
9 | ||
10 | ;;;----- Licensing notice --------------------------------------------------- | |
11 | ;;; | |
12 | ;;; This program is free software; you can redistribute it and/or modify | |
13 | ;;; it under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 2 of the License, or | |
15 | ;;; (at your option) any later version. | |
852cd5fb | 16 | ;;; |
f617db13 MW |
17 | ;;; This program is distributed in the hope that it will be useful, |
18 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
852cd5fb | 21 | ;;; |
f617db13 MW |
22 | ;;; You should have received a copy of the GNU General Public License |
23 | ;;; along with this program; if not, write to the Free Software Foundation, | |
24 | ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
25 | ||
26 | ;;;----- Some general utilities --------------------------------------------- | |
27 | ||
28 | ;; --- Some error trapping --- | |
29 | ;; | |
30 | ;; If individual bits of this file go tits-up, we don't particularly want | |
31 | ;; the whole lot to stop right there and then, because it's bloody annoying. | |
32 | ||
33 | (defmacro trap (&rest forms) | |
34 | "Execute FORMS without allowing errors to propagate outside." | |
35 | `(condition-case err | |
36 | ,(if (cdr forms) (cons 'progn forms) (car forms)) | |
8df912e4 MW |
37 | (error (message "Error (trapped): %s in %s" |
38 | (error-message-string err) | |
39 | ',forms)))) | |
f617db13 | 40 | |
f141fe0f MW |
41 | ;; --- Configuration reading --- |
42 | ||
43 | (defvar mdw-config nil) | |
44 | (defun mdw-config (sym) | |
45 | "Read the configuration variable named SYM." | |
46 | (unless mdw-config | |
47 | (setq mdw-config (with-temp-buffer | |
48 | (insert-file-contents "~/.mdw.conf") | |
49 | (replace-regexp "^[ \t]*\\(#.*\\|\\)\n" "" | |
50 | nil (point-min) (point-max)) | |
51 | (replace-regexp (concat "^[ \t]*" | |
52 | "\\([-a-zA-Z0-9_.]*\\)" | |
53 | "[ \t]*=[ \t]*" | |
54 | "\\(.*[^ \t\n]\\|\\)" | |
55 | "[ \t]**\\(\n\\|$\\)") | |
56 | "(\\1 . \"\\2\") " | |
57 | nil (point-min) (point-max)) | |
58 | (car (read-from-string | |
59 | (concat "(" (buffer-string) ")")))))) | |
60 | (cdr (assq sym mdw-config))) | |
61 | ||
cb6e2cd1 MW |
62 | ;; --- Is an Emacs library available? --- |
63 | ||
64 | (defun library-exists-p (name) | |
65 | "Return non-nil if NAME.el (or NAME.elc) is somewhere on the Emacs load | |
66 | path. The non-nil value is the filename we found for the library." | |
67 | (let ((path load-path) elt (foundp nil)) | |
68 | (while (and path (not foundp)) | |
69 | (setq elt (car path)) | |
70 | (setq path (cdr path)) | |
71 | (setq foundp (or (let ((file (concat elt "/" name ".elc"))) | |
72 | (and (file-exists-p file) file)) | |
73 | (let ((file (concat elt "/" name ".el"))) | |
74 | (and (file-exists-p file) file))))) | |
75 | foundp)) | |
76 | ||
77 | (defun maybe-autoload (symbol file &optional docstring interactivep type) | |
78 | "Set an autoload if the file actually exists." | |
79 | (and (library-exists-p file) | |
80 | (autoload symbol file docstring interactivep type))) | |
81 | ||
f617db13 MW |
82 | ;; --- Splitting windows --- |
83 | ||
b5d724dd MW |
84 | (or (and (fboundp 'scroll-bar-columns) |
85 | (fboundp 'fringe-columns)) | |
86 | (progn | |
87 | (defun scroll-bar-columns (side) | |
88 | (cond ((eq side 'left) 0) | |
89 | (window-system 3) | |
90 | (t 1))) | |
91 | (defun fringe-columns (side) | |
92 | (cond ((not window-system) 0) | |
93 | ((eq side 'left) 1) | |
94 | (t 2))))) | |
95 | ||
f617db13 MW |
96 | (defun mdw-divvy-window (&optional w) |
97 | "Split a wide window into appropriate widths." | |
98 | (interactive) | |
b5d724dd MW |
99 | (or w (setq w (if (and window-system |
100 | (>= emacs-major-version 22)) | |
101 | 77 | |
102 | 78))) | |
103 | (let* ((win (selected-window)) | |
104 | (sb-width (if (not window-system) | |
105 | 1 | |
106 | (+ (scroll-bar-columns 'left) | |
107 | (scroll-bar-columns 'right) | |
108 | (fringe-columns 'left) | |
109 | (fringe-columns 'right)))) | |
110 | (c (/ (+ (window-width) sb-width) | |
111 | (+ w sb-width)))) | |
f617db13 MW |
112 | (while (> c 1) |
113 | (setq c (1- c)) | |
b5d724dd | 114 | (split-window-horizontally (+ w sb-width)) |
f617db13 MW |
115 | (other-window 1)) |
116 | (select-window win))) | |
117 | ||
118 | ;; --- Functions for sexp diary entries --- | |
119 | ||
120 | (defun mdw-weekday (l) | |
121 | "Return non-nil if `date' falls on one of the days of the week in L. | |
122 | ||
123 | L is a list of day numbers (from 0 to 6 for Sunday through to Saturday) or | |
124 | symbols `sunday', `monday', etc. (or a mixture). If the date stored in | |
125 | `date' falls on a listed day, then the function returns non-nil." | |
126 | (let ((d (calendar-day-of-week date))) | |
127 | (or (memq d l) | |
128 | (memq (nth d '(sunday monday tuesday wednesday | |
129 | thursday friday saturday)) l)))) | |
130 | ||
131 | (defun mdw-todo (&optional when) | |
132 | "Return non-nil today, or on WHEN, whichever is later." | |
133 | (let ((w (calendar-absolute-from-gregorian (calendar-current-date))) | |
134 | (d (calendar-absolute-from-gregorian date))) | |
135 | (if when | |
136 | (setq w (max w (calendar-absolute-from-gregorian | |
137 | (cond | |
138 | ((not european-calendar-style) | |
139 | when) | |
140 | ((> (car when) 100) | |
141 | (list (nth 1 when) | |
142 | (nth 2 when) | |
143 | (nth 0 when))) | |
144 | (t | |
145 | (list (nth 1 when) | |
146 | (nth 0 when) | |
147 | (nth 2 when)))))))) | |
148 | (eq w d))) | |
149 | ||
150 | ;;;----- Utility functions -------------------------------------------------- | |
151 | ||
b5d724dd MW |
152 | (or (fboundp 'line-number-at-pos) |
153 | (defun line-number-at-pos (&optional pos) | |
154 | (let ((opoint (or pos (point))) start) | |
155 | (save-excursion | |
156 | (save-restriction | |
157 | (goto-char (point-min)) | |
158 | (widen) | |
159 | (forward-line 0) | |
160 | (setq start (point)) | |
161 | (goto-char opoint) | |
162 | (forward-line 0) | |
163 | (1+ (count-lines 1 (point)))))))) | |
459c9fb2 | 164 | |
f617db13 MW |
165 | ;; --- mdw-uniquify-alist --- |
166 | ||
167 | (defun mdw-uniquify-alist (&rest alists) | |
168 | ||
169 | "Return the concatenation of the ALISTS with duplicate elements removed. | |
170 | ||
171 | The first association with a given key prevails; others are ignored. The | |
172 | input lists are not modified, although they'll probably become garbage." | |
173 | ||
174 | (and alists | |
175 | (let ((start-list (cons nil nil))) | |
176 | (mdw-do-uniquify start-list | |
177 | start-list | |
178 | (car alists) | |
179 | (cdr alists))))) | |
180 | ||
181 | ;; --- mdw-do-uniquify --- | |
182 | ;; | |
183 | ;; The DONE argument is a list whose first element is `nil'. It contains the | |
184 | ;; uniquified alist built so far. The leading `nil' is stripped off at the | |
185 | ;; end of the operation; it's only there so that DONE always references a | |
186 | ;; cons cell. END refers to the final cons cell in the DONE list; it is | |
187 | ;; modified in place each time to avoid the overheads of `append'ing all the | |
188 | ;; time. The L argument is the alist we're currently processing; the | |
189 | ;; remaining alists are given in REST. | |
190 | ||
191 | (defun mdw-do-uniquify (done end l rest) | |
192 | "A helper function for mdw-uniquify-alist." | |
193 | ||
194 | ;; --- There are several different cases to deal with here --- | |
195 | ||
196 | (cond | |
197 | ||
198 | ;; --- Current list isn't empty --- | |
199 | ;; | |
200 | ;; Add the first item to the DONE list if there's not an item with the | |
201 | ;; same KEY already there. | |
202 | ||
203 | (l (or (assoc (car (car l)) done) | |
204 | (progn | |
205 | (setcdr end (cons (car l) nil)) | |
206 | (setq end (cdr end)))) | |
207 | (mdw-do-uniquify done end (cdr l) rest)) | |
208 | ||
209 | ;; --- The list we were working on is empty --- | |
210 | ;; | |
211 | ;; Shunt the next list into the current list position and go round again. | |
212 | ||
213 | (rest (mdw-do-uniquify done end (car rest) (cdr rest))) | |
214 | ||
215 | ;; --- Everything's done --- | |
216 | ;; | |
217 | ;; Remove the leading `nil' from the DONE list and return it. Finished! | |
218 | ||
219 | (t (cdr done)))) | |
220 | ||
221 | ;; --- Insert a date --- | |
222 | ||
223 | (defun date () | |
224 | "Insert the current date in a pleasing way." | |
225 | (interactive) | |
226 | (insert (save-excursion | |
227 | (let ((buffer (get-buffer-create "*tmp*"))) | |
228 | (unwind-protect (progn (set-buffer buffer) | |
229 | (erase-buffer) | |
230 | (shell-command "date +%Y-%m-%d" t) | |
231 | (goto-char (mark)) | |
232 | (delete-backward-char 1) | |
233 | (buffer-string)) | |
234 | (kill-buffer buffer)))))) | |
235 | ||
236 | ;; --- UUencoding --- | |
237 | ||
238 | (defun uuencode (file &optional name) | |
239 | "UUencodes a file, maybe calling it NAME, into the current buffer." | |
240 | (interactive "fInput file name: ") | |
241 | ||
242 | ;; --- If NAME isn't specified, then guess from the filename --- | |
243 | ||
244 | (if (not name) | |
245 | (setq name | |
246 | (substring file | |
247 | (or (string-match "[^/]*$" file) 0)))) | |
248 | ||
249 | (print (format "uuencode `%s' `%s'" file name)) | |
250 | ||
251 | ;; --- Now actually do the thing --- | |
252 | ||
253 | (call-process "uuencode" file t nil name)) | |
254 | ||
255 | (defvar np-file "~/.np" | |
256 | "*Where the `now-playing' file is.") | |
257 | ||
258 | (defun np (&optional arg) | |
259 | "Grabs a `now-playing' string." | |
260 | (interactive) | |
261 | (save-excursion | |
262 | (or arg (progn | |
852cd5fb | 263 | (goto-char (point-max)) |
f617db13 | 264 | (insert "\nNP: ") |
852cd5fb | 265 | (insert-file np-file))))) |
f617db13 MW |
266 | |
267 | (trap | |
268 | (require 'tramp) | |
269 | (require 'autorevert) | |
270 | (defun mdw-check-autorevert () | |
271 | (if (and (buffer-file-name) | |
272 | (tramp-tramp-file-p (buffer-file-name))) | |
273 | (unless global-auto-revert-ignore-buffer | |
274 | (setq global-auto-revert-ignore-buffer 'tramp)) | |
275 | (if (eq global-auto-revert-ignore-buffer 'tramp) | |
276 | (setq global-auto-revert-ignore-buffer nil)))) | |
277 | (defadvice find-file (after mdw-autorevert activate) | |
278 | (mdw-check-autorevert)) | |
279 | (defadvice write-file (after mdw-autorevert activate) | |
280 | (mdw-check-autorevert))) | |
281 | ||
282 | (defun mdwmail-mode () | |
283 | "Major mode for editing news and mail messages from external programs | |
284 | Not much right now. Just support for doing MailCrypt stuff." | |
285 | (interactive) | |
286 | (kill-all-local-variables) | |
287 | (use-local-map text-mode-map) | |
288 | (setq local-abbrev-table text-mode-abbrev-table) | |
289 | (setq major-mode 'mdwmail-mode) | |
290 | (setq mode-name "[mdw] mail") | |
291 | (make-local-variable 'paragraph-separate) | |
292 | (make-local-variable 'paragraph-start) | |
293 | (setq paragraph-start (concat "[ \t]*[-_][-_][-_]+$\\|^-- \\|-----\\|" | |
294 | paragraph-start)) | |
295 | (setq paragraph-separate (concat "[ \t]*[-_][-_][-_]+$\\|^-- \\|-----\\|" | |
296 | paragraph-separate)) | |
297 | (run-hooks 'text-mode-hook 'mdwmail-mode-hook 'mail-setup-hook)) | |
298 | ||
299 | ;; --- How to encrypt in mdwmail --- | |
300 | ||
301 | (defun mdwmail-mc-encrypt (&optional recip scm start end from sign) | |
302 | (or start | |
303 | (setq start (save-excursion | |
304 | (goto-char (point-min)) | |
305 | (or (search-forward "\n\n" nil t) (point-min))))) | |
306 | (or end | |
307 | (setq end (point-max))) | |
308 | (mc-encrypt-generic recip scm start end from sign)) | |
309 | ||
310 | ;; --- How to sign in mdwmail --- | |
311 | ||
312 | (defun mdwmail-mc-sign (key scm start end uclr) | |
313 | (or start | |
314 | (setq start (save-excursion | |
315 | (goto-char (point-min)) | |
316 | (or (search-forward "\n\n" nil t) (point-min))))) | |
317 | (or end | |
318 | (setq end (point-max))) | |
319 | (mc-sign-generic key scm start end uclr)) | |
320 | ||
321 | ;; --- Some signature mangling --- | |
322 | ||
323 | (defun mdwmail-mangle-signature () | |
324 | (save-excursion | |
325 | (goto-char (point-min)) | |
326 | (perform-replace "\n-- \n" "\n-- " nil nil nil))) | |
327 | (add-hook 'mail-setup-hook 'mdwmail-mangle-signature) | |
328 | ||
a203fba8 MW |
329 | ;;;----- URL viewing -------------------------------------------------------- |
330 | ||
331 | (defun mdw-w3m-browse-url (url &optional new-session-p) | |
332 | "Invoke w3m on the URL in its current window, or at least a different one. | |
333 | If NEW-SESSION-P, start a new session." | |
334 | (interactive "sURL: \nP") | |
335 | (save-excursion | |
63fb20c1 MW |
336 | (let ((window (selected-window))) |
337 | (unwind-protect | |
338 | (progn | |
339 | (select-window (or (and (not new-session-p) | |
340 | (get-buffer-window "*w3m*")) | |
341 | (progn | |
342 | (if (one-window-p t) (split-window)) | |
343 | (get-lru-window)))) | |
344 | (w3m-browse-url url new-session-p)) | |
345 | (select-window window))))) | |
a203fba8 MW |
346 | |
347 | (defvar mdw-good-url-browsers | |
348 | '((w3m . mdw-w3m-browse-url) | |
349 | browse-url-w3 | |
350 | browse-url-mozilla) | |
351 | "List of good browsers for mdw-good-url-browsers; each item is a browser | |
352 | function name, or a cons (CHECK . FUNC). A symbol FOO stands for (FOO | |
353 | . FOO).") | |
354 | ||
355 | (defun mdw-good-url-browser () | |
356 | "Return a good URL browser. Trundle the list of such things, finding the | |
357 | first item for which CHECK is fboundp, and returning the correponding FUNC." | |
358 | (let ((bs mdw-good-url-browsers) b check func answer) | |
359 | (while (and bs (not answer)) | |
360 | (setq b (car bs) | |
361 | bs (cdr bs)) | |
362 | (if (consp b) | |
363 | (setq check (car b) func (cdr b)) | |
364 | (setq check b func b)) | |
365 | (if (fboundp check) | |
366 | (setq answer func))) | |
367 | answer)) | |
368 | ||
f617db13 MW |
369 | ;;;----- Paragraph filling -------------------------------------------------- |
370 | ||
371 | ;; --- Useful variables --- | |
372 | ||
373 | (defvar mdw-fill-prefix nil | |
374 | "*Used by `mdw-line-prefix' and `mdw-fill-paragraph'. If there's | |
375 | no fill prefix currently set (by the `fill-prefix' variable) and there's | |
376 | a match from one of the regexps here, it gets used to set the fill-prefix | |
377 | for the current operation. | |
378 | ||
379 | The variable is a list of items of the form `REGEXP . PREFIX'; if the | |
380 | REGEXP matches, the PREFIX is used to set the fill prefix. It in turn is | |
381 | a list of things: | |
382 | ||
383 | STRING -- insert a literal string | |
384 | (match . N) -- insert the thing matched by bracketed subexpression N | |
385 | (pad . N) -- a string of whitespace the same width as subexpression N | |
386 | (expr . FORM) -- the result of evaluating FORM") | |
387 | ||
388 | (make-variable-buffer-local 'mdw-fill-prefix) | |
389 | ||
390 | (defvar mdw-hanging-indents | |
391 | "\\(\\(\\([*o]\\|--\\|[0-9]+\\.\\|\\[[0-9]+\\]\\|([a-zA-Z])\\)[ \t]+\\)?\\)" | |
392 | "*Standard regular expression matching things which might be part of a | |
393 | hanging indent. This is mainly useful in `auto-fill-mode'.") | |
394 | ||
395 | ;; --- Setting things up --- | |
396 | ||
397 | (fset 'mdw-do-auto-fill (symbol-function 'do-auto-fill)) | |
398 | ||
399 | ;; --- Utility functions --- | |
400 | ||
401 | (defun mdw-tabify (s) | |
402 | "Tabify the string S. This is a horrid hack." | |
403 | (save-excursion | |
404 | (save-match-data | |
405 | (let (start end) | |
406 | (beginning-of-line) | |
407 | (setq start (point-marker)) | |
408 | (insert s "\n") | |
409 | (setq end (point-marker)) | |
410 | (tabify start end) | |
411 | (setq s (buffer-substring start (1- end))) | |
412 | (delete-region start end) | |
413 | (set-marker start nil) | |
414 | (set-marker end nil) | |
415 | s)))) | |
416 | ||
417 | (defun mdw-examine-fill-prefixes (l) | |
418 | "Given a list of dynamic fill prefixes, pick one which matches context and | |
419 | return the static fill prefix to use. Point must be at the start of a line, | |
420 | and match data must be saved." | |
421 | (cond ((not l) nil) | |
422 | ((looking-at (car (car l))) | |
423 | (mdw-tabify (apply (function concat) | |
424 | (mapcar (function mdw-do-prefix-match) | |
425 | (cdr (car l)))))) | |
426 | (t (mdw-examine-fill-prefixes (cdr l))))) | |
427 | ||
428 | (defun mdw-maybe-car (p) | |
429 | "If P is a pair, return (car P), otherwise just return P." | |
430 | (if (consp p) (car p) p)) | |
431 | ||
432 | (defun mdw-padding (s) | |
433 | "Return a string the same width as S but made entirely from whitespace." | |
434 | (let* ((l (length s)) (i 0) (n (make-string l ? ))) | |
435 | (while (< i l) | |
436 | (if (= 9 (aref s i)) | |
437 | (aset n i 9)) | |
438 | (setq i (1+ i))) | |
439 | n)) | |
440 | ||
441 | (defun mdw-do-prefix-match (m) | |
442 | "Expand a dynamic prefix match element. See `mdw-fill-prefix' for | |
443 | details." | |
444 | (cond ((not (consp m)) (format "%s" m)) | |
445 | ((eq (car m) 'match) (match-string (mdw-maybe-car (cdr m)))) | |
446 | ((eq (car m) 'pad) (mdw-padding (match-string | |
447 | (mdw-maybe-car (cdr m))))) | |
448 | ((eq (car m) 'eval) (eval (cdr m))) | |
449 | (t ""))) | |
450 | ||
451 | (defun mdw-choose-dynamic-fill-prefix () | |
452 | "Work out the dynamic fill prefix based on the variable `mdw-fill-prefix'." | |
453 | (cond ((and fill-prefix (not (string= fill-prefix ""))) fill-prefix) | |
454 | ((not mdw-fill-prefix) fill-prefix) | |
455 | (t (save-excursion | |
456 | (beginning-of-line) | |
457 | (save-match-data | |
458 | (mdw-examine-fill-prefixes mdw-fill-prefix)))))) | |
459 | ||
460 | (defun do-auto-fill () | |
461 | "Handle auto-filling, working out a dynamic fill prefix in the case where | |
462 | there isn't a sensible static one." | |
463 | (let ((fill-prefix (mdw-choose-dynamic-fill-prefix))) | |
464 | (mdw-do-auto-fill))) | |
465 | ||
466 | (defun mdw-fill-paragraph () | |
467 | "Fill paragraph, getting a dynamic fill prefix." | |
468 | (interactive) | |
469 | (let ((fill-prefix (mdw-choose-dynamic-fill-prefix))) | |
470 | (fill-paragraph nil))) | |
471 | ||
472 | (defun mdw-standard-fill-prefix (rx &optional mat) | |
473 | "Set the dynamic fill prefix, handling standard hanging indents and stuff. | |
474 | This is just a short-cut for setting the thing by hand, and by design it | |
475 | doesn't cope with anything approximating a complicated case." | |
476 | (setq mdw-fill-prefix | |
477 | `((,(concat rx mdw-hanging-indents) | |
478 | (match . 1) | |
479 | (pad . ,(or mat 2)))))) | |
480 | ||
481 | ;;;----- Other common declarations ------------------------------------------ | |
482 | ||
483 | (defun mdw-set-frame-transparency (&optional n) | |
484 | (interactive "P") | |
485 | (let* ((alist (frame-parameters)) | |
486 | (trans (assq 'transparency alist))) | |
487 | (if trans | |
488 | (rplacd trans (not (if n (zerop n) (cdr trans)))) | |
489 | (setq trans (cons 'transparency (not (equal 0 n))))) | |
490 | (modify-frame-parameters (selected-frame) (list trans)))) | |
491 | ||
492 | ;; --- Mouse wheel support --- | |
493 | ||
494 | (defconst mdw-wheel-scroll-amount 15) | |
495 | (defun mdw-wheel-up (click) | |
496 | (interactive "@e") | |
497 | (mdw-wheel-scroll click (function scroll-down))) | |
498 | (defun mdw-wheel-down (click) | |
499 | (interactive "@e") | |
500 | (mdw-wheel-scroll click (function scroll-up))) | |
501 | ||
502 | (defun mdw-wheel-scroll (click func) | |
503 | (let ((win (selected-window))) | |
504 | (unwind-protect | |
505 | (progn | |
506 | (select-window (posn-window (event-start click))) | |
507 | (let ((arg 2)) | |
508 | (funcall func (/ (window-height) 2)))) | |
509 | (select-window win)))) | |
510 | ||
511 | ;; --- Going backwards --- | |
512 | ||
513 | (defun other-window-backwards (arg) | |
514 | (interactive "p") | |
515 | (other-window (- arg))) | |
516 | ||
517 | ;; --- Common mode settings --- | |
518 | ||
519 | (defvar mdw-auto-indent t | |
520 | "Whether to indent automatically after a newline.") | |
521 | ||
522 | (defun mdw-misc-mode-config () | |
523 | (and mdw-auto-indent | |
524 | (cond ((eq major-mode 'lisp-mode) | |
525 | (local-set-key "\C-m" 'mdw-indent-newline-and-indent)) | |
30c8a8fb MW |
526 | ((or (eq major-mode 'slime-repl-mode) |
527 | (eq major-mode 'asm-mode)) | |
528 | nil) | |
f617db13 MW |
529 | (t |
530 | (local-set-key "\C-m" 'newline-and-indent)))) | |
531 | (local-set-key [C-return] 'newline) | |
30c8a8fb MW |
532 | (or (eq major-mode 'asm-mode) |
533 | (local-set-key [?\;] 'self-insert-command)) | |
f617db13 MW |
534 | (local-set-key [?\#] 'self-insert-command) |
535 | (local-set-key [?\"] 'self-insert-command) | |
536 | (setq comment-column 40) | |
537 | (auto-fill-mode 1) | |
538 | (setq fill-column 77) | |
473ff3b0 | 539 | (setq show-trailing-whitespace t) |
f617db13 MW |
540 | (mdw-set-font)) |
541 | ||
542 | ;; --- Set up all sorts of faces --- | |
543 | ||
544 | (defvar mdw-set-font nil) | |
545 | ||
546 | (defvar mdw-punct-face 'mdw-punct-face "Face to use for punctuation") | |
547 | (make-face 'mdw-punct-face) | |
548 | (defvar mdw-number-face 'mdw-number-face "Face to use for numbers") | |
549 | (make-face 'mdw-number-face) | |
550 | ||
551 | ;;;----- General fontification ---------------------------------------------- | |
552 | ||
473ff3b0 MW |
553 | (defun mdw-set-fonts (frame faces) |
554 | (while faces | |
555 | (let ((face (caar faces))) | |
556 | (or (facep face) (make-face face)) | |
557 | (set-face-attribute face frame | |
558 | :family 'unspecified | |
559 | :width 'unspecified | |
560 | :height 'unspecified | |
561 | :weight 'unspecified | |
562 | :slant 'unspecified | |
563 | :foreground 'unspecified | |
564 | :background 'unspecified | |
565 | :underline 'unspecified | |
566 | :overline 'unspecified | |
567 | :strike-through 'unspecified | |
568 | :box 'unspecified | |
569 | :inverse-video 'unspecified | |
570 | :stipple 'unspecified | |
571 | ;:font 'unspecified | |
572 | :inherit 'unspecified) | |
573 | (apply 'set-face-attribute face frame (cdar faces)) | |
574 | (setq faces (cdr faces))))) | |
f617db13 MW |
575 | |
576 | (defun mdw-do-set-font (&optional frame) | |
577 | (interactive) | |
578 | (mdw-set-fonts (and (boundp 'frame) frame) `( | |
579 | (default :foreground "white" :background "black" | |
580 | ,@(cond ((eq window-system 'w32) | |
581 | '(:family "courier new" :height 85)) | |
582 | ((eq window-system 'x) | |
9cbbe332 | 583 | '(:family "misc-fixed" :height 130 :width semi-condensed)))) |
b5d724dd MW |
584 | (fixed-pitch) |
585 | (minibuffer-prompt) | |
668e254c MW |
586 | (mode-line :foreground "blue" :background "yellow" |
587 | :box (:line-width 1 :style released-button)) | |
414d8484 | 588 | (mode-line-inactive :foreground "yellow" :background "blue" |
668e254c | 589 | :box (:line-width 1 :style released-button)) |
f617db13 | 590 | (scroll-bar :foreground "black" :background "lightgrey") |
414d8484 | 591 | (fringe :foreground "yellow" :background "black") |
f617db13 MW |
592 | (show-paren-match-face :background "darkgreen") |
593 | (show-paren-mismatch-face :background "red") | |
594 | (font-lock-warning-face :background "red" :weight bold) | |
595 | (highlight :background "DarkSeaGreen4") | |
596 | (holiday-face :background "red") | |
597 | (calendar-today-face :foreground "yellow" :weight bold) | |
598 | (comint-highlight-prompt :weight bold) | |
599 | (comint-highlight-input) | |
600 | (font-lock-builtin-face :weight bold) | |
601 | (font-lock-type-face :weight bold) | |
602 | (region :background "grey30") | |
603 | (isearch :background "palevioletred2") | |
604 | (mdw-punct-face :foreground ,(if window-system "burlywood2" "yellow")) | |
605 | (mdw-number-face :foreground "yellow") | |
606 | (font-lock-function-name-face :weight bold) | |
607 | (font-lock-variable-name-face :slant italic) | |
608 | (font-lock-comment-face | |
609 | :foreground ,(if window-system "SeaGreen1" "green") | |
610 | :slant italic) | |
611 | (font-lock-string-face :foreground ,(if window-system "SkyBlue1" "cyan")) | |
612 | (font-lock-keyword-face :weight bold) | |
613 | (font-lock-constant-face :weight bold) | |
614 | (font-lock-reference-face :weight bold) | |
615 | (woman-bold-face :weight bold) | |
616 | (woman-italic-face :slant italic) | |
617 | (diff-header-face :foreground "skyblue1") | |
618 | (diff-index-face :weight bold) | |
619 | (diff-file-header-face) | |
620 | (diff-context-face :foreground "grey70") | |
621 | (diff-added-face :foreground "white") | |
622 | (diff-removed-face :foreground "white" :slant italic) | |
623 | (whizzy-slice-face :background "grey10") | |
624 | (whizzy-error-face :background "darkred") | |
473ff3b0 | 625 | (trailing-whitespace :background "red") |
f617db13 MW |
626 | ))) |
627 | ||
628 | (defun mdw-set-font () | |
629 | (trap | |
630 | (turn-on-font-lock) | |
631 | (if (not mdw-set-font) | |
632 | (progn | |
633 | (setq mdw-set-font t) | |
634 | (mdw-do-set-font nil))))) | |
635 | ||
636 | ;;;----- C programming configuration ---------------------------------------- | |
637 | ||
638 | ;; --- Linux kernel hacking --- | |
639 | ||
640 | (defvar linux-c-mode-hook) | |
641 | ||
642 | (defun linux-c-mode () | |
643 | (interactive) | |
644 | (c-mode) | |
645 | (setq major-mode 'linux-c-mode) | |
646 | (setq mode-name "Linux C") | |
647 | (run-hooks 'linux-c-mode-hook)) | |
648 | ||
649 | ;; --- Make C indentation nice --- | |
650 | ||
651 | (defun mdw-c-style () | |
652 | (c-add-style "[mdw] C and C++ style" | |
653 | '((c-basic-offset . 2) | |
654 | (c-tab-always-indent . nil) | |
655 | (comment-column . 40) | |
656 | (c-class-key . "class") | |
657 | (c-offsets-alist (substatement-open . 0) | |
658 | (label . 0) | |
659 | (case-label . +) | |
660 | (access-label . -) | |
661 | (inclass . ++) | |
662 | (inline-open . ++) | |
663 | (statement-cont . 0) | |
664 | (statement-case-intro . +))) | |
665 | t)) | |
666 | ||
667 | (defun mdw-fontify-c-and-c++ () | |
668 | ||
669 | ;; --- Fiddle with some syntax codes --- | |
670 | ||
671 | (modify-syntax-entry ?_ "w") | |
672 | (modify-syntax-entry ?* ". 23") | |
673 | (modify-syntax-entry ?/ ". 124b") | |
674 | (modify-syntax-entry ?\n "> b") | |
675 | ||
676 | ;; --- Other stuff --- | |
677 | ||
678 | (mdw-c-style) | |
679 | (setq c-hanging-comment-ender-p nil) | |
680 | (setq c-backslash-column 72) | |
681 | (setq c-label-minimum-indentation 0) | |
f617db13 MW |
682 | (setq mdw-fill-prefix |
683 | `((,(concat "\\([ \t]*/?\\)" | |
684 | "\\([\*/][ \t]*\\)" | |
685 | "\\([A-Za-z]+:[ \t]*\\)?" | |
686 | mdw-hanging-indents) | |
687 | (pad . 1) (match . 2) (pad . 3) (pad . 4)))) | |
688 | ||
689 | ;; --- Now define things to be fontified --- | |
690 | ||
02109a0d | 691 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
692 | (let ((c-keywords |
693 | (make-regexp '( | |
4459800e MW |
694 | "and" ;C++ |
695 | "and_eq" ;C++ | |
f617db13 MW |
696 | "asm" ;K&R, GCC |
697 | "auto" ;K&R, C89 | |
4459800e MW |
698 | "bitand" ;C++ |
699 | "bitor" ;C++ | |
f617db13 MW |
700 | "bool" ;C++, C9X macro |
701 | "break" ;K&R, C89 | |
702 | "case" ;K&R, C89 | |
703 | "catch" ;C++ | |
704 | "char" ;K&R, C89 | |
705 | "class" ;C++ | |
706 | "complex" ;C9X macro, C++ template type | |
4459800e | 707 | "compl" ;C++ |
f617db13 MW |
708 | "const" ;C89 |
709 | "const_cast" ;C++ | |
710 | "continue" ;K&R, C89 | |
711 | "defined" ;C89 preprocessor | |
712 | "default" ;K&R, C89 | |
713 | "delete" ;C++ | |
714 | "do" ;K&R, C89 | |
715 | "double" ;K&R, C89 | |
716 | "dynamic_cast" ;C++ | |
717 | "else" ;K&R, C89 | |
718 | ;; "entry" ;K&R -- never used | |
719 | "enum" ;C89 | |
720 | "explicit" ;C++ | |
4459800e | 721 | "export" ;C++ |
f617db13 MW |
722 | "extern" ;K&R, C89 |
723 | "false" ;C++, C9X macro | |
724 | "float" ;K&R, C89 | |
725 | "for" ;K&R, C89 | |
4459800e | 726 | ;; "fortran" ;K&R |
f617db13 MW |
727 | "friend" ;C++ |
728 | "goto" ;K&R, C89 | |
729 | "if" ;K&R, C89 | |
730 | "imaginary" ;C9X macro | |
731 | "inline" ;C++, C9X, GCC | |
732 | "int" ;K&R, C89 | |
733 | "long" ;K&R, C89 | |
734 | "mutable" ;C++ | |
735 | "namespace" ;C++ | |
736 | "new" ;C++ | |
737 | "operator" ;C++ | |
4459800e MW |
738 | "or" ;C++ |
739 | "or_eq" ;C++ | |
f617db13 MW |
740 | "private" ;C++ |
741 | "protected" ;C++ | |
742 | "public" ;C++ | |
743 | "register" ;K&R, C89 | |
744 | "reinterpret_cast" ;C++ | |
745 | "restrict" ;C9X | |
746 | "return" ;K&R, C89 | |
747 | "short" ;K&R, C89 | |
748 | "signed" ;C89 | |
749 | "sizeof" ;K&R, C89 | |
750 | "static" ;K&R, C89 | |
751 | "static_cast" ;C++ | |
752 | "struct" ;K&R, C89 | |
753 | "switch" ;K&R, C89 | |
754 | "template" ;C++ | |
755 | "this" ;C++ | |
756 | "throw" ;C++ | |
757 | "true" ;C++, C9X macro | |
758 | "try" ;C++ | |
759 | "this" ;C++ | |
760 | "typedef" ;C89 | |
761 | "typeid" ;C++ | |
762 | "typeof" ;GCC | |
763 | "typename" ;C++ | |
764 | "union" ;K&R, C89 | |
765 | "unsigned" ;K&R, C89 | |
766 | "using" ;C++ | |
767 | "virtual" ;C++ | |
768 | "void" ;C89 | |
769 | "volatile" ;C89 | |
770 | "wchar_t" ;C++, C89 library type | |
771 | "while" ;K&R, C89 | |
4459800e MW |
772 | "xor" ;C++ |
773 | "xor_eq" ;C++ | |
f617db13 MW |
774 | "_Bool" ;C9X |
775 | "_Complex" ;C9X | |
776 | "_Imaginary" ;C9X | |
777 | "_Pragma" ;C9X preprocessor | |
778 | "__alignof__" ;GCC | |
779 | "__asm__" ;GCC | |
780 | "__attribute__" ;GCC | |
781 | "__complex__" ;GCC | |
782 | "__const__" ;GCC | |
783 | "__extension__" ;GCC | |
784 | "__imag__" ;GCC | |
785 | "__inline__" ;GCC | |
786 | "__label__" ;GCC | |
787 | "__real__" ;GCC | |
788 | "__signed__" ;GCC | |
789 | "__typeof__" ;GCC | |
790 | "__volatile__" ;GCC | |
791 | ))) | |
792 | (preprocessor-keywords | |
793 | (make-regexp '("assert" "define" "elif" "else" "endif" "error" | |
794 | "ident" "if" "ifdef" "ifndef" "import" "include" | |
795 | "line" "pragma" "unassert" "undef" "warning"))) | |
796 | (objc-keywords | |
797 | (make-regexp '("class" "defs" "encode" "end" "implementation" | |
798 | "interface" "private" "protected" "protocol" "public" | |
799 | "selector")))) | |
800 | ||
801 | (setq font-lock-keywords | |
802 | (list | |
f617db13 MW |
803 | |
804 | ;; --- Fontify include files as strings --- | |
805 | ||
806 | (list (concat "^[ \t]*\\#[ \t]*" | |
807 | "\\(include\\|import\\)" | |
808 | "[ \t]*\\(<[^>]+\\(>\\|\\)\\)") | |
809 | '(2 font-lock-string-face)) | |
810 | ||
811 | ;; --- Preprocessor directives are `references'? --- | |
812 | ||
813 | (list (concat "^\\([ \t]*#[ \t]*\\(\\(" | |
814 | preprocessor-keywords | |
815 | "\\)\\>\\|[0-9]+\\|$\\)\\)") | |
816 | '(1 font-lock-keyword-face)) | |
817 | ||
818 | ;; --- Handle the keywords defined above --- | |
819 | ||
820 | (list (concat "@\\<\\(" objc-keywords "\\)\\>") | |
821 | '(0 font-lock-keyword-face)) | |
822 | ||
823 | (list (concat "\\<\\(" c-keywords "\\)\\>") | |
824 | '(0 font-lock-keyword-face)) | |
825 | ||
826 | ;; --- Handle numbers too --- | |
827 | ;; | |
828 | ;; This looks strange, I know. It corresponds to the | |
829 | ;; preprocessor's idea of what a number looks like, rather than | |
830 | ;; anything sensible. | |
831 | ||
832 | (list (concat "\\(\\<[0-9]\\|\\.[0-9]\\)" | |
833 | "\\([Ee][+-]\\|[0-9A-Za-z_.]\\)*") | |
834 | '(0 mdw-number-face)) | |
835 | ||
836 | ;; --- And anything else is punctuation --- | |
837 | ||
838 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
839 | '(0 mdw-punct-face)))))) | |
840 | ||
841 | ;;;----- AP calc mode ------------------------------------------------------- | |
842 | ||
843 | (defun apcalc-mode () | |
844 | (interactive) | |
845 | (c-mode) | |
846 | (setq major-mode 'apcalc-mode) | |
847 | (setq mode-name "AP Calc") | |
848 | (run-hooks 'apcalc-mode-hook)) | |
849 | ||
850 | (defun mdw-fontify-apcalc () | |
851 | ||
852 | ;; --- Fiddle with some syntax codes --- | |
853 | ||
854 | (modify-syntax-entry ?_ "w") | |
855 | (modify-syntax-entry ?* ". 23") | |
856 | (modify-syntax-entry ?/ ". 14") | |
857 | ||
858 | ;; --- Other stuff --- | |
859 | ||
860 | (mdw-c-style) | |
861 | (setq c-hanging-comment-ender-p nil) | |
862 | (setq c-backslash-column 72) | |
863 | (setq comment-start "/* ") | |
864 | (setq comment-end " */") | |
865 | (setq mdw-fill-prefix | |
866 | `((,(concat "\\([ \t]*/?\\)" | |
867 | "\\([\*/][ \t]*\\)" | |
868 | "\\([A-Za-z]+:[ \t]*\\)?" | |
869 | mdw-hanging-indents) | |
870 | (pad . 1) (match . 2) (pad . 3) (pad . 4)))) | |
871 | ||
872 | ;; --- Now define things to be fontified --- | |
873 | ||
02109a0d | 874 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
875 | (let ((c-keywords |
876 | (make-regexp '("break" "case" "cd" "continue" "define" "default" | |
877 | "do" "else" "exit" "for" "global" "goto" "help" "if" | |
878 | "local" "mat" "obj" "print" "quit" "read" "return" | |
879 | "show" "static" "switch" "while" "write")))) | |
880 | ||
881 | (setq font-lock-keywords | |
882 | (list | |
f617db13 MW |
883 | |
884 | ;; --- Handle the keywords defined above --- | |
885 | ||
886 | (list (concat "\\<\\(" c-keywords "\\)\\>") | |
887 | '(0 font-lock-keyword-face)) | |
888 | ||
889 | ;; --- Handle numbers too --- | |
890 | ;; | |
891 | ;; This looks strange, I know. It corresponds to the | |
892 | ;; preprocessor's idea of what a number looks like, rather than | |
893 | ;; anything sensible. | |
894 | ||
895 | (list (concat "\\(\\<[0-9]\\|\\.[0-9]\\)" | |
896 | "\\([Ee][+-]\\|[0-9A-Za-z_.]\\)*") | |
897 | '(0 mdw-number-face)) | |
898 | ||
899 | ;; --- And anything else is punctuation --- | |
900 | ||
901 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
902 | '(0 mdw-punct-face)))))) | |
903 | ||
904 | ;;;----- Java programming configuration ------------------------------------- | |
905 | ||
906 | ;; --- Make indentation nice --- | |
907 | ||
908 | (defun mdw-java-style () | |
909 | (c-add-style "[mdw] Java style" | |
910 | '((c-basic-offset . 2) | |
911 | (c-tab-always-indent . nil) | |
912 | (c-offsets-alist (substatement-open . 0) | |
913 | (label . +) | |
914 | (case-label . +) | |
915 | (access-label . 0) | |
916 | (inclass . +) | |
917 | (statement-case-intro . +))) | |
918 | t)) | |
919 | ||
920 | ;; --- Declare Java fontification style --- | |
921 | ||
922 | (defun mdw-fontify-java () | |
923 | ||
924 | ;; --- Other stuff --- | |
925 | ||
926 | (mdw-java-style) | |
927 | (modify-syntax-entry ?_ "w") | |
928 | (setq c-hanging-comment-ender-p nil) | |
929 | (setq c-backslash-column 72) | |
930 | (setq comment-start "/* ") | |
931 | (setq comment-end " */") | |
932 | (setq mdw-fill-prefix | |
933 | `((,(concat "\\([ \t]*/?\\)" | |
934 | "\\([\*/][ \t]*\\)" | |
935 | "\\([A-Za-z]+:[ \t]*\\)?" | |
936 | mdw-hanging-indents) | |
937 | (pad . 1) (match . 2) (pad . 3) (pad . 4)))) | |
938 | ||
939 | ;; --- Now define things to be fontified --- | |
940 | ||
02109a0d | 941 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
942 | (let ((java-keywords |
943 | (make-regexp '("abstract" "boolean" "break" "byte" "case" "catch" | |
944 | "char" "class" "const" "continue" "default" "do" | |
945 | "double" "else" "extends" "final" "finally" "float" | |
946 | "for" "goto" "if" "implements" "import" "instanceof" | |
947 | "int" "interface" "long" "native" "new" "package" | |
948 | "private" "protected" "public" "return" "short" | |
949 | "static" "super" "switch" "synchronized" "this" | |
950 | "throw" "throws" "transient" "try" "void" "volatile" | |
951 | "while" | |
952 | ||
953 | "false" "null" "true")))) | |
954 | ||
955 | (setq font-lock-keywords | |
956 | (list | |
f617db13 MW |
957 | |
958 | ;; --- Handle the keywords defined above --- | |
959 | ||
960 | (list (concat "\\<\\(" java-keywords "\\)\\>") | |
961 | '(0 font-lock-keyword-face)) | |
962 | ||
963 | ;; --- Handle numbers too --- | |
964 | ;; | |
965 | ;; The following isn't quite right, but it's close enough. | |
966 | ||
967 | (list (concat "\\<\\(" | |
968 | "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" | |
969 | "[0-9]+\\(\\.[0-9]*\\|\\)" | |
970 | "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)\\)" | |
971 | "[lLfFdD]?") | |
972 | '(0 mdw-number-face)) | |
973 | ||
974 | ;; --- And anything else is punctuation --- | |
975 | ||
976 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
977 | '(0 mdw-punct-face)))))) | |
978 | ||
e808c1e5 MW |
979 | ;;;----- C# programming configuration --------------------------------------- |
980 | ||
981 | ;; --- Make indentation nice --- | |
982 | ||
983 | (defun mdw-csharp-style () | |
984 | (c-add-style "[mdw] C# style" | |
985 | '((c-basic-offset . 2) | |
986 | (c-tab-always-indent . nil) | |
987 | (c-offsets-alist (substatement-open . 0) | |
988 | (label . 0) | |
989 | (case-label . +) | |
990 | (access-label . 0) | |
991 | (inclass . +) | |
992 | (statement-case-intro . +))) | |
993 | t)) | |
994 | ||
995 | ;; --- Declare C# fontification style --- | |
996 | ||
997 | (defun mdw-fontify-csharp () | |
998 | ||
999 | ;; --- Other stuff --- | |
1000 | ||
1001 | (mdw-csharp-style) | |
1002 | (modify-syntax-entry ?_ "w") | |
1003 | (setq c-hanging-comment-ender-p nil) | |
1004 | (setq c-backslash-column 72) | |
1005 | (setq comment-start "/* ") | |
1006 | (setq comment-end " */") | |
1007 | (setq mdw-fill-prefix | |
1008 | `((,(concat "\\([ \t]*/?\\)" | |
1009 | "\\([\*/][ \t]*\\)" | |
1010 | "\\([A-Za-z]+:[ \t]*\\)?" | |
1011 | mdw-hanging-indents) | |
1012 | (pad . 1) (match . 2) (pad . 3) (pad . 4)))) | |
1013 | ||
1014 | ;; --- Now define things to be fontified --- | |
1015 | ||
1016 | (make-local-variable 'font-lock-keywords) | |
1017 | (let ((csharp-keywords | |
1018 | (make-regexp '("abstract" "as" "base" "bool" "break" | |
1019 | "byte" "case" "catch" "char" "checked" | |
1020 | "class" "const" "continue" "decimal" "default" | |
1021 | "delegate" "do" "double" "else" "enum" | |
1022 | "event" "explicit" "extern" "false" "finally" | |
1023 | "fixed" "float" "for" "foreach" "goto" | |
1024 | "if" "implicit" "in" "int" "interface" | |
1025 | "internal" "is" "lock" "long" "namespace" | |
1026 | "new" "null" "object" "operator" "out" | |
1027 | "override" "params" "private" "protected" "public" | |
1028 | "readonly" "ref" "return" "sbyte" "sealed" | |
1029 | "short" "sizeof" "stackalloc" "static" "string" | |
1030 | "struct" "switch" "this" "throw" "true" | |
1031 | "try" "typeof" "uint" "ulong" "unchecked" | |
1032 | "unsafe" "ushort" "using" "virtual" "void" | |
1033 | "volatile" "while" "yield")))) | |
1034 | ||
1035 | (setq font-lock-keywords | |
1036 | (list | |
e808c1e5 MW |
1037 | |
1038 | ;; --- Handle the keywords defined above --- | |
1039 | ||
1040 | (list (concat "\\<\\(" csharp-keywords "\\)\\>") | |
1041 | '(0 font-lock-keyword-face)) | |
1042 | ||
1043 | ;; --- Handle numbers too --- | |
1044 | ;; | |
1045 | ;; The following isn't quite right, but it's close enough. | |
1046 | ||
1047 | (list (concat "\\<\\(" | |
1048 | "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" | |
1049 | "[0-9]+\\(\\.[0-9]*\\|\\)" | |
1050 | "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)\\)" | |
1051 | "[lLfFdD]?") | |
1052 | '(0 mdw-number-face)) | |
1053 | ||
1054 | ;; --- And anything else is punctuation --- | |
1055 | ||
1056 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1057 | '(0 mdw-punct-face)))))) | |
1058 | ||
1059 | (defun csharp-mode () | |
1060 | (interactive) | |
1061 | (java-mode) | |
1062 | (setq major-mode 'csharp-mode) | |
1063 | (setq mode-name "C#") | |
1064 | (mdw-fontify-csharp) | |
1065 | (run-hooks 'csharp-mode-hook)) | |
1066 | ||
f617db13 MW |
1067 | ;;;----- Awk programming configuration -------------------------------------- |
1068 | ||
1069 | ;; --- Make Awk indentation nice --- | |
1070 | ||
1071 | (defun mdw-awk-style () | |
1072 | (c-add-style "[mdw] Awk style" | |
1073 | '((c-basic-offset . 2) | |
1074 | (c-tab-always-indent . nil) | |
1075 | (c-offsets-alist (substatement-open . 0) | |
1076 | (statement-cont . 0) | |
1077 | (statement-case-intro . +))) | |
1078 | t)) | |
1079 | ||
1080 | ;; --- Declare Awk fontification style --- | |
1081 | ||
1082 | (defun mdw-fontify-awk () | |
1083 | ||
1084 | ;; --- Miscellaneous fiddling --- | |
1085 | ||
1086 | (modify-syntax-entry ?_ "w") | |
1087 | (mdw-awk-style) | |
1088 | (setq c-backslash-column 72) | |
1089 | (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") | |
1090 | ||
1091 | ;; --- Now define things to be fontified --- | |
1092 | ||
02109a0d | 1093 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1094 | (let ((c-keywords |
1095 | (make-regexp '("BEGIN" "END" "ARGC" "ARGIND" "ARGV" "CONVFMT" | |
1096 | "ENVIRON" "ERRNO" "FIELDWIDTHS" "FILENAME" "FNR" | |
1097 | "FS" "IGNORECASE" "NF" "NR" "OFMT" "OFS" "ORS" "RS" | |
1098 | "RSTART" "RLENGTH" "RT" "SUBSEP" | |
1099 | "atan2" "break" "close" "continue" "cos" "delete" | |
1100 | "do" "else" "exit" "exp" "fflush" "file" "for" "func" | |
1101 | "function" "gensub" "getline" "gsub" "if" "in" | |
1102 | "index" "int" "length" "log" "match" "next" "rand" | |
1103 | "return" "print" "printf" "sin" "split" "sprintf" | |
1104 | "sqrt" "srand" "strftime" "sub" "substr" "system" | |
1105 | "systime" "tolower" "toupper" "while")))) | |
1106 | ||
1107 | (setq font-lock-keywords | |
1108 | (list | |
f617db13 MW |
1109 | |
1110 | ;; --- Handle the keywords defined above --- | |
1111 | ||
1112 | (list (concat "\\<\\(" c-keywords "\\)\\>") | |
1113 | '(0 font-lock-keyword-face)) | |
1114 | ||
1115 | ;; --- Handle numbers too --- | |
1116 | ;; | |
1117 | ;; The following isn't quite right, but it's close enough. | |
1118 | ||
1119 | (list (concat "\\<\\(" | |
1120 | "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" | |
1121 | "[0-9]+\\(\\.[0-9]*\\|\\)" | |
1122 | "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)\\)" | |
1123 | "[uUlL]*") | |
1124 | '(0 mdw-number-face)) | |
1125 | ||
1126 | ;; --- And anything else is punctuation --- | |
1127 | ||
1128 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1129 | '(0 mdw-punct-face)))))) | |
1130 | ||
1131 | ;;;----- Perl programming style --------------------------------------------- | |
1132 | ||
1133 | ;; --- Perl indentation style --- | |
1134 | ||
1135 | (setq cperl-tab-always-indent nil) | |
1136 | ||
1137 | (setq cperl-indent-level 2) | |
1138 | (setq cperl-continued-statement-offset 2) | |
1139 | (setq cperl-continued-brace-offset 0) | |
1140 | (setq cperl-brace-offset -2) | |
1141 | (setq cperl-brace-imaginary-offset 0) | |
1142 | (setq cperl-label-offset 0) | |
1143 | ||
1144 | ;; --- Define perl fontification style --- | |
1145 | ||
1146 | (defun mdw-fontify-perl () | |
1147 | ||
1148 | ;; --- Miscellaneous fiddling --- | |
1149 | ||
1150 | (modify-syntax-entry ?_ "w") | |
1151 | (modify-syntax-entry ?$ "\\") | |
1152 | (modify-syntax-entry ?$ "\\" font-lock-syntax-table) | |
1153 | (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") | |
1154 | ||
1155 | ;; --- Now define fontification things --- | |
1156 | ||
02109a0d | 1157 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1158 | (let ((perl-keywords |
1159 | (make-regexp '("and" "cmp" "continue" "do" "else" "elsif" "eq" | |
1160 | "for" "foreach" "ge" "gt" "goto" "if" | |
1161 | "last" "le" "lt" "local" "my" "ne" "next" "or" | |
1162 | "package" "redo" "require" "return" "sub" | |
1163 | "undef" "unless" "until" "use" "while")))) | |
1164 | ||
1165 | (setq font-lock-keywords | |
1166 | (list | |
f617db13 MW |
1167 | |
1168 | ;; --- Set up the keywords defined above --- | |
1169 | ||
1170 | (list (concat "\\<\\(" perl-keywords "\\)\\>") | |
1171 | '(0 font-lock-keyword-face)) | |
1172 | ||
1173 | ;; --- At least numbers are simpler than C --- | |
1174 | ||
1175 | (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" | |
1176 | "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" | |
1177 | "\\([eE]\\([-+]\\|\\)[0-9_]+\\|\\)") | |
1178 | '(0 mdw-number-face)) | |
1179 | ||
1180 | ;; --- And anything else is punctuation --- | |
1181 | ||
1182 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1183 | '(0 mdw-punct-face)))))) | |
1184 | ||
1185 | (defun perl-number-tests (&optional arg) | |
1186 | "Assign consecutive numbers to lines containing `#t'. With ARG, | |
1187 | strip numbers instead." | |
1188 | (interactive "P") | |
1189 | (save-excursion | |
1190 | (goto-char (point-min)) | |
1191 | (let ((i 0) (fmt (if arg "" " %4d"))) | |
1192 | (while (search-forward "#t" nil t) | |
1193 | (delete-region (point) (line-end-position)) | |
1194 | (setq i (1+ i)) | |
1195 | (insert (format fmt i))) | |
1196 | (goto-char (point-min)) | |
1197 | (if (re-search-forward "\\(tests\\s-*=>\\s-*\\)\\w*" nil t) | |
1198 | (replace-match (format "\\1%d" i)))))) | |
1199 | ||
1200 | ;;;----- Python programming style ------------------------------------------- | |
1201 | ||
1202 | ;; --- Define Python fontification style --- | |
1203 | ||
1204 | (trap (require 'pyrex-mode)) | |
1205 | (defun mdw-fontify-python () | |
1206 | ||
1207 | ;; --- Miscellaneous fiddling --- | |
1208 | ||
1209 | (modify-syntax-entry ?_ "w") | |
1210 | (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") | |
1211 | ||
1212 | ;; --- Now define fontification things --- | |
1213 | ||
02109a0d | 1214 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1215 | (let ((python-keywords |
1216 | (make-regexp '("and" "as" "assert" "break" "class" "continue" "def" | |
1217 | "del" "elif" "else" "except" "exec" "finally" "for" | |
1218 | "from" "global" "if" "import" "in" "is" "lambda" | |
1219 | "not" "or" "pass" "print" "raise" "return" "try" | |
043e413b | 1220 | "while" "yield")))) |
f617db13 MW |
1221 | (setq font-lock-keywords |
1222 | (list | |
f617db13 MW |
1223 | |
1224 | ;; --- Set up the keywords defined above --- | |
1225 | ||
1226 | (list (concat "\\<\\(" python-keywords "\\)\\>") | |
1227 | '(0 font-lock-keyword-face)) | |
1228 | ||
1229 | ;; --- At least numbers are simpler than C --- | |
1230 | ||
1231 | (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" | |
1232 | "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" | |
1233 | "\\([eE]\\([-+]\\|\\)[0-9_]+\\|[lL]\\|\\)") | |
1234 | '(0 mdw-number-face)) | |
1235 | ||
1236 | ;; --- And anything else is punctuation --- | |
1237 | ||
1238 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1239 | '(0 mdw-punct-face)))))) | |
1240 | ||
1241 | ;;;----- ARM assembler programming configuration ---------------------------- | |
1242 | ||
1243 | ;; --- There doesn't appear to be an Emacs mode for this yet --- | |
1244 | ;; | |
1245 | ;; Better do something about that, I suppose. | |
1246 | ||
1247 | (defvar arm-assembler-mode-map nil) | |
1248 | (defvar arm-assembler-abbrev-table nil) | |
1249 | (defvar arm-assembler-mode-syntax-table (make-syntax-table)) | |
1250 | ||
1251 | (or arm-assembler-mode-map | |
1252 | (progn | |
1253 | (setq arm-assembler-mode-map (make-sparse-keymap)) | |
1254 | (define-key arm-assembler-mode-map "\C-m" 'arm-assembler-newline) | |
1255 | (define-key arm-assembler-mode-map [C-return] 'newline) | |
1256 | (define-key arm-assembler-mode-map "\t" 'tab-to-tab-stop))) | |
1257 | ||
1258 | (defun arm-assembler-mode () | |
1259 | "Major mode for ARM assembler programs" | |
1260 | (interactive) | |
1261 | ||
1262 | ;; --- Do standard major mode things --- | |
1263 | ||
1264 | (kill-all-local-variables) | |
1265 | (use-local-map arm-assembler-mode-map) | |
1266 | (setq local-abbrev-table arm-assembler-abbrev-table) | |
1267 | (setq major-mode 'arm-assembler-mode) | |
1268 | (setq mode-name "ARM assembler") | |
1269 | ||
1270 | ;; --- Set up syntax table --- | |
1271 | ||
1272 | (set-syntax-table arm-assembler-mode-syntax-table) | |
1273 | (modify-syntax-entry ?; ; Nasty hack | |
1274 | "<" arm-assembler-mode-syntax-table) | |
1275 | (modify-syntax-entry ?\n ">" arm-assembler-mode-syntax-table) | |
1276 | (modify-syntax-entry ?_ "_" arm-assembler-mode-syntax-table) | |
1277 | ||
1278 | (make-local-variable 'comment-start) | |
1279 | (setq comment-start ";") | |
1280 | (make-local-variable 'comment-end) | |
1281 | (setq comment-end "") | |
1282 | (make-local-variable 'comment-column) | |
1283 | (setq comment-column 48) | |
1284 | (make-local-variable 'comment-start-skip) | |
1285 | (setq comment-start-skip ";+[ \t]*") | |
1286 | ||
1287 | ;; --- Play with indentation --- | |
1288 | ||
1289 | (make-local-variable 'indent-line-function) | |
1290 | (setq indent-line-function 'indent-relative-maybe) | |
1291 | ||
1292 | ;; --- Set fill prefix --- | |
1293 | ||
1294 | (mdw-standard-fill-prefix "\\([ \t]*;+[ \t]*\\)") | |
1295 | ||
1296 | ;; --- Fiddle with fontification --- | |
1297 | ||
02109a0d | 1298 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1299 | (setq font-lock-keywords |
1300 | (list | |
f617db13 MW |
1301 | |
1302 | ;; --- Handle numbers too --- | |
1303 | ;; | |
1304 | ;; The following isn't quite right, but it's close enough. | |
1305 | ||
1306 | (list (concat "\\(" | |
1307 | "&[0-9a-fA-F]+\\|" | |
1308 | "\\<[0-9]+\\(\\.[0-9]*\\|_[0-9a-zA-Z]+\\|\\)" | |
1309 | "\\)") | |
1310 | '(0 mdw-number-face)) | |
1311 | ||
1312 | ;; --- Do something about operators --- | |
1313 | ||
1314 | (list "^[^ \t]*[ \t]+\\(GET\\|LNK\\)[ \t]+\\([^;\n]*\\)" | |
1315 | '(1 font-lock-keyword-face) | |
1316 | '(2 font-lock-string-face)) | |
1317 | (list ":[a-zA-Z]+:" | |
1318 | '(0 font-lock-keyword-face)) | |
1319 | ||
1320 | ;; --- Do menemonics and directives --- | |
1321 | ||
1322 | (list "^[^ \t]*[ \t]+\\([a-zA-Z]+\\)" | |
1323 | '(1 font-lock-keyword-face)) | |
1324 | ||
1325 | ;; --- And anything else is punctuation --- | |
1326 | ||
1327 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1328 | '(0 mdw-punct-face)))) | |
1329 | ||
1330 | (run-hooks 'arm-assembler-mode-hook)) | |
1331 | ||
30c8a8fb MW |
1332 | ;;;----- Assembler mode ----------------------------------------------------- |
1333 | ||
1334 | (defun mdw-fontify-asm () | |
1335 | (modify-syntax-entry ?' "\"") | |
1336 | (modify-syntax-entry ?. "w") | |
1337 | (setf fill-prefix nil) | |
1338 | (mdw-standard-fill-prefix "\\([ \t]*;+[ \t]*\\)")) | |
1339 | ||
f617db13 MW |
1340 | ;;;----- TCL configuration -------------------------------------------------- |
1341 | ||
1342 | (defun mdw-fontify-tcl () | |
1343 | (mapcar #'(lambda (ch) (modify-syntax-entry ch ".")) '(?$)) | |
1344 | (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") | |
02109a0d | 1345 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1346 | (setq font-lock-keywords |
1347 | (list | |
f617db13 MW |
1348 | (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" |
1349 | "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" | |
1350 | "\\([eE]\\([-+]\\|\\)[0-9_]+\\|\\)") | |
1351 | '(0 mdw-number-face)) | |
1352 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1353 | '(0 mdw-punct-face))))) | |
1354 | ||
1355 | ;;;----- REXX configuration ------------------------------------------------- | |
1356 | ||
1357 | (defun mdw-rexx-electric-* () | |
1358 | (interactive) | |
1359 | (insert ?*) | |
1360 | (rexx-indent-line)) | |
1361 | ||
1362 | (defun mdw-rexx-indent-newline-indent () | |
1363 | (interactive) | |
1364 | (rexx-indent-line) | |
1365 | (if abbrev-mode (expand-abbrev)) | |
1366 | (newline-and-indent)) | |
1367 | ||
1368 | (defun mdw-fontify-rexx () | |
1369 | ||
1370 | ;; --- Various bits of fiddling --- | |
1371 | ||
1372 | (setq mdw-auto-indent nil) | |
1373 | (local-set-key [?\C-m] 'mdw-rexx-indent-newline-indent) | |
1374 | (local-set-key [?*] 'mdw-rexx-electric-*) | |
1375 | (mapcar #'(lambda (ch) (modify-syntax-entry ch "w")) | |
1376 | '(?. ?! ?? ?_ ?# ?@ ?$)) | |
1377 | (mdw-standard-fill-prefix "\\([ \t]*/?\*[ \t]*\\)") | |
1378 | ||
1379 | ;; --- Set up keywords and things for fontification --- | |
1380 | ||
1381 | (make-local-variable 'font-lock-keywords-case-fold-search) | |
1382 | (setq font-lock-keywords-case-fold-search t) | |
1383 | ||
1384 | (setq rexx-indent 2) | |
1385 | (setq rexx-end-indent rexx-indent) | |
1386 | (setq rexx-tab-always-indent nil) | |
1387 | (setq rexx-cont-indent rexx-indent) | |
1388 | ||
02109a0d | 1389 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1390 | (let ((rexx-keywords |
1391 | (make-regexp '("address" "arg" "by" "call" "digits" "do" "drop" | |
1392 | "else" "end" "engineering" "exit" "expose" "for" | |
1393 | "forever" "form" "fuzz" "if" "interpret" "iterate" | |
1394 | "leave" "linein" "name" "nop" "numeric" "off" "on" | |
1395 | "options" "otherwise" "parse" "procedure" "pull" | |
1396 | "push" "queue" "return" "say" "select" "signal" | |
1397 | "scientific" "source" "then" "trace" "to" "until" | |
1398 | "upper" "value" "var" "version" "when" "while" | |
1399 | "with" | |
1400 | ||
1401 | "abbrev" "abs" "bitand" "bitor" "bitxor" "b2x" | |
1402 | "center" "center" "charin" "charout" "chars" | |
1403 | "compare" "condition" "copies" "c2d" "c2x" | |
1404 | "datatype" "date" "delstr" "delword" "d2c" "d2x" | |
1405 | "errortext" "format" "fuzz" "insert" "lastpos" | |
1406 | "left" "length" "lineout" "lines" "max" "min" | |
1407 | "overlay" "pos" "queued" "random" "reverse" "right" | |
1408 | "sign" "sourceline" "space" "stream" "strip" | |
1409 | "substr" "subword" "symbol" "time" "translate" | |
1410 | "trunc" "value" "verify" "word" "wordindex" | |
1411 | "wordlength" "wordpos" "words" "xrange" "x2b" "x2c" | |
1412 | "x2d")))) | |
1413 | ||
1414 | (setq font-lock-keywords | |
1415 | (list | |
f617db13 MW |
1416 | |
1417 | ;; --- Set up the keywords defined above --- | |
1418 | ||
1419 | (list (concat "\\<\\(" rexx-keywords "\\)\\>") | |
1420 | '(0 font-lock-keyword-face)) | |
1421 | ||
1422 | ;; --- Fontify all symbols the same way --- | |
1423 | ||
1424 | (list (concat "\\<\\([0-9.][A-Za-z0-9.!?_#@$]*[Ee][+-]?[0-9]+\\|" | |
1425 | "[A-Za-z0-9.!?_#@$]+\\)") | |
1426 | '(0 font-lock-variable-name-face)) | |
1427 | ||
1428 | ;; --- And everything else is punctuation --- | |
1429 | ||
1430 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1431 | '(0 mdw-punct-face)))))) | |
1432 | ||
1433 | ;;;----- Standard ML programming style -------------------------------------- | |
1434 | ||
1435 | (defun mdw-fontify-sml () | |
1436 | ||
1437 | ;; --- Make underscore an honorary letter --- | |
1438 | ||
1439 | (modify-syntax-entry ?_ "w") | |
1440 | (modify-syntax-entry ?' "w") | |
1441 | ||
1442 | ;; --- Set fill prefix --- | |
1443 | ||
1444 | (mdw-standard-fill-prefix "\\([ \t]*(\*[ \t]*\\)") | |
1445 | ||
1446 | ;; --- Now define fontification things --- | |
1447 | ||
02109a0d | 1448 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1449 | (let ((sml-keywords |
1450 | (make-regexp '("abstype" "and" "andalso" "as" | |
1451 | "case" | |
1452 | "datatype" "do" | |
1453 | "else" "end" "eqtype" "exception" | |
1454 | "fn" "fun" "functor" | |
1455 | "handle" | |
1456 | "if" "in" "include" "infix" "infixr" | |
1457 | "let" "local" | |
1458 | "nonfix" | |
1459 | "of" "op" "open" "orelse" | |
1460 | "raise" "rec" | |
1461 | "sharing" "sig" "signature" "struct" "structure" | |
1462 | "then" "type" | |
1463 | "val" | |
1464 | "where" "while" "with" "withtype")))) | |
1465 | ||
1466 | (setq font-lock-keywords | |
1467 | (list | |
f617db13 MW |
1468 | |
1469 | ;; --- Set up the keywords defined above --- | |
1470 | ||
1471 | (list (concat "\\<\\(" sml-keywords "\\)\\>") | |
1472 | '(0 font-lock-keyword-face)) | |
1473 | ||
1474 | ;; --- At least numbers are simpler than C --- | |
1475 | ||
1476 | (list (concat "\\<\\(\\~\\|\\)" | |
1477 | "\\(0\\(\\([wW]\\|\\)[xX][0-9a-fA-F]+\\|" | |
852cd5fb MW |
1478 | "[wW][0-9]+\\)\\|" |
1479 | "\\([0-9]+\\(\\.[0-9]+\\|\\)" | |
1480 | "\\([eE]\\(\\~\\|\\)" | |
1481 | "[0-9]+\\|\\)\\)\\)") | |
f617db13 MW |
1482 | '(0 mdw-number-face)) |
1483 | ||
1484 | ;; --- And anything else is punctuation --- | |
1485 | ||
1486 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1487 | '(0 mdw-punct-face)))))) | |
1488 | ||
1489 | ;;;----- Haskell configuration ---------------------------------------------- | |
1490 | ||
1491 | (defun mdw-fontify-haskell () | |
1492 | ||
1493 | ;; --- Fiddle with syntax table to get comments right --- | |
1494 | ||
1495 | (modify-syntax-entry ?_ "w") | |
1496 | (modify-syntax-entry ?' "\"") | |
1497 | (modify-syntax-entry ?- ". 123") | |
1498 | (modify-syntax-entry ?{ ". 1b") | |
1499 | (modify-syntax-entry ?} ". 4b") | |
1500 | (modify-syntax-entry ?\n ">") | |
1501 | ||
1502 | ;; --- Set fill prefix --- | |
1503 | ||
1504 | (mdw-standard-fill-prefix "\\([ \t]*{?--?[ \t]*\\)") | |
1505 | ||
1506 | ;; --- Fiddle with fontification --- | |
1507 | ||
02109a0d | 1508 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1509 | (let ((haskell-keywords |
1510 | (make-regexp '("as" "case" "ccall" "class" "data" "default" | |
1511 | "deriving" "do" "else" "foreign" "hiding" "if" | |
1512 | "import" "in" "infix" "infixl" "infixr" "instance" | |
1513 | "let" "module" "newtype" "of" "qualified" "safe" | |
1514 | "stdcall" "then" "type" "unsafe" "where")))) | |
1515 | ||
1516 | (setq font-lock-keywords | |
1517 | (list | |
f617db13 MW |
1518 | (list "--.*$" |
1519 | '(0 font-lock-comment-face)) | |
1520 | (list (concat "\\<\\(" haskell-keywords "\\)\\>") | |
1521 | '(0 font-lock-keyword-face)) | |
1522 | (list (concat "\\<0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" | |
1523 | "\\<[0-9][0-9_]*\\(\\.[0-9]*\\|\\)" | |
1524 | "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)") | |
1525 | '(0 mdw-number-face)) | |
1526 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1527 | '(0 mdw-punct-face)))))) | |
1528 | ||
1529 | ;;;----- Texinfo configuration ---------------------------------------------- | |
1530 | ||
1531 | (defun mdw-fontify-texinfo () | |
1532 | ||
1533 | ;; --- Set fill prefix --- | |
1534 | ||
1535 | (mdw-standard-fill-prefix "\\([ \t]*@c[ \t]+\\)") | |
1536 | ||
1537 | ;; --- Real fontification things --- | |
1538 | ||
02109a0d | 1539 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1540 | (setq font-lock-keywords |
1541 | (list | |
f617db13 MW |
1542 | |
1543 | ;; --- Environment names are keywords --- | |
1544 | ||
1545 | (list "@\\(end\\) *\\([a-zA-Z]*\\)?" | |
1546 | '(2 font-lock-keyword-face)) | |
1547 | ||
1548 | ;; --- Unmark escaped magic characters --- | |
1549 | ||
1550 | (list "\\(@\\)\\([@{}]\\)" | |
1551 | '(1 font-lock-keyword-face) | |
1552 | '(2 font-lock-variable-name-face)) | |
1553 | ||
1554 | ;; --- Make sure we get comments properly --- | |
1555 | ||
1556 | (list "@c\\(\\|omment\\)\\( .*\\)?$" | |
1557 | '(0 font-lock-comment-face)) | |
1558 | ||
1559 | ;; --- Command names are keywords --- | |
1560 | ||
1561 | (list "@\\([^a-zA-Z@]\\|[a-zA-Z@]*\\)" | |
1562 | '(0 font-lock-keyword-face)) | |
1563 | ||
1564 | ;; --- Fontify TeX special characters as punctuation --- | |
1565 | ||
1566 | (list "[{}]+" | |
1567 | '(0 mdw-punct-face))))) | |
1568 | ||
1569 | ;;;----- TeX and LaTeX configuration ---------------------------------------- | |
1570 | ||
1571 | (defun mdw-fontify-tex () | |
1572 | (setq ispell-parser 'tex) | |
1573 | ||
1574 | ;; --- Don't make maths into a string --- | |
1575 | ||
1576 | (modify-syntax-entry ?$ ".") | |
1577 | (modify-syntax-entry ?$ "." font-lock-syntax-table) | |
1578 | (local-set-key [?$] 'self-insert-command) | |
1579 | ||
1580 | ;; --- Set fill prefix --- | |
1581 | ||
1582 | (mdw-standard-fill-prefix "\\([ \t]*%+[ \t]*\\)") | |
1583 | ||
1584 | ;; --- Real fontification things --- | |
1585 | ||
02109a0d | 1586 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1587 | (setq font-lock-keywords |
1588 | (list | |
f617db13 MW |
1589 | |
1590 | ;; --- Environment names are keywords --- | |
1591 | ||
1592 | (list (concat "\\\\\\(begin\\|end\\|newenvironment\\)" | |
1593 | "{\\([^}\n]*\\)}") | |
1594 | '(2 font-lock-keyword-face)) | |
1595 | ||
1596 | ;; --- Suspended environment names are keywords too --- | |
1597 | ||
1598 | (list (concat "\\\\\\(suspend\\|resume\\)\\(\\[[^]]*\\]\\)?" | |
1599 | "{\\([^}\n]*\\)}") | |
1600 | '(3 font-lock-keyword-face)) | |
1601 | ||
1602 | ;; --- Command names are keywords --- | |
1603 | ||
1604 | (list "\\\\\\([^a-zA-Z@]\\|[a-zA-Z@]*\\)" | |
1605 | '(0 font-lock-keyword-face)) | |
1606 | ||
1607 | ;; --- Handle @/.../ for italics --- | |
1608 | ||
1609 | ;; (list "\\(@/\\)\\([^/]*\\)\\(/\\)" | |
852cd5fb MW |
1610 | ;; '(1 font-lock-keyword-face) |
1611 | ;; '(3 font-lock-keyword-face)) | |
f617db13 MW |
1612 | |
1613 | ;; --- Handle @*...* for boldness --- | |
1614 | ||
1615 | ;; (list "\\(@\\*\\)\\([^*]*\\)\\(\\*\\)" | |
852cd5fb MW |
1616 | ;; '(1 font-lock-keyword-face) |
1617 | ;; '(3 font-lock-keyword-face)) | |
f617db13 MW |
1618 | |
1619 | ;; --- Handle @`...' for literal syntax things --- | |
1620 | ||
1621 | ;; (list "\\(@`\\)\\([^']*\\)\\('\\)" | |
852cd5fb MW |
1622 | ;; '(1 font-lock-keyword-face) |
1623 | ;; '(3 font-lock-keyword-face)) | |
f617db13 MW |
1624 | |
1625 | ;; --- Handle @<...> for nonterminals --- | |
1626 | ||
1627 | ;; (list "\\(@<\\)\\([^>]*\\)\\(>\\)" | |
852cd5fb MW |
1628 | ;; '(1 font-lock-keyword-face) |
1629 | ;; '(3 font-lock-keyword-face)) | |
f617db13 MW |
1630 | |
1631 | ;; --- Handle other @-commands --- | |
1632 | ||
1633 | ;; (list "@\\([^a-zA-Z]\\|[a-zA-Z]*\\)" | |
852cd5fb | 1634 | ;; '(0 font-lock-keyword-face)) |
f617db13 MW |
1635 | |
1636 | ;; --- Make sure we get comments properly --- | |
1637 | ||
1638 | (list "%.*" | |
1639 | '(0 font-lock-comment-face)) | |
1640 | ||
1641 | ;; --- Fontify TeX special characters as punctuation --- | |
1642 | ||
1643 | (list "[$^_{}#&]" | |
1644 | '(0 mdw-punct-face))))) | |
1645 | ||
f25cf300 MW |
1646 | ;;;----- SGML hacking ------------------------------------------------------- |
1647 | ||
1648 | (defun mdw-sgml-mode () | |
1649 | (interactive) | |
1650 | (sgml-mode) | |
1651 | (mdw-standard-fill-prefix "") | |
1652 | (make-variable-buffer-local 'sgml-delimiters) | |
1653 | (setq sgml-delimiters | |
1654 | '("AND" "&" "COM" "--" "CRO" "&#" "DSC" "]" "DSO" "[" "DTGC" "]" | |
1655 | "DTGO" "[" "ERO" "&" "ETAGO" ":e" "GRPC" ")" "GRPO" "(" "LIT" "\"" | |
1656 | "LITA" "'" "MDC" ">" "MDO" "<!" "MINUS" "-" "MSC" "]]" "NESTC" "{" | |
1657 | "NET" "}" "OPT" "?" "OR" "|" "PERO" "%" "PIC" ">" "PIO" "<?" | |
1658 | "PLUS" "+" "REFC" "." "REP" "*" "RNI" "#" "SEQ" "," "STAGO" ":" | |
1659 | "TAGC" "." "VI" "=" "MS-START" "<![" "MS-END" "]]>" | |
1660 | "XML-ECOM" "-->" "XML-PIC" "?>" "XML-SCOM" "<!--" "XML-TAGCE" "/>" | |
1661 | "NULL" "")) | |
1662 | (setq major-mode 'mdw-sgml-mode) | |
1663 | (setq mode-name "[mdw] SGML") | |
1664 | (run-hooks 'mdw-sgml-mode-hook)) | |
1665 | ||
f617db13 MW |
1666 | ;;;----- Shell scripts ------------------------------------------------------ |
1667 | ||
1668 | (defun mdw-setup-sh-script-mode () | |
1669 | ||
1670 | ;; --- Fetch the shell interpreter's name --- | |
1671 | ||
1672 | (let ((shell-name sh-shell-file)) | |
1673 | ||
1674 | ;; --- Try reading the hash-bang line --- | |
1675 | ||
1676 | (save-excursion | |
1677 | (goto-char (point-min)) | |
1678 | (if (looking-at "#![ \t]*\\([^ \t\n]*\\)") | |
1679 | (setq shell-name (match-string 1)))) | |
1680 | ||
1681 | ;; --- Now try to set the shell --- | |
1682 | ;; | |
1683 | ;; Don't let `sh-set-shell' bugger up my script. | |
1684 | ||
1685 | (let ((executable-set-magic #'(lambda (s &rest r) s))) | |
1686 | (sh-set-shell shell-name))) | |
1687 | ||
1688 | ;; --- Now enable my keys and the fontification --- | |
1689 | ||
1690 | (mdw-misc-mode-config) | |
1691 | ||
1692 | ;; --- Set the indentation level correctly --- | |
1693 | ||
1694 | (setq sh-indentation 2) | |
1695 | (setq sh-basic-offset 2)) | |
1696 | ||
1697 | ;;;----- Messages-file mode ------------------------------------------------- | |
1698 | ||
1699 | (defun message-mode-guts () | |
1700 | (setq messages-mode-syntax-table (make-syntax-table)) | |
1701 | (set-syntax-table messages-mode-syntax-table) | |
1702 | (modify-syntax-entry ?_ "w" messages-mode-syntax-table) | |
1703 | (modify-syntax-entry ?- "w" messages-mode-syntax-table) | |
1704 | (modify-syntax-entry ?0 "w" messages-mode-syntax-table) | |
1705 | (modify-syntax-entry ?1 "w" messages-mode-syntax-table) | |
1706 | (modify-syntax-entry ?2 "w" messages-mode-syntax-table) | |
1707 | (modify-syntax-entry ?3 "w" messages-mode-syntax-table) | |
1708 | (modify-syntax-entry ?4 "w" messages-mode-syntax-table) | |
1709 | (modify-syntax-entry ?5 "w" messages-mode-syntax-table) | |
1710 | (modify-syntax-entry ?6 "w" messages-mode-syntax-table) | |
1711 | (modify-syntax-entry ?7 "w" messages-mode-syntax-table) | |
1712 | (modify-syntax-entry ?8 "w" messages-mode-syntax-table) | |
1713 | (modify-syntax-entry ?9 "w" messages-mode-syntax-table) | |
1714 | (make-local-variable 'comment-start) | |
1715 | (make-local-variable 'comment-end) | |
1716 | (make-local-variable 'indent-line-function) | |
1717 | (setq indent-line-function 'indent-relative) | |
1718 | (mdw-standard-fill-prefix "\\([ \t]*\\(;\\|/?\\*\\)+[ \t]*\\)") | |
1719 | (make-local-variable 'font-lock-defaults) | |
1720 | (make-local-variable 'message-mode-keywords) | |
1721 | (let ((keywords | |
1722 | (make-regexp '("array" "bitmap" "callback" "docs[ \t]+enum" | |
1723 | "export" "enum" "fixed-octetstring" "flags" | |
1724 | "harmless" "map" "nested" "optional" | |
1725 | "optional-tagged" "package" "primitive" | |
1726 | "primitive-nullfree" "relaxed[ \t]+enum" | |
1727 | "set" "table" "tagged-optional" "union" | |
1728 | "variadic" "vector" "version" "version-tag")))) | |
1729 | (setq message-mode-keywords | |
1730 | (list | |
1731 | (list (concat "\\<\\(" keywords "\\)\\>:") | |
1732 | '(0 font-lock-keyword-face)) | |
1733 | '("\\([-a-zA-Z0-9]+:\\)" (0 font-lock-warning-face)) | |
1734 | '("\\(\\<[a-z][-_a-zA-Z0-9]*\\)" | |
1735 | (0 font-lock-variable-name-face)) | |
1736 | '("\\<\\([0-9]+\\)\\>" (0 mdw-number-face)) | |
1737 | '("\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1738 | (0 mdw-punct-face))))) | |
1739 | (setq font-lock-defaults | |
1740 | '(message-mode-keywords nil nil nil nil)) | |
1741 | (run-hooks 'messages-file-hook)) | |
1742 | ||
1743 | (defun messages-mode () | |
1744 | (interactive) | |
1745 | (fundamental-mode) | |
1746 | (setq major-mode 'messages-mode) | |
1747 | (setq mode-name "Messages") | |
1748 | (message-mode-guts) | |
1749 | (modify-syntax-entry ?# "<" messages-mode-syntax-table) | |
1750 | (modify-syntax-entry ?\n ">" messages-mode-syntax-table) | |
1751 | (setq comment-start "# ") | |
1752 | (setq comment-end "") | |
1753 | (turn-on-font-lock-if-enabled) | |
1754 | (run-hooks 'messages-mode-hook)) | |
1755 | ||
1756 | (defun cpp-messages-mode () | |
1757 | (interactive) | |
1758 | (fundamental-mode) | |
1759 | (setq major-mode 'cpp-messages-mode) | |
1760 | (setq mode-name "CPP Messages") | |
1761 | (message-mode-guts) | |
1762 | (modify-syntax-entry ?* ". 23" messages-mode-syntax-table) | |
1763 | (modify-syntax-entry ?/ ". 14" messages-mode-syntax-table) | |
1764 | (setq comment-start "/* ") | |
1765 | (setq comment-end " */") | |
1766 | (let ((preprocessor-keywords | |
1767 | (make-regexp '("assert" "define" "elif" "else" "endif" "error" | |
1768 | "ident" "if" "ifdef" "ifndef" "import" "include" | |
1769 | "line" "pragma" "unassert" "undef" "warning")))) | |
1770 | (setq message-mode-keywords | |
1771 | (append (list (list (concat "^[ \t]*\\#[ \t]*" | |
1772 | "\\(include\\|import\\)" | |
1773 | "[ \t]*\\(<[^>]+\\(>\\|\\)\\)") | |
1774 | '(2 font-lock-string-face)) | |
1775 | (list (concat "^\\([ \t]*#[ \t]*\\(\\(" | |
1776 | preprocessor-keywords | |
852cd5fb | 1777 | "\\)\\>\\|[0-9]+\\|$\\)\\)") |
f617db13 MW |
1778 | '(1 font-lock-keyword-face))) |
1779 | message-mode-keywords))) | |
f617db13 | 1780 | (turn-on-font-lock-if-enabled) |
297d60aa | 1781 | (run-hooks 'cpp-messages-mode-hook)) |
f617db13 | 1782 | |
297d60aa MW |
1783 | (add-hook 'messages-mode-hook 'mdw-misc-mode-config t) |
1784 | (add-hook 'cpp-messages-mode-hook 'mdw-misc-mode-config t) | |
f617db13 MW |
1785 | ; (add-hook 'messages-file-hook 'mdw-fontify-messages t) |
1786 | ||
1787 | ;;;----- Messages-file mode ------------------------------------------------- | |
1788 | ||
1789 | (defvar mallow-driver-substitution-face 'mallow-driver-substitution-face | |
1790 | "Face to use for subsittution directives.") | |
1791 | (make-face 'mallow-driver-substitution-face) | |
1792 | (defvar mallow-driver-text-face 'mallow-driver-text-face | |
1793 | "Face to use for body text.") | |
1794 | (make-face 'mallow-driver-text-face) | |
1795 | ||
1796 | (defun mallow-driver-mode () | |
1797 | (interactive) | |
1798 | (fundamental-mode) | |
1799 | (setq major-mode 'mallow-driver-mode) | |
1800 | (setq mode-name "Mallow driver") | |
1801 | (setq mallow-driver-mode-syntax-table (make-syntax-table)) | |
1802 | (set-syntax-table mallow-driver-mode-syntax-table) | |
1803 | (make-local-variable 'comment-start) | |
1804 | (make-local-variable 'comment-end) | |
1805 | (make-local-variable 'indent-line-function) | |
1806 | (setq indent-line-function 'indent-relative) | |
1807 | (mdw-standard-fill-prefix "\\([ \t]*\\(;\\|/?\\*\\)+[ \t]*\\)") | |
1808 | (make-local-variable 'font-lock-defaults) | |
1809 | (make-local-variable 'mallow-driver-mode-keywords) | |
1810 | (let ((keywords | |
1811 | (make-regexp '("each" "divert" "file" "if" | |
1812 | "perl" "set" "string" "type" "write")))) | |
1813 | (setq mallow-driver-mode-keywords | |
1814 | (list | |
1815 | (list (concat "^%\\s *\\(}\\|\\(" keywords "\\)\\>\\).*$") | |
1816 | '(0 font-lock-keyword-face)) | |
1817 | (list "^%\\s *\\(#.*\\|\\)$" | |
1818 | '(0 font-lock-comment-face)) | |
1819 | (list "^%" | |
1820 | '(0 font-lock-keyword-face)) | |
1821 | (list "^|?\\(.+\\)$" '(1 mallow-driver-text-face)) | |
1822 | (list "\\${[^}]*}" | |
1823 | '(0 mallow-driver-substitution-face t))))) | |
1824 | (setq font-lock-defaults | |
1825 | '(mallow-driver-mode-keywords nil nil nil nil)) | |
1826 | (modify-syntax-entry ?\" "_" mallow-driver-mode-syntax-table) | |
1827 | (modify-syntax-entry ?\n ">" mallow-driver-mode-syntax-table) | |
1828 | (setq comment-start "%# ") | |
1829 | (setq comment-end "") | |
1830 | (turn-on-font-lock-if-enabled) | |
1831 | (run-hooks 'mallow-driver-mode-hook)) | |
1832 | ||
1833 | (add-hook 'mallow-driver-hook 'mdw-misc-mode-config t) | |
1834 | ||
1835 | ;;;----- NFast debugs ------------------------------------------------------- | |
1836 | ||
1837 | (defun nfast-debug-mode () | |
1838 | (interactive) | |
1839 | (fundamental-mode) | |
1840 | (setq major-mode 'nfast-debug-mode) | |
1841 | (setq mode-name "NFast debug") | |
1842 | (setq messages-mode-syntax-table (make-syntax-table)) | |
1843 | (set-syntax-table messages-mode-syntax-table) | |
1844 | (make-local-variable 'font-lock-defaults) | |
1845 | (make-local-variable 'nfast-debug-mode-keywords) | |
1846 | (setq truncate-lines t) | |
1847 | (setq nfast-debug-mode-keywords | |
1848 | (list | |
1849 | '("^\\(NFast_\\(Connect\\|Disconnect\\|Submit\\|Wait\\)\\)" | |
1850 | (0 font-lock-keyword-face)) | |
1851 | (list (concat "^[ \t]+\\(\\(" | |
1852 | "[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]" | |
1853 | "[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]" | |
1854 | "[ \t]+\\)*" | |
1855 | "[0-9a-fA-F]+\\)[ \t]*$") | |
1856 | '(0 mdw-number-face)) | |
1857 | '("^[ \t]+\.status=[ \t]+\\<\\(OK\\)\\>" | |
1858 | (1 font-lock-keyword-face)) | |
1859 | '("^[ \t]+\.status=[ \t]+\\<\\([a-zA-Z][0-9a-zA-Z]*\\)\\>" | |
1860 | (1 font-lock-warning-face)) | |
1861 | '("^[ \t]+\.status[ \t]+\\<\\(zero\\)\\>" | |
1862 | (1 nil)) | |
1863 | (list (concat "^[ \t]+\\.cmd=[ \t]+" | |
1864 | "\\<\\([a-zA-Z][0-9a-zA-Z]*\\)\\>") | |
1865 | '(1 font-lock-keyword-face)) | |
1866 | '("-?\\<\\([0-9]+\\|0x[0-9a-fA-F]+\\)\\>" (0 mdw-number-face)) | |
1867 | '("^\\([ \t]+[a-z0-9.]+\\)" (0 font-lock-variable-name-face)) | |
1868 | '("\\<\\([a-z][a-z0-9.]+\\)\\>=" (1 font-lock-variable-name-face)) | |
1869 | '("\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" (0 mdw-punct-face)))) | |
1870 | (setq font-lock-defaults | |
1871 | '(nfast-debug-mode-keywords nil nil nil nil)) | |
1872 | (turn-on-font-lock-if-enabled) | |
1873 | (run-hooks 'nfast-debug-mode-hook)) | |
1874 | ||
1875 | ;;;----- Other languages ---------------------------------------------------- | |
1876 | ||
1877 | ;; --- Smalltalk --- | |
1878 | ||
1879 | (defun mdw-setup-smalltalk () | |
1880 | (and mdw-auto-indent | |
1881 | (local-set-key "\C-m" 'smalltalk-newline-and-indent)) | |
1882 | (make-variable-buffer-local 'mdw-auto-indent) | |
1883 | (setq mdw-auto-indent nil) | |
1884 | (local-set-key "\C-i" 'smalltalk-reindent)) | |
1885 | ||
1886 | (defun mdw-fontify-smalltalk () | |
02109a0d | 1887 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1888 | (setq font-lock-keywords |
1889 | (list | |
f617db13 MW |
1890 | (list "\\<[A-Z][a-zA-Z0-9]*\\>" |
1891 | '(0 font-lock-keyword-face)) | |
1892 | (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" | |
1893 | "[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" | |
1894 | "\\([eE]\\([-+]\\|\\)[0-9_]+\\|\\)") | |
1895 | '(0 mdw-number-face)) | |
1896 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" | |
1897 | '(0 mdw-punct-face))))) | |
1898 | ||
1899 | ;; --- Lispy languages --- | |
1900 | ||
1901 | (defun mdw-indent-newline-and-indent () | |
1902 | (interactive) | |
1903 | (indent-for-tab-command) | |
1904 | (newline-and-indent)) | |
1905 | ||
1906 | (eval-after-load "cl-indent" | |
1907 | '(progn | |
1908 | (mapc #'(lambda (pair) | |
1909 | (put (car pair) | |
1910 | 'common-lisp-indent-function | |
1911 | (cdr pair))) | |
1912 | '((destructuring-bind . ((&whole 4 &rest 1) 4 &body)) | |
1913 | (multiple-value-bind . ((&whole 4 &rest 1) 4 &body)))))) | |
1914 | ||
1915 | (defun mdw-common-lisp-indent () | |
1916 | (make-variable-buffer-local 'lisp-indent-function) | |
1917 | (setq lisp-indent-function 'common-lisp-indent-function)) | |
1918 | ||
1919 | (defun mdw-fontify-lispy () | |
1920 | ||
1921 | ;; --- Set fill prefix --- | |
1922 | ||
1923 | (mdw-standard-fill-prefix "\\([ \t]*;+[ \t]*\\)") | |
1924 | ||
1925 | ;; --- Not much fontification needed --- | |
1926 | ||
02109a0d | 1927 | (make-local-variable 'font-lock-keywords) |
f617db13 MW |
1928 | (setq font-lock-keywords |
1929 | (list | |
f617db13 MW |
1930 | (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" |
1931 | '(0 mdw-punct-face))))) | |
1932 | ||
1933 | (defun comint-send-and-indent () | |
1934 | (interactive) | |
1935 | (comint-send-input) | |
1936 | (and mdw-auto-indent | |
1937 | (indent-for-tab-command))) | |
1938 | ||
1939 | ;;;----- Text mode ---------------------------------------------------------- | |
1940 | ||
1941 | (defun mdw-text-mode () | |
1942 | (setq fill-column 72) | |
1943 | (flyspell-mode t) | |
1944 | (mdw-standard-fill-prefix | |
1945 | "\\([ \t]*\\([A-Za-z0-9]*[>#|:] ?\\)*[ \t]*\\)" 3) | |
1946 | (auto-fill-mode 1)) | |
1947 | ||
1948 | ;;;----- Shell mode --------------------------------------------------------- | |
1949 | ||
1950 | (defun mdw-sh-mode-setup () | |
1951 | (local-set-key [?\C-a] 'comint-bol) | |
1952 | (add-hook 'comint-output-filter-functions | |
1953 | 'comint-watch-for-password-prompt)) | |
1954 | ||
1955 | (defun mdw-term-mode-setup () | |
502f4699 | 1956 | (setq term-prompt-regexp "^[^]#$%>»}\n]*[]#$%>»}] *") |
f617db13 MW |
1957 | (make-local-variable 'mouse-yank-at-point) |
1958 | (make-local-variable 'transient-mark-mode) | |
1959 | (setq mouse-yank-at-point t) | |
1960 | (setq transient-mark-mode nil) | |
1961 | (auto-fill-mode -1) | |
1962 | (setq tab-width 8)) | |
1963 | ||
1964 | ;;;----- That's all, folks -------------------------------------------------- | |
1965 | ||
1966 | (provide 'dot-emacs) |