From: Mark Wooding Date: Sun, 4 Oct 2009 23:15:03 +0000 (+0100) Subject: Merge branch 'master' of metalzone:etc/profile X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/be2cc788c85f818214bbcd3089eb2f481dd8b831?hp=-c Merge branch 'master' of metalzone:etc/profile * 'master' of metalzone:etc/profile: dot/bash_profile: Make OpenOffice not use ugly widgets. dot/gnus.el: Use distinct article buffers for different groups. dot/e16-bindings: Make 5-F6 toggle keyboard mouse control. dot/emacs, el/dot-emacs.el: Reformat in line with current styles. Conflicts: el/dot-emacs.el: Style hacking conflicted with Python fixing --- be2cc788c85f818214bbcd3089eb2f481dd8b831 diff --combined dot/e16-bindings index a2c0e13,2875ee7..45493bc --- a/dot/e16-bindings +++ b/dot/e16-bindings @@@ -28,6 -28,7 +28,7 @@@ Tooltip Go Back a Deskto MouseDown * 5 desk next Tooltip Go Forward a Desktop Aclass KEYBINDINGS global + KeyDown 5 F6 exec gconftool --toggle /desktop/gnome/accessibility/keyboard/mousekeys_enable KeyDown 5 F7 exec un-backslashify-selection KeyDown 5 F8 exec xatom set XINIT_COMMAND :terminal KeyDown 5 F9 exec xatom set XINIT_COMMAND :ask-run @@@ -56,9 -57,9 +57,9 @@@ KeyDown C5 F4 menus show window KeyDown C5 Up wop * raise KeyDown C5 Down wop * lower KeyDown C5 End exit restart -KeyDown S5 h wop * tw conservative -KeyDown S5 m wop * ts conservative -KeyDown S5 v wop * th conservative +KeyDown SC5 h wop * tw conservative +KeyDown SC5 m wop * ts conservative +KeyDown SC5 v wop * th conservative KeyDown S5 Up area move 0 -1 KeyDown S5 Down area move 0 1 KeyDown S5 Left area move -1 0 diff --combined dot/emacs index 9e1f688,2118790..fe5b563 --- a/dot/emacs +++ b/dot/emacs @@@ -24,11 -24,12 +24,12 @@@ (setq load-path (nconc load-path (list "~/lib/emacs"))) (require 'dot-emacs) - ;;;----- Some random initialisation ----------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Some random initialisation. (setq mdw-init-window (selected-window)) - ;; --- Load some other bits of code --- + ;; Load some other bits of code. (maybe-autoload 'cc-mode "cc-mode" nil t) (maybe-autoload 'rexx-mode "rexx-mode" nil t) @@@ -61,19 -62,18 +62,19 @@@ (trap (or mdw-fast-startup (require 'tex-site))) (trap (or mdw-fast-startup (semantic-load-enable-minimum-features))) +(setq semanticdb-default-save-directory "~/.emacs.d/semanticdb/") - ;; --- Skeleton stuff --- + ;; Skeleton stuff. (trap (or mdw-fast-startup (require 'skel-init))) - ;; --- Window system-dependent things --- + ;; Window system-dependent things. (require 'paren) (trap (show-paren-mode t)) (or window-system (menu-bar-mode -1)) - ;; --- Temporary directory handling --- + ;; Temporary directory handling. (defun mdw-check-dir-exists (dir) (and dir @@@ -83,13 -83,13 +84,13 @@@ (mdw-check-dir-exists (format "/tmp/%s" (user-login-name))) "/tmp")) - ;; --- Emacs server behaviour --- + ;; Emacs server behaviour. (and window-system (trap (gnuserv-start) (setq server-temp-file-regexp (concat "^" tmpdir "\\|/draft$")))) - ;; --- Control backup behaviour --- + ;; Control backup behaviour. (setq backup-by-copying nil) (setq backup-by-copying-when-linked t) @@@ -99,12 -99,12 +100,12 @@@ '("/\\.git/COMMIT_EDITMSG$" "/\\.stgit\\(-edit\\.txt\\|msg\\.txt\\|\\.msg\\)$")) - ;; --- Safe variables --- + ;; Safe variables. (setq safe-local-variable-values '((make-backup-files . nil))) - ;; --- Calculator fiddling --- + ;; Calculator fiddling. (setq calc-settings-file "~/.emacs-calc") (load calc-settings-file) @@@ -143,14 -143,14 +144,14 @@@ (trap (bbdb-initialize 'gnus 'sendmail 'message))) (setq bbdb-north-american-phone-numbers-p nil) - ;; --- Customization --- + ;; Customization. (setq custom-file "~/.emacs-custom") (trap (load custom-file)) (trap (load "~/.emacs-local")) - ;; --- Internationalization twiddling --- + ;; Internationalization twiddling. (trap ;; Have top-bit-set characters work properly in terminals. @@@ -158,15 -158,15 +159,15 @@@ (apply #'set-input-mode (nconc (list (nth 0 im) (nth 1 im) 0) (nthcdr 3 im))))) - ;; --- Don't disable any commands --- + ;; Don't disable any commands. (mapatoms #'(lambda (sym) (put sym 'disabled nil))) - ;; --- Split a wide window --- + ;; Split a wide window. (mdw-divvy-window) - ;; --- Postscript printing --- + ;; Postscript printing. (setq ps-paper-type 'a4 ps-print-color-p nil @@@ -175,13 -175,13 +176,13 @@@ ps-font-family 'Courier ps-font-size 6.5) - ;; --- Splash screen stuff --- + ;; Splash screen stuff. (or window-system (setq inhibit-splash-screen t inhibit-startup-message t)) - ;; --- Other goodies --- + ;; Other goodies. (trap (resize-minibuffer-mode 1)) ;Make minibuffer grow dynamically (auto-compression-mode 1) ;Enable automatic compression @@@ -238,7 -238,8 +239,8 @@@ (setq cltl2-root-url (mdw-config 'cltl-url)) (setq common-lisp-hyperspec-root (mdw-config 'hyperspec-url)) - ;;;----- W3 and URL fetching stuff ------------------------------------------ + ;;;-------------------------------------------------------------------------- + ;;; W3 and URL fetching stuff. (let ((proxy (mdw-config 'http-proxy))) (setq url-proxy-services @@@ -258,17 -259,18 +260,18 @@@ w3-display-inline-image t w3-keybinding 'info) - ;;;----- Calendar configuration --------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Calendar configuration. (setq diary-file "~/etc/diary") - ;; --- Trivial stuff for the sunrise/sunset calculations --- + ;; Trivial stuff for the sunrise/sunset calculations. (setq calendar-latitude 52.2) (setq calendar-longitude 0.1) (setq calendar-location-name "Cambridge, UK") - ;; --- Holidays --- + ;; Holidays. (and (not mdw-fast-startup) (trap @@@ -276,7 -278,7 +279,7 @@@ (setq other-holidays (append english-and-welsh-bank-holidays other-holidays)))) - ;; --- Date format fiddling --- + ;; Date format fiddling. (setq european-calendar-style t) @@@ -288,7 -290,7 +291,7 @@@ (year "[-/]" month "[-/]" day "[^0-9]") (dayname "\\W"))) - ;; --- Fancy diary handling --- + ;; Fancy diary handling. (add-hook 'diary-display-hook 'fancy-diary-display) (setq diary-list-include-blanks t) @@@ -296,19 -298,19 +299,19 @@@ (add-hook 'list-diary-entries-hook 'include-other-diary-files) (add-hook 'mark-diary-entries-hook 'mark-included-diary-files) - ;; --- Appointment management --- + ;; Appointment management. (add-hook 'diary-hook 'appt-make-list) (setq appt-issue-message t) (setq appt-display-interval 3) (setq appt-message-warning-time 10) - ;; --- Org-mode agenda --- + ;; Org-mode agenda. (setq org-agenda-include-diary t org-tags-column -77) - ;; --- Cosmetic stuff --- + ;; Cosmetic stuff. (setq display-time-24hr-format t) (display-time) @@@ -317,15 -319,16 +320,16 @@@ (let ((view-diary-entries-initially t)) (calendar)))) - ;;;----- MailCrypt ---------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; MailCrypt. - ;; --- Define more mode hooks for MailCrypt --- + ;; Define more mode hooks for MailCrypt. (setq mdw-mc-modes '((mdwmail-mode (encrypt . mdwmail-mc-encrypt) (sign . mdwmail-mc-sign)))) - ;; --- Load the MailCrypt support --- + ;; Load the MailCrypt support. (trap (and (string-match "linux" (symbol-name system-type)) @@@ -346,9 -349,10 +350,10 @@@ (define-key mc-write-mode-map "\C-c/E" 'mc-encrypt-region) (add-hook 'text-mode-hook 'mc-install-write-mode)))) - ;;;----- Other common declarations ------------------------------------------ + ;;;-------------------------------------------------------------------------- + ;;; Other common declarations. - ;; --- Default frame size --- + ;; Default frame size. (setq default-frame-alist (mdw-uniquify-alist @@@ -374,11 -378,11 +379,11 @@@ '((transparency . t)) default-frame-alist)) - ;; --- Other frame fiddling --- + ;; Other frame fiddling. (setq frame-title-format '("" invocation-name "@" system-name ": %b")) - ;; --- Global keymap changes --- + ;; Global keymap changes. (trap (windmove-default-keybindings)) @@@ -428,7 -432,7 +433,7 @@@ (add-hook 'org-agenda-mode-hook #'(lambda () (mdw-clobber-evil-keymap org-agenda-mode-map))) - ;; --- Recognising types of files --- + ;; Recognising types of files. (setq auto-mode-alist (append `(("\\.p[lm]$" . perl-mode) @@@ -472,15 -476,14 +477,15 @@@ (setq completion-ignored-extensions (append `(".hc" ".hi") completion-ignored-extensions)) - ;; --- Some common local definitions --- + ;; Some common local definitions. (make-variable-buffer-local 'mdw-auto-indent) (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config)) '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook csharp-mode-hook perl-mode-hook cperl-mode-hook - python-mode-hook icon-mode-hook awk-mode-hook tcl-mode-hook + python-mode-hook pyrec-mode-hook icon-mode-hook awk-mode-hook + tcl-mode-hook asm-mode-hook TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook tex-mode-hook latex-mode-hook texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook @@@ -493,7 -496,8 +498,8 @@@ (global-font-lock-mode t) (defalias 'perl-mode 'cperl-mode) - ;;;----- Rootly editingness ------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Rootly editingness. (eval-after-load "tramp" '(progn @@@ -529,9 -533,10 +535,10 @@@ ((executable-find "really") "really") (t "su"))))))) - ;;;----- General fontification ---------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; General fontification. - ;; --- Configure lazy fontification --- + ;; Configure lazy fontification. (and (fboundp 'lazy-lock-mode) (setq font-lock-support-mode 'lazy-lock-mode)) @@@ -568,7 -573,6 +575,7 @@@ (setq-default py-indent-offset 2) (add-hook 'python-mode-hook 'mdw-fontify-python t) +(add-hook 'pyrex-mode-hook 'mdw-fontify-pyrex t) (setq py-python-command-args `("-i" "-colors" ,(if mdw-black-background "Linux" "LightBG"))) @@@ -619,7 -623,8 +626,8 @@@ (add-hook 'text-mode-hook 'mdw-text-mode t) - ;;;----- TeX stuff ---------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; TeX stuff. (setq TeX-output-view-style '(("^dvi$" @@@ -668,7 -673,8 +676,8 @@@ unify-case) bibtex-include-OPTkey nil) - ;;;----- SLIME setup -------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; SLIME setup. (trap (if (not mdw-fast-startup) @@@ -691,7 -697,8 +700,8 @@@ (cons head slime-lisp-implementations)))))) (setq slime-default-lisp 'sbcl) - ;;;----- Blogging ----------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Blogging. (setq weblogger-config-alist '(("vox" @@@ -699,16 -706,17 +709,17 @@@ ("server-url" . "http://vox.distorted.org.uk/admin/mt-xmlrpc.cgi") ("weblog" . "1")))) - ;;;----- Shell mode --------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Shell mode. - ;; --- Make the shell mode aware of my prompt --- + ;; Make the shell mode aware of my prompt. (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *") (setq comint-password-prompt-regexp (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)" "[Pp]assword\\|pass phrase\\):\\s *\\'")) - ;; --- Notice passwords, and make C-a work right --- + ;; Notice passwords, and make C-a work right. (add-hook 'shell-mode-hook #'mdw-sh-mode-setup) (add-hook 'shell-mode-hook #'ansi-color-for-comint-mode-on) @@@ -716,7 -724,8 +727,8 @@@ (add-hook 'term-mode-hook #'mdw-term-mode-setup) - ;;;----- Finishing touches -------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Finishing touches. (trap (select-window mdw-init-window)) (provide 'emacs-init) diff --combined el/dot-emacs.el index c9b9623,2f61f96..41e15d3 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@@ -21,7 -21,8 +21,8 @@@ ;;; along with this program; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ;;;----- Check command-line ------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Check command-line. (defvar mdw-fast-startup nil "Whether .emacs should optimize for rapid startup. @@@ -37,7 -38,8 +38,8 @@@ This may be at the expense of cool feat (setq probe next))) (setq next (cdr next)))) - ;;;----- Some general utilities --------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Some general utilities. (eval-when-compile (unless (fboundp 'make-regexp) @@@ -48,7 -50,7 +50,7 @@@ "Turn a LIST of strings into a single regular expression at compile-time." `',(make-regexp list)) - ;; --- Some error trapping --- + ;; Some error trapping. ;; ;; If individual bits of this file go tits-up, we don't particularly want ;; the whole lot to stop right there and then, because it's bloody annoying. @@@ -61,7 -63,7 +63,7 @@@ (error-message-string err) ',forms)))) - ;; --- Configuration reading --- + ;; Configuration reading. (defvar mdw-config nil) (defun mdw-config (sym) @@@ -85,7 -87,7 +87,7 @@@ (concat "(" (buffer-string) ")"))))))) (cdr (assq sym mdw-config))) - ;; --- Set up the load path convincingly --- + ;; Set up the load path convincingly. (dolist (dir (append (and (boundp 'debian-emacs-flavor) (list (concat "/usr/share/" @@@ -96,11 -98,13 +98,13 @@@ (not (member sub load-path))) (setq load-path (nconc load-path (list sub)))))) - ;; --- Is an Emacs library available? --- + ;; Is an Emacs library available? (defun library-exists-p (name) - "Return non-nil if NAME.el (or NAME.elc) is somewhere on the Emacs load - path. The non-nil value is the filename we found for the library." + "Return non-nil if NAME is an available library. + Return non-nil if NAME.el (or NAME.elc) somewhere on the Emacs + load path. The non-nil value is the filename we found for the + library." (let ((path load-path) elt (foundp nil)) (while (and path (not foundp)) (setq elt (car path)) @@@ -116,7 -120,7 +120,7 @@@ (and (library-exists-p file) (autoload symbol file docstring interactivep type))) - ;; --- Splitting windows --- + ;; Splitting windows. (unless (fboundp 'scroll-bar-columns) (defun scroll-bar-columns (side) @@@ -156,14 -160,14 +160,14 @@@ (other-window 1)) (select-window win))) - ;; --- Functions for sexp diary entries --- + ;; Functions for sexp diary entries. (defun mdw-weekday (l) "Return non-nil if `date' falls on one of the days of the week in L. - - L is a list of day numbers (from 0 to 6 for Sunday through to Saturday) or - symbols `sunday', `monday', etc. (or a mixture). If the date stored in - `date' falls on a listed day, then the function returns non-nil." + L is a list of day numbers (from 0 to 6 for Sunday through to + Saturday) or symbols `sunday', `monday', etc. (or a mixture). If + the date stored in `date' falls on a listed day, then the + function returns non-nil." (let ((d (calendar-day-of-week date))) (or (memq d l) (memq (nth d '(sunday monday tuesday wednesday @@@ -188,7 -192,7 +192,7 @@@ (nth 2 when)))))))) (eq w d))) - ;; --- Fighting with Org-mode's evil key maps --- + ;; Fighting with Org-mode's evil key maps. (defvar mdw-evil-keymap-keys '(([S-up] . [?\C-c up]) @@@ -225,10 -229,11 +229,11 @@@ Evil key bindings are defined in `mdw-e (dolist (key replacements) (define-key keymap key binding)))))) - ;;;----- Mail and news hacking ---------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Mail and news hacking. (define-derived-mode mdwmail-mode mail-mode "[mdw] mail" - "Major mode for editing news and mail messages from external programs + "Major mode for editing news and mail messages from external programs. Not much right now. Just support for doing MailCrypt stuff." :syntax-table nil :abbrev-table nil @@@ -248,7 -253,7 +253,7 @@@ (concat "[ \t]*[-_][-_][-_]+$\\|^-- \\|-----\\|" paragraph-separate)))) - ;; --- How to encrypt in mdwmail --- + ;; How to encrypt in mdwmail. (defun mdwmail-mc-encrypt (&optional recip scm start end from sign) (or start @@@ -259,7 -264,7 +264,7 @@@ (setq end (point-max))) (mc-encrypt-generic recip scm start end from sign)) - ;; --- How to sign in mdwmail --- + ;; How to sign in mdwmail. (defun mdwmail-mc-sign (key scm start end uclr) (or start @@@ -270,7 -275,7 +275,7 @@@ (setq end (point-max))) (mc-sign-generic key scm start end uclr)) - ;; --- Some signature mangling --- + ;; Some signature mangling. (defun mdwmail-mangle-signature () (save-excursion @@@ -279,14 -284,14 +284,14 @@@ (add-hook 'mail-setup-hook 'mdwmail-mangle-signature) (add-hook 'message-setup-hook 'mdwmail-mangle-signature) - ;; --- Insert my login name into message-ids, so I can score replies --- + ;; Insert my login name into message-ids, so I can score replies. (defadvice message-unique-id (after mdw-user-name last activate compile) "Ensure that the user's name appears at the end of the message-id string, so that it can be used for convenient filtering." (setq ad-return-value (concat ad-return-value "." (user-login-name)))) - ;; --- Tell my movemail hack where movemail is --- + ;; Tell my movemail hack where movemail is. ;; ;; This is needed to shup up warnings about LD_PRELOAD. @@@ -297,7 -302,8 +302,8 @@@ (setenv "REAL_MOVEMAIL" try)) (setq path (cdr path))))) - ;;;----- Utility functions -------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Utility functions. (or (fboundp 'line-number-at-pos) (defun line-number-at-pos (&optional pos) @@@ -312,15 -318,11 +318,11 @@@ (forward-line 0) (1+ (count-lines 1 (point)))))))) - ;; --- mdw-uniquify-alist --- - (defun mdw-uniquify-alist (&rest alists) - "Return the concatenation of the ALISTS with duplicate elements removed. - - The first association with a given key prevails; others are ignored. The - input lists are not modified, although they'll probably become garbage." - + The first association with a given key prevails; others are + ignored. The input lists are not modified, although they'll + probably become garbage." (and alists (let ((start-list (cons nil nil))) (mdw-do-uniquify start-list @@@ -328,48 -330,37 +330,37 @@@ (car alists) (cdr alists))))) - ;; --- mdw-do-uniquify --- - ;; - ;; The DONE argument is a list whose first element is `nil'. It contains the - ;; uniquified alist built so far. The leading `nil' is stripped off at the - ;; end of the operation; it's only there so that DONE always references a - ;; cons cell. END refers to the final cons cell in the DONE list; it is - ;; modified in place each time to avoid the overheads of `append'ing all the - ;; time. The L argument is the alist we're currently processing; the - ;; remaining alists are given in REST. (defun mdw-do-uniquify (done end l rest) - "A helper function for mdw-uniquify-alist." - - ;; --- There are several different cases to deal with here --- - + "A helper function for mdw-uniquify-alist. + The DONE argument is a list whose first element is `nil'. It + contains the uniquified alist built so far. The leading `nil' is + stripped off at the end of the operation; it's only there so that + DONE always references a cons cell. END refers to the final cons + cell in the DONE list; it is modified in place each time to avoid + the overheads of `append'ing all the time. The L argument is the + alist we're currently processing; the remaining alists are given + in REST." + + ;; There are several different cases to deal with here. (cond - ;; --- Current list isn't empty --- - ;; - ;; Add the first item to the DONE list if there's not an item with the - ;; same KEY already there. - + ;; Current list isn't empty. Add the first item to the DONE list if + ;; there's not an item with the same KEY already there. (l (or (assoc (car (car l)) done) (progn (setcdr end (cons (car l) nil)) (setq end (cdr end)))) (mdw-do-uniquify done end (cdr l) rest)) - ;; --- The list we were working on is empty --- - ;; - ;; Shunt the next list into the current list position and go round again. - + ;; The list we were working on is empty. Shunt the next list into the + ;; current list position and go round again. (rest (mdw-do-uniquify done end (car rest) (cdr rest))) - ;; --- Everything's done --- - ;; - ;; Remove the leading `nil' from the DONE list and return it. Finished! - + ;; Everything's done. Remove the leading `nil' from the DONE list and + ;; return it. Finished! (t (cdr done)))) - ;; --- Insert a date --- - (defun date () "Insert the current date in a pleasing way." (interactive) @@@ -383,23 -374,18 +374,18 @@@ (buffer-string)) (kill-buffer buffer)))))) - ;; --- UUencoding --- - (defun uuencode (file &optional name) "UUencodes a file, maybe calling it NAME, into the current buffer." (interactive "fInput file name: ") - ;; --- If NAME isn't specified, then guess from the filename --- - + ;; If NAME isn't specified, then guess from the filename. (if (not name) (setq name (substring file (or (string-match "[^/]*$" file) 0)))) - (print (format "uuencode `%s' `%s'" file name)) - ;; --- Now actually do the thing --- - + ;; Now actually do the thing. (call-process "uuencode" file t nil name)) (defvar np-file "~/.np" @@@ -415,9 -401,9 +401,9 @@@ (insert-file-contents np-file))))) (defun mdw-check-autorevert () - "Sets global-auto-revert-ignore-buffer appropriately for this buffer, - taking into consideration whether it's been found using tramp, which seems to - get itself into a twist." + "Sets global-auto-revert-ignore-buffer appropriately for this buffer. + This takes into consideration whether it's been found using + tramp, which seems to get itself into a twist." (cond ((not (boundp 'global-auto-revert-ignore-buffer)) nil) ((and (buffer-file-name) @@@ -433,14 -419,16 +419,16 @@@ (defadvice write-file (after mdw-autorevert activate) (mdw-check-autorevert)) - ;;;----- Dired hacking ------------------------------------------------------ + ;;;-------------------------------------------------------------------------- + ;;; Dired hacking. (defadvice dired-maybe-insert-subdir (around mdw-marked-insertion first activate) - "The DIRNAME may be a list of directory names to insert. Interactively, if - files are marked, then insert all of them. With a numeric prefix argument, - select that many entries near point; with a non-numeric prefix argument, - prompt for listing options." + "The DIRNAME may be a list of directory names to insert. + Interactively, if files are marked, then insert all of them. + With a numeric prefix argument, select that many entries near + point; with a non-numeric prefix argument, prompt for listing + options." (interactive (list (dired-get-marked-files nil (and (integerp current-prefix-arg) @@@ -456,7 -444,8 +444,8 @@@ (ad-set-arg 0 dir) ad-do-it))) - ;;;----- URL viewing -------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; URL viewing. (defun mdw-w3m-browse-url (url &optional new-session-p) "Invoke w3m on the URL in its current window, or at least a different one. @@@ -478,13 -467,14 +467,14 @@@ If NEW-SESSION-P, start a new session. '((w3m . mdw-w3m-browse-url) browse-url-w3 browse-url-mozilla) - "List of good browsers for mdw-good-url-browsers; each item is a browser - function name, or a cons (CHECK . FUNC). A symbol FOO stands for (FOO - . FOO).") + "List of good browsers for mdw-good-url-browsers. + Each item is a browser function name, or a cons (CHECK . FUNC). + A symbol FOO stands for (FOO . FOO).") (defun mdw-good-url-browser () - "Return a good URL browser. Trundle the list of such things, finding the - first item for which CHECK is fboundp, and returning the correponding FUNC." + "Return a good URL browser. + Trundle the list of such things, finding the first item for which + CHECK is fboundp, and returning the correponding FUNC." (let ((bs mdw-good-url-browsers) b check func answer) (while (and bs (not answer)) (setq b (car bs) @@@ -496,19 -486,20 +486,20 @@@ (setq answer func))) answer)) - ;;;----- Paragraph filling -------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Paragraph filling. - ;; --- Useful variables --- + ;; Useful variables. (defvar mdw-fill-prefix nil - "*Used by `mdw-line-prefix' and `mdw-fill-paragraph'. If there's - no fill prefix currently set (by the `fill-prefix' variable) and there's - a match from one of the regexps here, it gets used to set the fill-prefix - for the current operation. + "*Used by `mdw-line-prefix' and `mdw-fill-paragraph'. + If there's no fill prefix currently set (by the `fill-prefix' + variable) and there's a match from one of the regexps here, it + gets used to set the fill-prefix for the current operation. - The variable is a list of items of the form `REGEXP . PREFIX'; if the - REGEXP matches, the PREFIX is used to set the fill prefix. It in turn is - a list of things: + The variable is a list of items of the form `REGEXP . PREFIX'; if + the REGEXP matches, the PREFIX is used to set the fill prefix. + It in turn is a list of things: STRING -- insert a literal string (match . N) -- insert the thing matched by bracketed subexpression N @@@ -522,14 -513,14 +513,14 @@@ "\\([*o]\\|-[-#]?\\|[0-9]+\\.\\|\\[[0-9]+\\]\\|([a-zA-Z])\\)" "[ \t]+" "\\)?\\)") - "*Standard regular expression matching things which might be part of a - hanging indent. This is mainly useful in `auto-fill-mode'.") + "*Standard regexp matching parts of a hanging indent. + This is mainly useful in `auto-fill-mode'.") - ;; --- Setting things up --- + ;; Setting things up. (fset 'mdw-do-auto-fill (symbol-function 'do-auto-fill)) - ;; --- Utility functions --- + ;; Utility functions. (defun mdw-tabify (s) "Tabify the string S. This is a horrid hack." @@@ -548,9 -539,9 +539,9 @@@ s)))) (defun mdw-examine-fill-prefixes (l) - "Given a list of dynamic fill prefixes, pick one which matches context and - return the static fill prefix to use. Point must be at the start of a line, - and match data must be saved." + "Given a list of dynamic fill prefixes, pick one which matches + context and return the static fill prefix to use. Point must be + at the start of a line, and match data must be saved." (cond ((not l) nil) ((looking-at (car (car l))) (mdw-tabify (apply (function concat) @@@ -572,8 -563,8 +563,8 @@@ n)) (defun mdw-do-prefix-match (m) - "Expand a dynamic prefix match element. See `mdw-fill-prefix' for - details." + "Expand a dynamic prefix match element. + See `mdw-fill-prefix' for details." (cond ((not (consp m)) (format "%s" m)) ((eq (car m) 'match) (match-string (mdw-maybe-car (cdr m)))) ((eq (car m) 'pad) (mdw-padding (match-string @@@ -591,8 -582,8 +582,8 @@@ (mdw-examine-fill-prefixes mdw-fill-prefix)))))) (defun do-auto-fill () - "Handle auto-filling, working out a dynamic fill prefix in the case where - there isn't a sensible static one." + "Handle auto-filling, working out a dynamic fill prefix in the + case where there isn't a sensible static one." (let ((fill-prefix (mdw-choose-dynamic-fill-prefix))) (mdw-do-auto-fill))) @@@ -604,16 -595,18 +595,18 @@@ (defun mdw-standard-fill-prefix (rx &optional mat) "Set the dynamic fill prefix, handling standard hanging indents and stuff. - This is just a short-cut for setting the thing by hand, and by design it - doesn't cope with anything approximating a complicated case." + This is just a short-cut for setting the thing by hand, and by + design it doesn't cope with anything approximating a complicated + case." (setq mdw-fill-prefix `((,(concat rx mdw-hanging-indents) (match . 1) (pad . ,(or mat 2)))))) - ;;;----- Other common declarations ------------------------------------------ + ;;;-------------------------------------------------------------------------- + ;;; Other common declarations. - ;; --- Common mode settings --- + ;; Common mode settings. (defvar mdw-auto-indent t "Whether to indent automatically after a newline.") @@@ -643,7 -636,7 +636,7 @@@ '(dolist (key '([mouse-2] [mouse-3])) (define-key gtags-mode-map key nil))) - ;; --- Set up all sorts of faces --- + ;; Set up all sorts of faces. (defvar mdw-set-font nil) @@@ -652,16 -645,17 +645,17 @@@ (defvar mdw-number-face 'mdw-number-face "Face to use for numbers") (make-face 'mdw-number-face) - ;; --- Backup file handling --- + ;; Backup file handling. (defvar mdw-backup-disable-regexps nil - "*List of regular expressions: if a file name matches any of these then the - file is not backed up.") + "*List of regular expressions: if a file name matches any of + these then the file is not backed up.") (defun mdw-backup-enable-predicate (name) - "[mdw]'s default backup predicate: allows a backup if the - standard predicate would allow it, and it doesn't match any of - the regular expressions in `mdw-backup-disable-regexps'." + "[mdw]'s default backup predicate. + Allows a backup if the standard predicate would allow it, and it + doesn't match any of the regular expressions in + `mdw-backup-disable-regexps'." (and (normal-backup-enable-predicate name) (let ((answer t) (list mdw-backup-disable-regexps)) (save-match-data @@@ -672,7 -666,8 +666,8 @@@ answer)))) (setq backup-enable-predicate 'mdw-backup-enable-predicate) - ;;;----- General fontification ---------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; General fontification. (defun mdw-set-fonts (frame faces) (while faces @@@ -796,9 -791,10 +791,10 @@@ (setq mdw-set-font t) (mdw-do-set-font nil))))) - ;;;----- C programming configuration ---------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; C programming configuration. - ;; --- Linux kernel hacking --- + ;; Linux kernel hacking. (defvar linux-c-mode-hook) @@@ -809,8 -805,13 +805,8 @@@ (setq mode-name "Linux C") (run-hooks 'linux-c-mode-hook)) - ;; --- Make C indentation nice --- + ;; Make C indentation nice. -(eval-after-load "cc-mode" - '(progn - (define-key c-mode-map "*" nil) - (define-key c-mode-map "/" nil))) - (defun mdw-c-lineup-arglist (langelem) "Hack for DWIMmery in c-lineup-arglist." (if (save-excursion @@@ -851,14 -852,12 +847,12 @@@ (defun mdw-fontify-c-and-c++ () - ;; --- Fiddle with some syntax codes --- - + ;; Fiddle with some syntax codes. (modify-syntax-entry ?* ". 23") (modify-syntax-entry ?/ ". 124b") (modify-syntax-entry ?\n "> b") - ;; --- Other stuff --- - + ;; Other stuff. (mdw-c-style) (setq c-hanging-comment-ender-p nil) (setq c-backslash-column 72) @@@ -870,8 -869,7 +864,7 @@@ mdw-hanging-indents) (pad . 1) (match . 2) (pad . 3) (pad . 4)))) - ;; --- Now define things to be fontified --- - + ;; Now define things to be fontified. (make-local-variable 'font-lock-keywords) (let ((c-keywords (mdw-regexps "and" ;C++ @@@ -984,44 -982,40 +977,40 @@@ (setq font-lock-keywords (list - ;; --- Fontify include files as strings --- - + ;; Fontify include files as strings. (list (concat "^[ \t]*\\#[ \t]*" "\\(include\\|import\\)" "[ \t]*\\(<[^>]+\\(>\\|\\)\\)") '(2 font-lock-string-face)) - ;; --- Preprocessor directives are `references'? --- - + ;; Preprocessor directives are `references'?. (list (concat "^\\([ \t]*#[ \t]*\\(\\(" preprocessor-keywords "\\)\\>\\|[0-9]+\\|$\\)\\)") '(1 font-lock-keyword-face)) - ;; --- Handle the keywords defined above --- - + ;; Handle the keywords defined above. (list (concat "@\\<\\(" objc-keywords "\\)\\>") '(0 font-lock-keyword-face)) (list (concat "\\<\\(" c-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- Handle numbers too --- + ;; Handle numbers too. ;; ;; This looks strange, I know. It corresponds to the ;; preprocessor's idea of what a number looks like, rather than ;; anything sensible. - (list (concat "\\(\\<[0-9]\\|\\.[0-9]\\)" "\\([Ee][+-]\\|[0-9A-Za-z_.]\\)*") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- AP calc mode ------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; AP calc mode. (defun apcalc-mode () (interactive) @@@ -1032,13 -1026,11 +1021,11 @@@ (defun mdw-fontify-apcalc () - ;; --- Fiddle with some syntax codes --- - + ;; Fiddle with some syntax codes. (modify-syntax-entry ?* ". 23") (modify-syntax-entry ?/ ". 14") - ;; --- Other stuff --- - + ;; Other stuff. (mdw-c-style) (setq c-hanging-comment-ender-p nil) (setq c-backslash-column 72) @@@ -1051,8 -1043,7 +1038,7 @@@ mdw-hanging-indents) (pad . 1) (match . 2) (pad . 3) (pad . 4)))) - ;; --- Now define things to be fontified --- - + ;; Now define things to be fontified. (make-local-variable 'font-lock-keywords) (let ((c-keywords (mdw-regexps "break" "case" "cd" "continue" "define" "default" @@@ -1063,29 -1054,27 +1049,27 @@@ (setq font-lock-keywords (list - ;; --- Handle the keywords defined above --- - + ;; Handle the keywords defined above. (list (concat "\\<\\(" c-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- Handle numbers too --- + ;; Handle numbers too. ;; ;; This looks strange, I know. It corresponds to the ;; preprocessor's idea of what a number looks like, rather than ;; anything sensible. - (list (concat "\\(\\<[0-9]\\|\\.[0-9]\\)" "\\([Ee][+-]\\|[0-9A-Za-z_.]\\)*") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- Java programming configuration ------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Java programming configuration. - ;; --- Make indentation nice --- + ;; Make indentation nice. (defun mdw-java-style () (c-add-style "[mdw] Java style" @@@ -1098,12 -1087,11 +1082,11 @@@ (statement-case-intro . +))) t)) - ;; --- Declare Java fontification style --- + ;; Declare Java fontification style. (defun mdw-fontify-java () - ;; --- Other stuff --- - + ;; Other stuff. (mdw-java-style) (setq c-hanging-comment-ender-p nil) (setq c-backslash-column 72) @@@ -1116,8 -1104,7 +1099,7 @@@ mdw-hanging-indents) (pad . 1) (match . 2) (pad . 3) (pad . 4)))) - ;; --- Now define things to be fontified --- - + ;; Now define things to be fontified. (make-local-variable 'font-lock-keywords) (let ((java-keywords (mdw-regexps "abstract" "boolean" "break" "byte" "case" "catch" @@@ -1135,15 -1122,13 +1117,13 @@@ (setq font-lock-keywords (list - ;; --- Handle the keywords defined above --- - + ;; Handle the keywords defined above. (list (concat "\\<\\(" java-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- Handle numbers too --- + ;; Handle numbers too. ;; ;; The following isn't quite right, but it's close enough. - (list (concat "\\<\\(" "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" "[0-9]+\\(\\.[0-9]*\\|\\)" @@@ -1151,14 -1136,14 +1131,14 @@@ "[lLfFdD]?") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- C# programming configuration --------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; C# programming configuration. - ;; --- Make indentation nice --- + ;; Make indentation nice. (defun mdw-csharp-style () (c-add-style "[mdw] C# style" @@@ -1171,12 -1156,11 +1151,11 @@@ (statement-case-intro . +))) t)) - ;; --- Declare C# fontification style --- + ;; Declare C# fontification style. (defun mdw-fontify-csharp () - ;; --- Other stuff --- - + ;; Other stuff. (mdw-csharp-style) (setq c-hanging-comment-ender-p nil) (setq c-backslash-column 72) @@@ -1189,8 -1173,7 +1168,7 @@@ mdw-hanging-indents) (pad . 1) (match . 2) (pad . 3) (pad . 4)))) - ;; --- Now define things to be fontified --- - + ;; Now define things to be fontified. (make-local-variable 'font-lock-keywords) (let ((csharp-keywords (mdw-regexps "abstract" "as" "base" "bool" "break" @@@ -1213,15 -1196,13 +1191,13 @@@ (setq font-lock-keywords (list - ;; --- Handle the keywords defined above --- - + ;; Handle the keywords defined above. (list (concat "\\<\\(" csharp-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- Handle numbers too --- + ;; Handle numbers too. ;; ;; The following isn't quite right, but it's close enough. - (list (concat "\\<\\(" "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" "[0-9]+\\(\\.[0-9]*\\|\\)" @@@ -1229,8 -1210,7 +1205,7 @@@ "[lLfFdD]?") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) @@@ -1242,9 -1222,10 +1217,10 @@@ (mdw-fontify-csharp) (run-hooks 'csharp-mode-hook)) - ;;;----- Awk programming configuration -------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Awk programming configuration. - ;; --- Make Awk indentation nice --- + ;; Make Awk indentation nice. (defun mdw-awk-style () (c-add-style "[mdw] Awk style" @@@ -1254,18 -1235,16 +1230,16 @@@ (statement-case-intro . +))) t)) - ;; --- Declare Awk fontification style --- + ;; Declare Awk fontification style. (defun mdw-fontify-awk () - ;; --- Miscellaneous fiddling --- - + ;; Miscellaneous fiddling. (mdw-awk-style) (setq c-backslash-column 72) (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") - ;; --- Now define things to be fontified --- - + ;; Now define things to be fontified. (make-local-variable 'font-lock-keywords) (let ((c-keywords (mdw-regexps "BEGIN" "END" "ARGC" "ARGIND" "ARGV" "CONVFMT" @@@ -1283,15 -1262,13 +1257,13 @@@ (setq font-lock-keywords (list - ;; --- Handle the keywords defined above --- - + ;; Handle the keywords defined above. (list (concat "\\<\\(" c-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- Handle numbers too --- + ;; Handle numbers too. ;; ;; The following isn't quite right, but it's close enough. - (list (concat "\\<\\(" "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" "[0-9]+\\(\\.[0-9]*\\|\\)" @@@ -1299,14 -1276,14 +1271,14 @@@ "[uUlL]*") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- Perl programming style --------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Perl programming style. - ;; --- Perl indentation style --- + ;; Perl indentation style. (setq cperl-indent-level 2) (setq cperl-continued-statement-offset 2) @@@ -1315,18 -1292,16 +1287,16 @@@ (setq cperl-brace-imaginary-offset 0) (setq cperl-label-offset 0) - ;; --- Define perl fontification style --- + ;; Define perl fontification style. (defun mdw-fontify-perl () - ;; --- Miscellaneous fiddling --- - + ;; Miscellaneous fiddling. (modify-syntax-entry ?$ "\\") (modify-syntax-entry ?$ "\\" font-lock-syntax-table) (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") - ;; --- Now define fontification things --- - + ;; Now define fontification things. (make-local-variable 'font-lock-keywords) (let ((perl-keywords (mdw-regexps "and" "cmp" "continue" "do" "else" "elsif" "eq" @@@ -1338,20 -1313,17 +1308,17 @@@ (setq font-lock-keywords (list - ;; --- Set up the keywords defined above --- - + ;; Set up the keywords defined above. (list (concat "\\<\\(" perl-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- At least numbers are simpler than C --- - + ;; At least numbers are simpler than C. (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" "\\([eE]\\([-+]\\|\\)[0-9_]+\\|\\)") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) @@@ -1370,75 -1342,59 +1337,70 @@@ strip numbers instead. (if (re-search-forward "\\(tests\\s-*=>\\s-*\\)\\w*" nil t) (replace-match (format "\\1%d" i)))))) - ;;;----- Python programming style ------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Python programming style. -;; Define Python fontification style. - -(defun mdw-fontify-python () +(defun mdw-fontify-pythonic (keywords) - ;; --- Miscellaneous fiddling --- - + ;; Miscellaneous fiddling. (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") - ;; --- Now define fontification things --- - + ;; Now define fontification things. (make-local-variable 'font-lock-keywords) - (let ((python-keywords - (mdw-regexps "and" "as" "assert" "break" "class" "continue" "def" - "del" "elif" "else" "except" "exec" "finally" "for" - "from" "global" "if" "import" "in" "is" "lambda" - "not" "or" "pass" "print" "raise" "return" "try" - "while" "with" "yield"))) - (setq font-lock-keywords - (list + (setq font-lock-keywords + (list - ;; --- Set up the keywords defined above --- - - (list (concat "\\<\\(" keywords "\\)\\>") - ;; Set up the keywords defined above. - (list (concat "\\<\\(" python-keywords "\\)\\>") - '(0 font-lock-keyword-face)) ++ ;; Set up the keywords defined above. ++ (list (concat "\\<\\(" python-keywords "\\)\\>") + '(0 font-lock-keyword-face)) - ;; --- At least numbers are simpler than C --- - - ;; At least numbers are simpler than C. - (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" - "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" - "\\([eE]\\([-+]\\|\\)[0-9_]+\\|[lL]\\|\\)") - '(0 mdw-number-face)) ++ ;; At least numbers are simpler than C. + (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" + "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" + "\\([eE]\\([-+]\\|\\)[0-9_]+\\|[lL]\\|\\)") + '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - - ;; And anything else is punctuation. - (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))))) ++ ;; And anything else is punctuation. + (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" + '(0 mdw-punct-face))))) + - ;; --- Define Python fontification style --- ++;; Define Python fontification styles. + +(defun mdw-fontify-python () + (mdw-fontify-pythonic + (mdw-regexps "and" "as" "assert" "break" "class" "continue" "def" + "del" "elif" "else" "except" "exec" "finally" "for" + "from" "global" "if" "import" "in" "is" "lambda" + "not" "or" "pass" "print" "raise" "return" "try" + "while" "with" "yield"))) + +(defun mdw-fontify-pyrex () + (mdw-fontify-pythonic + (mdw-regexps "and" "as" "assert" "break" "cdef" "class" "continue" + "ctypedef" "def" "del" "elif" "else" "except" "exec" + "extern" "finally" "for" "from" "global" "if" + "import" "in" "is" "lambda" "not" "or" "pass" "print" + "raise" "return" "struct" "try" "while" "with" + "yield"))) - ;;;----- Icon programming style --------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Icon programming style. - ;; --- Icon indentation style --- + ;; Icon indentation style. (setq icon-brace-offset 0 icon-continued-brace-offset 0 icon-continued-statement-offset 2 icon-indent-level 2) - ;; --- Define Icon fontification style --- + ;; Define Icon fontification style. (defun mdw-fontify-icon () - ;; --- Miscellaneous fiddling --- - + ;; Miscellaneous fiddling. (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") - ;; --- Now define fontification things --- - + ;; Now define fontification things. (make-local-variable 'font-lock-keywords) (let ((icon-keywords (mdw-regexps "break" "by" "case" "create" "default" "do" "else" @@@ -1452,38 -1408,34 +1414,34 @@@ (setq font-lock-keywords (list - ;; --- Set up the keywords defined above --- - + ;; Set up the keywords defined above. (list (concat "\\<\\(" icon-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- The things that Icon calls keywords --- - + ;; The things that Icon calls keywords. (list "&\\sw+\\>" '(0 font-lock-variable-name-face)) - ;; --- At least numbers are simpler than C --- - + ;; At least numbers are simpler than C. (list (concat "\\<[0-9]+" "\\([rR][0-9a-zA-Z]+\\|" "\\.[0-9]+\\([eE][+-]?[0-9]+\\)?\\)\\>\\|" "\\.[0-9]+\\([eE][+-]?[0-9]+\\)?\\>") '(0 mdw-number-face)) - ;; --- Preprocessor --- - + ;; Preprocessor. (list (concat "^[ \t]*$[ \t]*\\<\\(" preprocessor-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- ARM assembler programming configuration ---------------------------- + ;;;-------------------------------------------------------------------------- + ;;; ARM assembler programming configuration. - ;; --- There doesn't appear to be an Emacs mode for this yet --- + ;; There doesn't appear to be an Emacs mode for this yet. ;; ;; Better do something about that, I suppose. @@@ -1502,16 -1454,14 +1460,14 @@@ "Major mode for ARM assembler programs" (interactive) - ;; --- Do standard major mode things --- - + ;; Do standard major mode things. (kill-all-local-variables) (use-local-map arm-assembler-mode-map) (setq local-abbrev-table arm-assembler-abbrev-table) (setq major-mode 'arm-assembler-mode) (setq mode-name "ARM assembler") - ;; --- Set up syntax table --- - + ;; Set up syntax table. (set-syntax-table arm-assembler-mode-syntax-table) (modify-syntax-entry ?; ; Nasty hack "<" arm-assembler-mode-syntax-table) @@@ -1527,52 -1477,46 +1483,46 @@@ (make-local-variable 'comment-start-skip) (setq comment-start-skip ";+[ \t]*") - ;; --- Play with indentation --- - + ;; Play with indentation. (make-local-variable 'indent-line-function) (setq indent-line-function 'indent-relative-maybe) - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*;+[ \t]*\\)") - ;; --- Fiddle with fontification --- - + ;; Fiddle with fontification. (make-local-variable 'font-lock-keywords) (setq font-lock-keywords (list - ;; --- Handle numbers too --- + ;; Handle numbers too. ;; ;; The following isn't quite right, but it's close enough. - (list (concat "\\(" "&[0-9a-fA-F]+\\|" "\\<[0-9]+\\(\\.[0-9]*\\|_[0-9a-zA-Z]+\\|\\)" "\\)") '(0 mdw-number-face)) - ;; --- Do something about operators --- - + ;; Do something about operators. (list "^[^ \t]*[ \t]+\\(GET\\|LNK\\)[ \t]+\\([^;\n]*\\)" '(1 font-lock-keyword-face) '(2 font-lock-string-face)) (list ":[a-zA-Z]+:" '(0 font-lock-keyword-face)) - ;; --- Do menemonics and directives --- - + ;; Do menemonics and directives. (list "^[^ \t]*[ \t]+\\([a-zA-Z]+\\)" '(1 font-lock-keyword-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))) (run-hooks 'arm-assembler-mode-hook)) - ;;;----- Assembler mode ----------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Assembler mode. (defun mdw-fontify-asm () (modify-syntax-entry ?' "\"") @@@ -1580,7 -1524,8 +1530,8 @@@ (setf fill-prefix nil) (mdw-standard-fill-prefix "\\([ \t]*;+[ \t]*\\)")) - ;;;----- TCL configuration -------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; TCL configuration. (defun mdw-fontify-tcl () (mapcar #'(lambda (ch) (modify-syntax-entry ch ".")) '(?$)) @@@ -1595,7 -1540,8 +1546,8 @@@ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face))))) - ;;;----- REXX configuration ------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; REXX configuration. (defun mdw-rexx-electric-* () (interactive) @@@ -1610,8 -1556,7 +1562,7 @@@ (defun mdw-fontify-rexx () - ;; --- Various bits of fiddling --- - + ;; Various bits of fiddling. (setq mdw-auto-indent nil) (local-set-key [?\C-m] 'mdw-rexx-indent-newline-indent) (local-set-key [?*] 'mdw-rexx-electric-*) @@@ -1619,8 -1564,7 +1570,7 @@@ '(?! ?? ?# ?@ ?$)) (mdw-standard-fill-prefix "\\([ \t]*/?\*[ \t]*\\)") - ;; --- Set up keywords and things for fontification --- - + ;; Set up keywords and things for fontification. (make-local-variable 'font-lock-keywords-case-fold-search) (setq font-lock-keywords-case-fold-search t) @@@ -1656,36 -1600,31 +1606,31 @@@ (setq font-lock-keywords (list - ;; --- Set up the keywords defined above --- - + ;; Set up the keywords defined above. (list (concat "\\<\\(" rexx-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- Fontify all symbols the same way --- - + ;; Fontify all symbols the same way. (list (concat "\\<\\([0-9.][A-Za-z0-9.!?_#@$]*[Ee][+-]?[0-9]+\\|" "[A-Za-z0-9.!?_#@$]+\\)") '(0 font-lock-variable-name-face)) - ;; --- And everything else is punctuation --- - + ;; And everything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- Standard ML programming style -------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Standard ML programming style. (defun mdw-fontify-sml () - ;; --- Make underscore an honorary letter --- - + ;; Make underscore an honorary letter. (modify-syntax-entry ?' "w") - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*(\*[ \t]*\\)") - ;; --- Now define fontification things --- - + ;; Now define fontification things. (make-local-variable 'font-lock-keywords) (let ((sml-keywords (mdw-regexps "abstype" "and" "andalso" "as" @@@ -1707,13 -1646,11 +1652,11 @@@ (setq font-lock-keywords (list - ;; --- Set up the keywords defined above --- - + ;; Set up the keywords defined above. (list (concat "\\<\\(" sml-keywords "\\)\\>") '(0 font-lock-keyword-face)) - ;; --- At least numbers are simpler than C --- - + ;; At least numbers are simpler than C. (list (concat "\\<\\(\\~\\|\\)" "\\(0\\(\\([wW]\\|\\)[xX][0-9a-fA-F]+\\|" "[wW][0-9]+\\)\\|" @@@ -1722,29 -1659,26 +1665,26 @@@ "[0-9]+\\|\\)\\)\\)") '(0 mdw-number-face)) - ;; --- And anything else is punctuation --- - + ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- Haskell configuration ---------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Haskell configuration. (defun mdw-fontify-haskell () - ;; --- Fiddle with syntax table to get comments right --- - + ;; Fiddle with syntax table to get comments right. (modify-syntax-entry ?' "\"") (modify-syntax-entry ?- ". 123") (modify-syntax-entry ?{ ". 1b") (modify-syntax-entry ?} ". 4b") (modify-syntax-entry ?\n ">") - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*{?--?[ \t]*\\)") - ;; --- Fiddle with fontification --- - + ;; Fiddle with fontification. (make-local-variable 'font-lock-keywords) (let ((haskell-keywords (mdw-regexps "as" "case" "ccall" "class" "data" "default" @@@ -1766,19 -1700,18 +1706,18 @@@ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- Erlang configuration ----------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Erlang configuration. (setq erlang-electric-commannds '(erlang-electric-newline erlang-electric-semicolon)) (defun mdw-fontify-erlang () - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*{?%*[ \t]*\\)") - ;; --- Fiddle with fontification --- - + ;; Fiddle with fontification. (make-local-variable 'font-lock-keywords) (let ((erlang-keywords (mdw-regexps "after" "and" "andalso" @@@ -1801,125 -1734,108 +1740,108 @@@ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) - ;;;----- Texinfo configuration ---------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Texinfo configuration. (defun mdw-fontify-texinfo () - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*@c[ \t]+\\)") - ;; --- Real fontification things --- - + ;; Real fontification things. (make-local-variable 'font-lock-keywords) (setq font-lock-keywords (list - ;; --- Environment names are keywords --- - + ;; Environment names are keywords. (list "@\\(end\\) *\\([a-zA-Z]*\\)?" '(2 font-lock-keyword-face)) - ;; --- Unmark escaped magic characters --- - + ;; Unmark escaped magic characters. (list "\\(@\\)\\([@{}]\\)" '(1 font-lock-keyword-face) '(2 font-lock-variable-name-face)) - ;; --- Make sure we get comments properly --- - + ;; Make sure we get comments properly. (list "@c\\(\\|omment\\)\\( .*\\)?$" '(0 font-lock-comment-face)) - ;; --- Command names are keywords --- - + ;; Command names are keywords. (list "@\\([^a-zA-Z@]\\|[a-zA-Z@]*\\)" '(0 font-lock-keyword-face)) - ;; --- Fontify TeX special characters as punctuation --- - + ;; Fontify TeX special characters as punctuation. (list "[{}]+" '(0 mdw-punct-face))))) - ;;;----- TeX and LaTeX configuration ---------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; TeX and LaTeX configuration. (defun mdw-fontify-tex () (setq ispell-parser 'tex) (turn-on-reftex) - ;; --- Don't make maths into a string --- - + ;; Don't make maths into a string. (modify-syntax-entry ?$ ".") (modify-syntax-entry ?$ "." font-lock-syntax-table) (local-set-key [?$] 'self-insert-command) - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*%+[ \t]*\\)") - ;; --- Real fontification things --- - + ;; Real fontification things. (make-local-variable 'font-lock-keywords) (setq font-lock-keywords (list - ;; --- Environment names are keywords --- - + ;; Environment names are keywords. (list (concat "\\\\\\(begin\\|end\\|newenvironment\\)" "{\\([^}\n]*\\)}") '(2 font-lock-keyword-face)) - ;; --- Suspended environment names are keywords too --- - + ;; Suspended environment names are keywords too. (list (concat "\\\\\\(suspend\\|resume\\)\\(\\[[^]]*\\]\\)?" "{\\([^}\n]*\\)}") '(3 font-lock-keyword-face)) - ;; --- Command names are keywords --- - + ;; Command names are keywords. (list "\\\\\\([^a-zA-Z@]\\|[a-zA-Z@]*\\)" '(0 font-lock-keyword-face)) - ;; --- Handle @/.../ for italics --- - + ;; Handle @/.../ for italics. ;; (list "\\(@/\\)\\([^/]*\\)\\(/\\)" ;; '(1 font-lock-keyword-face) ;; '(3 font-lock-keyword-face)) - ;; --- Handle @*...* for boldness --- - + ;; Handle @*...* for boldness. ;; (list "\\(@\\*\\)\\([^*]*\\)\\(\\*\\)" ;; '(1 font-lock-keyword-face) ;; '(3 font-lock-keyword-face)) - ;; --- Handle @`...' for literal syntax things --- - + ;; Handle @`...' for literal syntax things. ;; (list "\\(@`\\)\\([^']*\\)\\('\\)" ;; '(1 font-lock-keyword-face) ;; '(3 font-lock-keyword-face)) - ;; --- Handle @<...> for nonterminals --- - + ;; Handle @<...> for nonterminals. ;; (list "\\(@<\\)\\([^>]*\\)\\(>\\)" ;; '(1 font-lock-keyword-face) ;; '(3 font-lock-keyword-face)) - ;; --- Handle other @-commands --- - + ;; Handle other @-commands. ;; (list "@\\([^a-zA-Z]\\|[a-zA-Z]*\\)" ;; '(0 font-lock-keyword-face)) - ;; --- Make sure we get comments properly --- - + ;; Make sure we get comments properly. (list "%.*" '(0 font-lock-comment-face)) - ;; --- Fontify TeX special characters as punctuation --- - + ;; Fontify TeX special characters as punctuation. (list "[$^_{}#&]" '(0 mdw-punct-face))))) - ;;;----- SGML hacking ------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; SGML hacking. (defun mdw-sgml-mode () (interactive) @@@ -1939,38 -1855,35 +1861,35 @@@ (setq mode-name "[mdw] SGML") (run-hooks 'mdw-sgml-mode-hook)) - ;;;----- Shell scripts ------------------------------------------------------ + ;;;-------------------------------------------------------------------------- + ;;; Shell scripts. (defun mdw-setup-sh-script-mode () - ;; --- Fetch the shell interpreter's name --- - + ;; Fetch the shell interpreter's name. (let ((shell-name sh-shell-file)) - ;; --- Try reading the hash-bang line --- - + ;; Try reading the hash-bang line. (save-excursion (goto-char (point-min)) (if (looking-at "#![ \t]*\\([^ \t\n]*\\)") (setq shell-name (match-string 1)))) - ;; --- Now try to set the shell --- + ;; Now try to set the shell. ;; ;; Don't let `sh-set-shell' bugger up my script. - (let ((executable-set-magic #'(lambda (s &rest r) s))) (sh-set-shell shell-name))) - ;; --- Now enable my keys and the fontification --- - + ;; Now enable my keys and the fontification. (mdw-misc-mode-config) - ;; --- Set the indentation level correctly --- - + ;; Set the indentation level correctly. (setq sh-indentation 2) (setq sh-basic-offset 2)) - ;;;----- Messages-file mode ------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Messages-file mode. (defun messages-mode-guts () (setq messages-mode-syntax-table (make-syntax-table)) @@@ -2058,7 -1971,8 +1977,8 @@@ (add-hook 'cpp-messages-mode-hook 'mdw-misc-mode-config t) ; (add-hook 'messages-file-hook 'mdw-fontify-messages t) - ;;;----- Messages-file mode ------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Messages-file mode. (defvar mallow-driver-substitution-face 'mallow-driver-substitution-face "Face to use for subsittution directives.") @@@ -2106,7 -2020,8 +2026,8 @@@ (add-hook 'mallow-driver-hook 'mdw-misc-mode-config t) - ;;;----- NFast debugs ------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; NFast debugs. (defun nfast-debug-mode () (interactive) @@@ -2146,9 -2061,10 +2067,10 @@@ (turn-on-font-lock-if-enabled) (run-hooks 'nfast-debug-mode-hook)) - ;;;----- Other languages ---------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Other languages. - ;; --- Smalltalk --- + ;; Smalltalk. (defun mdw-setup-smalltalk () (and mdw-auto-indent @@@ -2170,7 -2086,7 +2092,7 @@@ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face))))) - ;; --- Lispy languages --- + ;; Lispy languages. ;; Unpleasant bodge. (unless (boundp 'slime-repl-mode-map) @@@ -2200,12 -2116,10 +2122,10 @@@ (defun mdw-fontify-lispy () - ;; --- Set fill prefix --- - + ;; Set fill prefix. (mdw-standard-fill-prefix "\\([ \t]*;+[ \t]*\\)") - ;; --- Not much fontification needed --- - + ;; Not much fontification needed. (make-local-variable 'font-lock-keywords) (setq font-lock-keywords (list @@@ -2221,7 -2135,8 +2141,8 @@@ (defun mdw-setup-m4 () (mdw-standard-fill-prefix "\\([ \t]*\\(?:#+\\|\\\\)[ \t]*\\)")) - ;;;----- Text mode ---------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Text mode. (defun mdw-text-mode () (setq fill-column 72) @@@ -2230,7 -2145,8 +2151,8 @@@ "\\([ \t]*\\([>#|:] ?\\)*[ \t]*\\)" 3) (auto-fill-mode 1)) - ;;;----- Outline mode ------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Outline mode. (defun mdw-outline-collapse-all () "Completely collapse everything in the entire buffer." @@@ -2241,7 -2157,8 +2163,8 @@@ (hide-subtree) (forward-line)))) - ;;;----- Shell mode --------------------------------------------------------- + ;;;-------------------------------------------------------------------------- + ;;; Shell mode. (defun mdw-sh-mode-setup () (local-set-key [?\C-a] 'comint-bol)