diff options
| author | David Aspinall | 2009-09-05 09:43:51 +0000 |
|---|---|---|
| committer | David Aspinall | 2009-09-05 09:43:51 +0000 |
| commit | ab530f103fa791506393b45eb9ed6b3587ac1836 (patch) | |
| tree | 3730a8399b294f505d36ef51d7ac0530a7d239dc /mmm | |
| parent | 716f8469142f61b7e9b382dad82adcd63c5cfb79 (diff) | |
Tidy whitespace
Diffstat (limited to 'mmm')
| -rw-r--r-- | mmm/mmm-auto.el | 10 | ||||
| -rw-r--r-- | mmm/mmm-class.el | 162 | ||||
| -rw-r--r-- | mmm/mmm-cmds.el | 222 | ||||
| -rw-r--r-- | mmm/mmm-compat.el | 14 | ||||
| -rw-r--r-- | mmm/mmm-mason.el | 50 | ||||
| -rw-r--r-- | mmm/mmm-mode.el | 26 | ||||
| -rw-r--r-- | mmm/mmm-noweb.el | 2 | ||||
| -rw-r--r-- | mmm/mmm-region.el | 350 | ||||
| -rw-r--r-- | mmm/mmm-sample.el | 130 | ||||
| -rw-r--r-- | mmm/mmm-univ.el | 8 | ||||
| -rw-r--r-- | mmm/mmm-utils.el | 36 | ||||
| -rw-r--r-- | mmm/mmm-vars.el | 206 |
12 files changed, 608 insertions, 608 deletions
diff --git a/mmm/mmm-auto.el b/mmm/mmm-auto.el index a994eb4f..8fd59580 100644 --- a/mmm/mmm-auto.el +++ b/mmm/mmm-auto.el @@ -94,7 +94,7 @@ invoked by a public class in the same file." ;; Don't autoload already defined classes (unless (assq class mmm-classes-alist) (add-to-list 'mmm-autoloaded-classes - (list class file private)))) + (list class file private)))) ;;}}} ;;{{{ Autoload Functions @@ -148,8 +148,8 @@ everything in `mmm-major-mode-hook' will be run." (dolist (buffer mmm-changed-buffers-list) (when (buffer-live-p buffer) (save-excursion - (set-buffer buffer) - (mmm-run-major-mode-hook)))) + (set-buffer buffer) + (mmm-run-major-mode-hook)))) (setq mmm-changed-buffers-list '())) (defun mmm-mode-on-maybe () @@ -157,8 +157,8 @@ everything in `mmm-major-mode-hook' will be run." Turn on MMM Mode if `global-mmm-mode' is non-nil and there are classes to apply, or always if `global-mmm-mode' is t." (cond ((eq mmm-global-mode t) (mmm-mode-on)) - ((not mmm-global-mode)) - ((mmm-get-all-classes nil) (mmm-mode-on))) + ((not mmm-global-mode)) + ((mmm-get-all-classes nil) (mmm-mode-on))) (when mmm-mode (mmm-update-font-lock-buffer))) diff --git a/mmm/mmm-class.el b/mmm/mmm-class.el index d79cdbbf..f1078883 100644 --- a/mmm/mmm-class.el +++ b/mmm/mmm-class.el @@ -44,14 +44,14 @@ CLASS can be either a symbol to look up in `mmm-classes-alist' or a class specifier itself." (cond ((symbolp class) ; A symbol must be looked up - (or (cdr (assq class mmm-classes-alist)) - (and (cadr (assq class mmm-autoloaded-classes)) - (load (cadr (assq class mmm-autoloaded-classes))) - (cdr (assq class mmm-classes-alist))) - (signal 'mmm-invalid-submode-class (list class)))) - ((listp class) ; A list must be a class spec - class) - (t (signal 'mmm-invalid-submode-class (list class))))) + (or (cdr (assq class mmm-classes-alist)) + (and (cadr (assq class mmm-autoloaded-classes)) + (load (cadr (assq class mmm-autoloaded-classes))) + (cdr (assq class mmm-classes-alist))) + (signal 'mmm-invalid-submode-class (list class)))) + ((listp class) ; A list must be a class spec + class) + (t (signal 'mmm-invalid-submode-class (list class))))) ;;}}} ;;{{{ Get and Set Class Parameters @@ -64,9 +64,9 @@ class specifier itself." "Set the value of the parameter PARAM for CLASS to VALUE. Creates a new parameter if one is not present." (let* ((spec (mmm-get-class-spec class)) - (current (member param spec))) + (current (member param spec))) (if current - (setcar (cdr current) value) + (setcar (cdr current) value) (nconc spec (list param value))))) ;;}}} @@ -81,8 +81,8 @@ none is specified by CLASS." ;; MMM Mode without applying any classes. (unless (eq class t) (apply #'mmm-ify :start start :stop stop - (append (mmm-get-class-spec class) - (list :face face))) + (append (mmm-get-class-spec class) + (list :face face))) (mmm-run-class-hook class) ;; Hack in case class hook sets mmm-buffer-mode-display-name etc. (mmm-set-mode-line))) @@ -96,11 +96,11 @@ error once all classes have been applied." (let (invalid-classes) (dolist (class classes) (condition-case err - (mmm-apply-class class start stop face) - (mmm-invalid-submode-class - ;; Save the name of the invalid class, so we can report them - ;; all together at the end. - (add-to-list 'invalid-classes (second err))))) + (mmm-apply-class class start stop face) + (mmm-invalid-submode-class + ;; Save the name of the invalid class, so we can report them + ;; all together at the end. + (add-to-list 'invalid-classes (second err))))) (when invalid-classes (signal 'mmm-invalid-submode-class invalid-classes)))) @@ -124,33 +124,33 @@ and interactive history." (defun* mmm-ify (&rest all &key classes handler submode match-submode - (start (point-min)) (stop (point-max)) - front back save-matches (case-fold-search t) - (beg-sticky (not (number-or-marker-p front))) - (end-sticky (not (number-or-marker-p back))) - include-front include-back - (front-offset 0) (back-offset 0) + (start (point-min)) (stop (point-max)) + front back save-matches (case-fold-search t) + (beg-sticky (not (number-or-marker-p front))) + (end-sticky (not (number-or-marker-p back))) + include-front include-back + (front-offset 0) (back-offset 0) (front-delim nil) (back-delim nil) (delimiter-mode mmm-delimiter-mode) front-face back-face - front-verify back-verify - front-form back-form + front-verify back-verify + front-form back-form creation-hook - face match-face + face match-face save-name match-name (front-match 0) (back-match 0) end-not-begin - ;insert private - &allow-other-keys - ) + ;insert private + &allow-other-keys + ) "Create submode regions from START to STOP according to arguments. If CLASSES is supplied, it must be a list of valid CLASSes. Otherwise, the rest of the arguments are for an actual class being applied. See `mmm-classes-alist' for information on what they all mean." ;; Make sure we get the default values in the `all' list. (setq all (append - all - (list :start start :stop stop + all + (list :start start :stop stop :beg-sticky beg-sticky :end-sticky end-sticky :front-offset front-offset :back-offset back-offset :front-delim front-delim :back-delim back-delim @@ -171,15 +171,15 @@ the rest of the arguments are for an actual class being applied. See (mmm-save-all (goto-char start) (loop for (beg end front-pos back-pos matched-front matched-back - matched-submode matched-face matched-name - invalid-resume ok-resume) = - (apply #'mmm-match-region :start (point) all) - while beg - if end ; match-submode, if present, succeeded. - do - (condition-case nil - (progn - (mmm-make-region + matched-submode matched-face matched-name + invalid-resume ok-resume) = + (apply #'mmm-match-region :start (point) all) + while beg + if end ; match-submode, if present, succeeded. + do + (condition-case nil + (progn + (mmm-make-region (or matched-submode submode) beg end :face (or matched-face face) :front front-pos :back back-pos @@ -192,24 +192,24 @@ the rest of the arguments are for an actual class being applied. See :creation-hook creation-hook ) (goto-char ok-resume)) - ;; If our region is invalid, go back to the end of the - ;; front match and continue on. - (mmm-error (goto-char invalid-resume))) - ;; If match-submode was unable to find a match, go back to - ;; the end of the front match and continue on. - else do (goto-char invalid-resume) - ))))) + ;; If our region is invalid, go back to the end of the + ;; front match and continue on. + (mmm-error (goto-char invalid-resume))) + ;; If match-submode was unable to find a match, go back to + ;; the end of the front match and continue on. + else do (goto-char invalid-resume) + ))))) ;;}}} ;;{{{ Match Regions (defun* mmm-match-region (&key start stop front back front-verify back-verify - include-front include-back front-offset back-offset - front-form back-form save-matches match-submode match-face + include-front include-back front-offset back-offset + front-form back-form save-matches match-submode match-face front-match back-match end-not-begin save-name match-name - &allow-other-keys) + &allow-other-keys) "Find the first valid region between point and STOP. Return \(BEG END FRONT-POS BACK-POS FRONT-FORM BACK-FORM SUBMODE FACE NAME INVALID-RESUME OK-RESUME) specifying the region. See @@ -223,46 +223,46 @@ and OK-RESUME if the region is valid." (front-pos (if front-delim (mmm-match->point t front-delim front-match) nil)) - (invalid-resume (match-end front-match)) - (front-form (mmm-get-form front-form))) + (invalid-resume (match-end front-match)) + (front-form (mmm-get-form front-form))) (let ((submode (if match-submode - (condition-case nil - (mmm-save-all - (funcall match-submode front-form)) - (mmm-no-matching-submode - (return-from - mmm-match-region - (values beg nil nil nil nil nil nil nil nil - invalid-resume nil)))) - nil)) + (condition-case nil + (mmm-save-all + (funcall match-submode front-form)) + (mmm-no-matching-submode + (return-from + mmm-match-region + (values beg nil nil nil nil nil nil nil nil + invalid-resume nil)))) + nil)) (name (cond ((functionp match-name) (mmm-save-all (funcall match-name front-form))) ((stringp match-name) (if save-name (mmm-format-matches match-name) match-name)))) - (face (cond ((functionp match-face) - (mmm-save-all - (funcall match-face front-form))) - (match-face - (cdr (assoc front-form match-face)))))) - (when (mmm-match-and-verify - (if save-matches - (mmm-format-matches back) - back) - beg stop back-verify) - (let* ((end (mmm-match->point (not include-back) + (face (cond ((functionp match-face) + (mmm-save-all + (funcall match-face front-form))) + (match-face + (cdr (assoc front-form match-face)))))) + (when (mmm-match-and-verify + (if save-matches + (mmm-format-matches back) + back) + beg stop back-verify) + (let* ((end (mmm-match->point (not include-back) back-offset back-match)) (back-pos (if back-delim (mmm-match->point nil back-delim back-match) nil)) (back-form (mmm-get-form back-form)) - (ok-resume (if end-not-begin + (ok-resume (if end-not-begin (match-end back-match) end))) - (values beg end front-pos back-pos front-form back-form + (values beg end front-pos back-pos front-form back-form submode face name - invalid-resume ok-resume))))))) + invalid-resume ok-resume))))))) (defun mmm-match->point (beginp offset match) "Find a point of starting or stopping from the match data. If @@ -274,8 +274,8 @@ and move OFFSET. Handles all values of OFFSET--see `mmm-classes-alist'." (match-end back-match))) (dolist (spec (if (listp offset) offset (list offset))) (if (numberp spec) - (forward-char (or spec 0)) - (funcall spec))) + (forward-char (or spec 0)) + (funcall spec))) (point))) (defun mmm-match-and-verify (pos start stop &optional verify) @@ -296,7 +296,7 @@ unless POS is a regexp." ;; Strings are searched for as regexps. ((stringp pos) (loop always (re-search-forward pos stop 'limit) - until (or (not verify) (mmm-save-all (funcall verify))))) + until (or (not verify) (mmm-save-all (funcall verify))))) ;; Otherwise it must be a function. ((functionp pos) (funcall pos stop)))) @@ -311,9 +311,9 @@ return it. If FORM is a function, call it. If FORM is a list, return its `car' \(usually in this case, FORM is a one-element list containing a function to be used as the delimiter form." (cond ((stringp form) form) - ((not form) (mmm-default-get-form)) - ((functionp form) (mmm-save-all (funcall form))) - ((listp form) (car form)))) + ((not form) (mmm-default-get-form)) + ((functionp form) (mmm-save-all (funcall form))) + ((listp form) (car form)))) (defun mmm-default-get-form () (regexp-quote (match-string 0))) diff --git a/mmm/mmm-cmds.el b/mmm/mmm-cmds.el index c564fe89..f39da066 100644 --- a/mmm/mmm-cmds.el +++ b/mmm/mmm-cmds.el @@ -42,16 +42,16 @@ "Add submode regions according to an existing submode class." (interactive (list (intern - (completing-read - "Submode Class: " - (remove-duplicates - (mapcar #'(lambda (spec) (list (symbol-name (car spec)))) - (append - (remove-if #'(lambda (spec) (plist-get (cdr spec) :private)) - mmm-classes-alist) - (remove-if #'caddr mmm-autoloaded-classes))) - :test #'equal) - nil t)))) + (completing-read + "Submode Class: " + (remove-duplicates + (mapcar #'(lambda (spec) (list (symbol-name (car spec)))) + (append + (remove-if #'(lambda (spec) (plist-get (cdr spec) :private)) + mmm-classes-alist) + (remove-if #'caddr mmm-autoloaded-classes))) + :test #'equal) + nil t)))) (unless (eq class (intern "")) (mmm-apply-class class) (mmm-add-to-history class) @@ -65,7 +65,7 @@ (interactive "aSubmode: \nr") (mmm-ify :submode submode :front front :back back) (setq front (mmm-make-marker front t nil) - back (mmm-make-marker back nil nil)) + back (mmm-make-marker back nil nil)) (mmm-add-to-history `(:submode ,submode :front ,front :back ,back)) (mmm-enable-font-lock submode)) @@ -77,14 +77,14 @@ "Add SUBMODE regions to the buffer delimited by FRONT and BACK. With prefix argument, prompts for all additional keywords arguments. See `mmm-classes-alist'." - (interactive "aSubmode: -sFront Regexp: -nOffset from Front Regexp: -sBack Regexp: -nOffset from Back Regexp: + (interactive "aSubmode: +sFront Regexp: +nOffset from Front Regexp: +sBack Regexp: +nOffset from Back Regexp: nNumber of matched substrings to save: ") (let ((args (mmm-save-keywords submode front back front-offset - back-offset save-matches))) + back-offset save-matches))) (apply #'mmm-ify args) (mmm-add-to-history args)) (mmm-enable-font-lock submode)) @@ -132,13 +132,13 @@ delimiter auto-insertion that MMM Mode provides. See, for example, (defun mmm-get-block (lines) (let ((inhibit-point-motion-hooks t)) (list (save-excursion - (forward-line (- lines)) - (beginning-of-line) - (point)) - (save-excursion - (forward-line lines) - (end-of-line) - (point))))) + (forward-line (- lines)) + (beginning-of-line) + (point)) + (save-excursion + (forward-line lines) + (end-of-line) + (point))))) ;;}}} ;;{{{ Reparse Current Region @@ -150,14 +150,14 @@ Use this command if a submode region's boundaries have become wrong." (let ((ovl (mmm-overlay-at (point) 'all))) (when ovl (let ((beg (save-excursion - (goto-char (mmm-front-start ovl)) - (forward-line -1) - (point))) - (end (save-excursion - (goto-char (mmm-back-end ovl)) - (forward-line 1) - (point)))) - (mmm-parse-region beg end))))) + (goto-char (mmm-front-start ovl)) + (forward-line -1) + (point))) + (end (save-excursion + (goto-char (mmm-back-end ovl)) + (forward-line 1) + (point)))) + (mmm-parse-region beg end))))) ;;}}} ;;{{{ Clear Submode Regions @@ -197,22 +197,22 @@ entire job of this function." (let ((ovl (mmm-overlay-at))) (when ovl (combine-after-change-calls - (save-match-data - (save-excursion - (when (mmm-match-back ovl) - (if arg - (replace-match "") - (return-from mmm-end-current-region))))) - (let ((back (overlay-get ovl 'back))) - (cond ((stringp back) - (save-excursion - (unless arg (goto-char (overlay-end ovl))) - (save-excursion (insert back)) - (move-overlay ovl (overlay-start ovl) (point)))) - ((functionp back) - (funcall back ovl (if arg 'middle t)))))) + (save-match-data + (save-excursion + (when (mmm-match-back ovl) + (if arg + (replace-match "") + (return-from mmm-end-current-region))))) + (let ((back (overlay-get ovl 'back))) + (cond ((stringp back) + (save-excursion + (unless arg (goto-char (overlay-end ovl))) + (save-excursion (insert back)) + (move-overlay ovl (overlay-start ovl) (point)))) + ((functionp back) + (funcall back ovl (if arg 'middle t)))))) (mmm-refontify-maybe (save-excursion (forward-line -1) (point)) - (save-excursion (forward-line 1) (point)))))) + (save-excursion (forward-line 1) (point)))))) ;;}}} ;;{{{ Narrow to Region @@ -246,14 +246,14 @@ find an insert skeleton. For example, in Mason, `p' \(with appropriate prefix and modifiers) will insert a <%perl>...</%perl> region." (interactive "P") (let* ((seq (this-command-keys)) - (event (aref seq (1- (length seq)))) - (mods (event-modifiers event)) - (key (mmm-event-key event))) + (event (aref seq (1- (length seq)))) + (mods (event-modifiers event)) + (key (mmm-event-key event))) (if (subsetp mmm-insert-modifiers mods) - (mmm-insert-by-key - (append (set-difference mods mmm-insert-modifiers) - key) - arg)))) + (mmm-insert-by-key + (append (set-difference mods mmm-insert-modifiers) + key) + arg)))) (defun mmm-insert-by-key (key &optional arg) "Insert a submode region based on event KEY. @@ -268,18 +268,18 @@ MODIFIERS, the dotted list becomes simply BASIC-KEY." (multiple-value-bind (class skel str) (mmm-get-insertion-spec key) (when skel (let ((after-change-functions nil) - (old-undo buffer-undo-list) undo + (old-undo buffer-undo-list) undo ;; da: Proof General patch for compatibility with holes.el, ;; bind this variable to prevent inserting holes here. mmm-inside-insert-by-key) - ;; XEmacs' skeleton doesn't manage positions by itself, so we - ;; have to do it. - (if mmm-xemacs (setq skeleton-positions nil)) - (skeleton-proxy-new skel str arg) - (destructuring-bind (back end beg front) skeleton-positions - ;; TODO: Find a way to trap invalid-parent signals from - ;; make-region and undo the skeleton insertion. - (let ((match-submode (plist-get class :match-submode)) + ;; XEmacs' skeleton doesn't manage positions by itself, so we + ;; have to do it. + (if mmm-xemacs (setq skeleton-positions nil)) + (skeleton-proxy-new skel str arg) + (destructuring-bind (back end beg front) skeleton-positions + ;; TODO: Find a way to trap invalid-parent signals from + ;; make-region and undo the skeleton insertion. + (let ((match-submode (plist-get class :match-submode)) (match-face (plist-get class :match-face)) (match-name (plist-get class :match-name)) (front-form (regexp-quote (buffer-substring front beg))) @@ -291,13 +291,13 @@ MODIFIERS, the dotted list becomes simply BASIC-KEY." (mmm-save-all (funcall match-submode front-form)) (plist-get class :submode)))) (setq face - (cond ((functionp match-face) - (mmm-save-all - (funcall match-face front-form))) - (match-face - (cdr (assoc front-form match-face))) - (t - (plist-get class :face)))) + (cond ((functionp match-face) + (mmm-save-all + (funcall match-face front-form))) + (match-face + (cdr (assoc front-form match-face))) + (t + (plist-get class :face)))) (setq name (cond ((plist-get class :skel-name) ;; Optimize the name to the user-supplied str @@ -318,8 +318,8 @@ MODIFIERS, the dotted list becomes simply BASIC-KEY." (t ;; No, just use it as-is match-name))) - (mmm-make-region - submode beg end + (mmm-make-region + submode beg end :face face :name name :front front :back back @@ -327,17 +327,17 @@ MODIFIERS, the dotted list becomes simply BASIC-KEY." :evaporation 'front ;;; :beg-sticky (plist-get class :beg-sticky) ;;; :end-sticky (plist-get class :end-sticky) - :beg-sticky t :end-sticky t - :creation-hook (plist-get class :creation-hook)) - (mmm-enable-font-lock submode))) - ;; Now get rid of intermediate undo boundaries, so that the entire - ;; insertion can be undone as one action. This should really be - ;; skeleton's job, but it doesn't do it. - (setq undo buffer-undo-list) - (while (not (eq (cdr undo) old-undo)) - (when (eq (cadr undo) nil) - (setcdr undo (cddr undo))) - (setq undo (cdr undo))))))) + :beg-sticky t :end-sticky t + :creation-hook (plist-get class :creation-hook)) + (mmm-enable-font-lock submode))) + ;; Now get rid of intermediate undo boundaries, so that the entire + ;; insertion can be undone as one action. This should really be + ;; skeleton's job, but it doesn't do it. + (setq undo buffer-undo-list) + (while (not (eq (cdr undo) old-undo)) + (when (eq (cadr undo) nil) + (setcdr undo (cddr undo))) + (setq undo (cdr undo))))))) (defun mmm-get-insertion-spec (key &optional classlist) "Get the insertion info for KEY from all classes in CLASSLIST. @@ -346,22 +346,22 @@ found in, SKEL is the skeleton to insert, and STR is the argument. CLASSLIST defaults to the return value of `mmm-get-all-classes', including global classes." (loop for classname in (or classlist (mmm-get-all-classes t)) - for class = (mmm-get-class-spec classname) - for inserts = (plist-get class :insert) - for skel = (cddr (assoc key inserts)) - with str - ;; If SKEL is a dotted pair, it means call another key's - ;; insertion spec with an argument. - unless (consp (cdr skel)) - do (setq str (cdr skel) - skel (cddr (assoc (car skel) inserts))) - if skel return (list class skel str) - ;; If we have a group class, recurse. - if (plist-get class :classes) - if (mmm-get-insertion-spec key it) - return it - else - return nil)) + for class = (mmm-get-class-spec classname) + for inserts = (plist-get class :insert) + for skel = (cddr (assoc key inserts)) + with str + ;; If SKEL is a dotted pair, it means call another key's + ;; insertion spec with an argument. + unless (consp (cdr skel)) + do (setq str (cdr skel) + skel (cddr (assoc (car skel) inserts))) + if skel return (list class skel str) + ;; If we have a group class, recurse. + if (plist-get class :classes) + if (mmm-get-insertion-spec key it) + return it + else + return nil)) ;;}}} ;;{{{ Help on Insertion @@ -374,20 +374,20 @@ including global classes." (princ "Key Inserts\n") (princ "--- -------\n\n") (mapcar #'mmm-display-insertion-key - (mmm-get-all-insertion-keys)))) + (mmm-get-all-insertion-keys)))) (defun mmm-display-insertion-key (spec) "Print an insertion binding to standard output. SPEC should be \(KEY NAME ...) where KEY is an insertion key and NAME is a symbol naming the insertion." (let* ((str (make-string 16 ?\ )) - ;; This gets us a dotted list, because of the way insertion - ;; keys are specified. - (key (append mmm-insert-modifiers (car spec))) - (lastkey (nthcdr (max (1- (safe-length key)) 0) key))) + ;; This gets us a dotted list, because of the way insertion + ;; keys are specified. + (key (append mmm-insert-modifiers (car spec))) + (lastkey (nthcdr (max (1- (safe-length key)) 0) key))) ;; Now we make it a true list (if (consp key) - (setcdr lastkey (list (cdr lastkey))) + (setcdr lastkey (list (cdr lastkey))) (setq key (list key))) ;; Get the spacing right (store-substring str 0 @@ -404,12 +404,12 @@ Elements look like \(KEY NAME ...) where KEY is an insertion key and NAME is a symbol naming the insertion." (remove-duplicates (loop for classname in (or classlist (mmm-get-all-classes t)) - for class = (mmm-get-class-spec classname) - append (plist-get class :insert) into keys - ;; If we have a group class, recurse. - if (plist-get class :classes) - do (setq keys (append keys (mmm-get-all-insertion-keys it))) - finally return keys) + for class = (mmm-get-class-spec classname) + append (plist-get class :insert) into keys + ;; If we have a group class, recurse. + if (plist-get class :classes) + do (setq keys (append keys (mmm-get-all-insertion-keys it))) + finally return keys) :test #'equal :key #'(lambda (x) (cons (car x) (cadr x))) :from-end t)) diff --git a/mmm/mmm-compat.el b/mmm/mmm-compat.el index bb22446b..096233c6 100644 --- a/mmm/mmm-compat.el +++ b/mmm/mmm-compat.el @@ -54,20 +54,20 @@ (set keyword keyword)) ;;}}} -;;{{{ Customization (Emacs 19) +;;{{{ Customization (Emacs 19) (condition-case () (require 'custom) (error nil)) (unless (and (featurep 'custom) - (fboundp 'custom-declare-variable)) + (fboundp 'custom-declare-variable)) (defmacro defgroup (&rest args) nil) ;; da: backquote syntax updated, so not Emacs <19.29 compatible (defmacro defface (var values doc &rest args) `(make-face (quote ,var))) - (defmacro defcustom (var value doc &rest args) + (defmacro defcustom (var value doc &rest args) `(defvar ,var ,value ,doc))) ;;}}} @@ -78,12 +78,12 @@ (error nil)) (unless (and (featurep 'regexp-opt) - (fboundp 'regexp-opt)) + (fboundp 'regexp-opt)) ;; No regexp-opt; create one (defun regexp-opt (strings &optional paren) (concat (if paren "\\(" "") - (mapconcat 'regexp-quote strings "\\|") - (if paren "\\)" "")))) + (mapconcat 'regexp-quote strings "\\|") + (if paren "\\)" "")))) ;;}}} ;;{{{ Regexp-Opt (XEmacs) @@ -151,7 +151,7 @@ This makes `@' in skeletons act approximately like it does in FSF." (defvar skeleton-further-elements ()) (not (assoc '@ skeleton-further-elements)) (add-to-list 'skeleton-further-elements - '(@ ''(push (point) skeleton-positions))))) + '(@ ''(push (point) skeleton-positions))))) ;;}}} ;;{{{ Make Temp Buffers (XEmacs) diff --git a/mmm/mmm-mason.el b/mmm/mmm-mason.el index a0f57387..62f0642a 100644 --- a/mmm/mmm-mason.el +++ b/mmm/mmm-mason.el @@ -76,7 +76,7 @@ Saves the name of the tag matched.") :front "<%text>" :back "</%text>" :insert ((?t mason-<%text> nil @ "<%text>" @ "\n" - _ "\n" @ "</%text>" @))) + _ "\n" @ "</%text>" @))) (mason-doc :submode text-mode :face mmm-comment-submode-face @@ -84,29 +84,29 @@ Saves the name of the tag matched.") :back "</%doc>" :face nil :insert ((?d mason-<%doc> nil @ "<%doc>" @ "\n" - _ "\n" @ "</%doc>" @))) + _ "\n" @ "</%doc>" @))) (mason-perl :submode perl :match-face (("<%perl>" . mmm-code-submode-face) - ("<%init>" . mmm-init-submode-face) - ("<%cleanup>" . mmm-cleanup-submode-face) - ("<%once>" . mmm-init-submode-face) - ("<%filter>" . mmm-special-submode-face) - ("<%shared>" . mmm-init-submode-face)) + ("<%init>" . mmm-init-submode-face) + ("<%cleanup>" . mmm-cleanup-submode-face) + ("<%once>" . mmm-init-submode-face) + ("<%filter>" . mmm-special-submode-face) + ("<%shared>" . mmm-init-submode-face)) :front ,mmm-mason-perl-tags-regexp :back "</%~1>" :save-matches 1 :match-name "~1" :save-name 1 :insert ((?, mason-<%TAG> "Perl section: " @ "<%" str ">" @ - ";\n" _ "\n" @ "</%" str ">" @) - (?< mason-<%TAG> ?, . nil) - (?p mason-<%perl> ?, . "perl") - (?i mason-<%init> ?, . "init") - (?c mason-<%cleanup> ?, . "cleanup") - (?o mason-<%once> ?, . "once") - (?l mason-<%filter> ?, . "filter") - (?s mason-<%shared> ?, . "shared"))) + ";\n" _ "\n" @ "</%" str ">" @) + (?< mason-<%TAG> ?, . nil) + (?p mason-<%perl> ?, . "perl") + (?i mason-<%init> ?, . "init") + (?c mason-<%cleanup> ?, . "cleanup") + (?o mason-<%once> ?, . "once") + (?l mason-<%filter> ?, . "filter") + (?s mason-<%shared> ?, . "shared"))) (mason-pseudo-perl :submode perl :face mmm-declaration-submode-face @@ -114,11 +114,11 @@ Saves the name of the tag matched.") :back "</%~1>" :save-matches 1 :insert ((?. mason-pseudo-<%TAG> "Pseudo-perl section: " @ "<%" str ">" @ - "\n" _ "\n" @ "</%" str ">" @) - (?> mason-pseudo-<%TAG> ?, . nil) - (?a mason-<%args> ?. . "args") - (?f mason-<%flags> ?. . "flags") - (?r mason-<%attr> ?. . "attr"))) + "\n" _ "\n" @ "</%" str ">" @) + (?> mason-pseudo-<%TAG> ?, . nil) + (?a mason-<%args> ?. . "args") + (?f mason-<%flags> ?. . "flags") + (?r mason-<%attr> ?. . "attr"))) (mason-inline :submode perl :face mmm-output-submode-face @@ -126,29 +126,29 @@ Saves the name of the tag matched.") :front-verify mmm-mason-verify-inline :back "%>" :insert ((?% mason-<%-%> nil @ "<%" @ " " _ " " @ "%>" @) - (?5 mason-<%-%> ?% . nil))) + (?5 mason-<%-%> ?% . nil))) (mason-call :submode perl :face mmm-special-submode-face :front "<&" :back "&>" :insert ((?& mason-<&-&> nil @ "<&" @ " " _ " " @ "&>" @) - (?7 mason-<&-&> ?% . nil))) + (?7 mason-<&-&> ?% . nil))) (mason-one-line-comment :submode text-mode :face mmm-comment-submode-face :front "^%#" :back "\n" :insert ((?# mason-%-comment nil (mmm-mason-start-line) - @ "%" @ "# " _ @ '(mmm-mason-end-line) "\n" @) - (?3 mason-%-comment ?# . nil))) + @ "%" @ "# " _ @ '(mmm-mason-end-line) "\n" @) + (?3 mason-%-comment ?# . nil))) (mason-one-line :submode perl :face mmm-code-submode-face :front "^%" :back "\n" :insert ((return mason-%-line nil (mmm-mason-start-line) - @ "%" @ " " _ @ '(mmm-mason-end-line) "\n" @))))) + @ "%" @ " " _ @ '(mmm-mason-end-line) "\n" @))))) ;;}}} ;;{{{ One-line Sections diff --git a/mmm/mmm-mode.el b/mmm/mmm-mode.el index d133b831..cce9b7e2 100644 --- a/mmm/mmm-mode.el +++ b/mmm/mmm-mode.el @@ -151,9 +151,9 @@ available through M-x customize under Programming | Tools | Mmm." (c-make-styles-buffer-local t)) (mmm-update-mode-info major-mode) (setq mmm-region-saved-locals-for-dominant - (list* (list 'font-lock-cache-state nil) - (list 'font-lock-cache-position (make-marker)) - (copy-tree (cdr (assq major-mode mmm-region-saved-locals-defaults))))) + (list* (list 'font-lock-cache-state nil) + (list 'font-lock-cache-position (make-marker)) + (copy-tree (cdr (assq major-mode mmm-region-saved-locals-defaults))))) ;; Without the next line, the (make-marker) above gets replaced ;; with the starting value of nil, and all comes to naught. (mmm-set-local-variables major-mode) @@ -162,16 +162,16 @@ available through M-x customize under Programming | Tools | Mmm." (make-local-variable 'font-lock-fontify-region-function) (make-local-variable 'font-lock-beginning-of-syntax-function) (setq font-lock-fontify-region-function 'mmm-fontify-region - font-lock-beginning-of-syntax-function 'mmm-beginning-of-syntax) + font-lock-beginning-of-syntax-function 'mmm-beginning-of-syntax) (setq mmm-mode t) (condition-case err - (mmm-apply-all) + (mmm-apply-all) (mmm-error - ;; Complain, but don't die, since we want files to go ahead - ;; and be opened anyway, and the mode to go ahead and be - ;; turned on. Should we delete all previously made submode - ;; regions when we find an invalid one? - (message "%s" (error-message-string err)))) + ;; Complain, but don't die, since we want files to go ahead + ;; and be opened anyway, and the mode to go ahead and be + ;; turned on. Should we delete all previously made submode + ;; regions when we find an invalid one? + (message "%s" (error-message-string err)))) (run-hooks 'mmm-mode-hook) (mmm-run-major-hook)))) @@ -189,9 +189,9 @@ available through M-x customize under Programming | Tools | Mmm." (mmm-clear-local-variables) (mmm-update-submode-region) (setq font-lock-fontify-region-function - (get mmm-primary-mode 'mmm-fontify-region-function) - font-lock-beginning-of-syntax-function - (get mmm-primary-mode 'mmm-beginning-of-syntax-function)) + (get mmm-primary-mode 'mmm-fontify-region-function) + font-lock-beginning-of-syntax-function + (get mmm-primary-mode 'mmm-beginning-of-syntax-function)) (mmm-update-font-lock-buffer) (mmm-refontify-maybe) (setq mmm-mode nil) diff --git a/mmm/mmm-noweb.el b/mmm/mmm-noweb.el index ec0e5d3e..ce8cb611 100644 --- a/mmm/mmm-noweb.el +++ b/mmm/mmm-noweb.el @@ -7,7 +7,7 @@ ;; noweb-mode.el - edit noweb files with GNU Emacs ;; Copyright 1995 by Thorsten.Ohl @ Physik.TH-Darmstadt.de ;; with a little help from Norman Ramsey <norman@bellcore.com> -;; +;; ;;{{{ GPL diff --git a/mmm/mmm-region.el b/mmm/mmm-region.el index d1622a52..15b71886 100644 --- a/mmm/mmm-region.el +++ b/mmm/mmm-region.el @@ -149,8 +149,8 @@ attention is paid to stickiness." (defun mmm-sort-overlays (overlays) "Sort OVERLAYS in order of decreasing priority." (sort (copy-list overlays) - #'(lambda (x y) (> (or (overlay-get x 'priority) 0) - (or (overlay-get y 'priority) 0))))) + #'(lambda (x y) (> (or (overlay-get x 'priority) 0) + (or (overlay-get y 'priority) 0))))) ;;}}} ;;{{{ Current Submode @@ -188,11 +188,11 @@ have disappeared." (mmm-overlays-at pos))) (let ((ovl (mmm-overlay-at pos))) (if (eq ovl mmm-current-overlay) - nil + nil (setq mmm-previous-overlay mmm-current-overlay - mmm-previous-submode mmm-current-submode) + mmm-previous-submode mmm-current-submode) (setq mmm-current-overlay ovl - mmm-current-submode (if ovl (overlay-get ovl 'mmm-mode))) + mmm-current-submode (if ovl (overlay-get ovl 'mmm-mode))) t))) ;; This function is, I think, mostly for hacking font-lock. @@ -200,12 +200,12 @@ have disappeared." "Set the current submode to MODE and the current region to whatever region of that mode is present at POS, or nil if none." (setq mmm-previous-overlay mmm-current-overlay - mmm-previous-submode mmm-current-submode) + mmm-previous-submode mmm-current-submode) (setq mmm-current-submode mode - mmm-current-overlay - (find-if #'(lambda (ovl) - (eq (overlay-get ovl 'mmm-mode) mode)) - (mmm-overlays-at (or pos (point)) 'all)))) + mmm-current-overlay + (find-if #'(lambda (ovl) + (eq (overlay-get ovl 'mmm-mode) mode)) + (mmm-overlays-at (or pos (point)) 'all)))) (defun mmm-submode-at (&optional pos type) "Return the submode at POS \(or point), or NIL if none. @@ -308,9 +308,9 @@ Signals errors, returns `t' if no error." delimiter-mode front-face back-face display-name (match-front "") (match-back "") - (beg-sticky t) (end-sticky t) + (beg-sticky t) (end-sticky t) name creation-hook - ) + ) "Make a submode region from BEG to END of SUBMODE. BEG and END are buffer positions or markers with BEG <= END \(although @@ -424,7 +424,7 @@ with point at the start of the new region." (funcall creation-hook)) (mmm-save-changed-local-variables region-ovl submode)) (setq mmm-previous-submode submode - mmm-previous-overlay region-ovl) + mmm-previous-overlay region-ovl) (mmm-update-submode-region) region-ovl)) @@ -470,7 +470,7 @@ Does not handle delimiters. Use `mmm-make-region'." (defun mmm-clear-overlays (&optional start stop strict) "Clears all MMM overlays overlapping START and STOP. If STRICT, only clear those entirely included in that region." - (mapcar #'delete-overlay + (mapc #'delete-overlay (if strict (mmm-overlays-contained-in (or start (point-min)) (or stop (point-max))) @@ -492,78 +492,79 @@ variables are initialized from `mmm-region-saved-locals-defaults', which is set here as well. See `mmm-save-local-variables'. If FORCE is non-nil, don't quit if the info is already there." (let ((buffer-entry (assq mode mmm-buffer-saved-locals)) - (region-entry (assq mode mmm-region-saved-locals-defaults)) - global-vars buffer-vars region-vars - ;; kludge for XEmacs 20 - (html-helper-build-new-buffer nil)) + (region-entry (assq mode mmm-region-saved-locals-defaults)) + global-vars buffer-vars region-vars + ;; kludge for XEmacs 20 + (html-helper-build-new-buffer nil)) (unless (and (not force) - (get mode 'mmm-local-variables) - buffer-entry - region-entry) + (get mode 'mmm-local-variables) + buffer-entry + region-entry) (save-excursion - (let ((filename (buffer-file-name))) - ;; On errors, the temporary buffers don't get deleted, so here - ;; we get rid of any old ones that may be hanging around. - (when (buffer-live-p (get-buffer mmm-temp-buffer-name)) - (save-excursion - (set-buffer (get-buffer mmm-temp-buffer-name)) - (set-buffer-modified-p nil) - (kill-buffer (current-buffer)))) - ;; Now make a new temporary buffer. - (set-buffer (mmm-make-temp-buffer (current-buffer) - mmm-temp-buffer-name)) + (let ((filename (buffer-file-name))) + ;; On errors, the temporary buffers don't get deleted, so here + ;; we get rid of any old ones that may be hanging around. + (when (buffer-live-p (get-buffer mmm-temp-buffer-name)) + (save-excursion + (set-buffer (get-buffer mmm-temp-buffer-name)) + (set-buffer-modified-p nil) + (kill-buffer (current-buffer)))) + ;; Now make a new temporary buffer. + (set-buffer (mmm-make-temp-buffer (current-buffer) + mmm-temp-buffer-name)) ;; Handle stupid modes that need the file name set - (if (memq mode mmm-set-file-name-for-modes) - (setq buffer-file-name filename))) - (funcall mode) - (when (featurep 'font-lock) - ;; XEmacs doesn't have global-font-lock-mode (or rather, it - ;; has nothing but global-font-lock-mode). - (when (or mmm-xemacs - ;; Code copied from font-lock.el to detect when font-lock - ;; should be on via global-font-lock-mode. - (and (or font-lock-defaults - (assq major-mode font-lock-defaults-alist) - (assq major-mode font-lock-keywords-alist)) - (or (eq font-lock-global-modes t) - (if (eq (car-safe font-lock-global-modes) 'not) - (not (memq major-mode - (cdr font-lock-global-modes))) - (memq major-mode font-lock-global-modes))))) - ;; Don't actually fontify in the temp buffer, but note - ;; that we should fontify when we use this mode. - (put mode 'mmm-font-lock-mode t)) - ;; Get the font-lock variables - (when mmm-font-lock-available-p - ;; To fool `font-lock-add-keywords' - (let ((font-lock-mode t)) - (mmm-set-font-lock-defaults))) - ;; These can't be in the local variables list, because we - ;; replace their actual values, but we want to use their - ;; original values elsewhere. - (unless (and mmm-xemacs (= emacs-major-version 20)) - ;; XEmacs 20 doesn't have this variable. This effectively - ;; prevents the MMM font-lock support from working, but we - ;; just ignore it and go on, to prevent an error message. - (put mode 'mmm-fontify-region-function - font-lock-fontify-region-function)) - (put mode 'mmm-beginning-of-syntax-function - font-lock-beginning-of-syntax-function)) - ;; Get variables - (setq global-vars (mmm-get-locals 'global) - buffer-vars (mmm-get-locals 'buffer) - region-vars (mmm-get-locals 'region)) - (put mode 'mmm-mode-name mode-name) - (set-buffer-modified-p nil) - (kill-buffer (current-buffer))) + (if (memq mode mmm-set-file-name-for-modes) + (setq buffer-file-name filename))) + (funcall mode) + (when (featurep 'font-lock) + ;; XEmacs doesn't have global-font-lock-mode (or rather, it + ;; has nothing but global-font-lock-mode). + (when (or mmm-xemacs + ;; Code copied from font-lock.el to detect when font-lock + ;; should be on via global-font-lock-mode. + (and (or font-lock-defaults + (with-no-warnings + (assq major-mode font-lock-defaults-alist)) + (assq major-mode font-lock-keywords-alist)) + (or (eq font-lock-global-modes t) + (if (eq (car-safe font-lock-global-modes) 'not) + (not (memq major-mode + (cdr font-lock-global-modes))) + (memq major-mode font-lock-global-modes))))) + ;; Don't actually fontify in the temp buffer, but note + ;; that we should fontify when we use this mode. + (put mode 'mmm-font-lock-mode t)) + ;; Get the font-lock variables + (when mmm-font-lock-available-p + ;; To fool `font-lock-add-keywords' + (let ((font-lock-mode t)) + (mmm-set-font-lock-defaults))) + ;; These can't be in the local variables list, because we + ;; replace their actual values, but we want to use their + ;; original values elsewhere. + (unless (and mmm-xemacs (= emacs-major-version 20)) + ;; XEmacs 20 doesn't have this variable. This effectively + ;; prevents the MMM font-lock support from working, but we + ;; just ignore it and go on, to prevent an error message. + (put mode 'mmm-fontify-region-function + font-lock-fontify-region-function)) + (put mode 'mmm-beginning-of-syntax-function + font-lock-beginning-of-syntax-function)) + ;; Get variables + (setq global-vars (mmm-get-locals 'global) + buffer-vars (mmm-get-locals 'buffer) + region-vars (mmm-get-locals 'region)) + (put mode 'mmm-mode-name mode-name) + (set-buffer-modified-p nil) + (kill-buffer (current-buffer))) (put mode 'mmm-local-variables global-vars) (if buffer-entry - (setcdr buffer-entry buffer-vars) - (push (cons mode buffer-vars) mmm-buffer-saved-locals)) + (setcdr buffer-entry buffer-vars) + (push (cons mode buffer-vars) mmm-buffer-saved-locals)) (if region-entry - (setcdr region-entry region-vars) - (push (cons mode region-vars) - mmm-region-saved-locals-defaults))))) + (setcdr region-entry region-vars) + (push (cons mode region-vars) + mmm-region-saved-locals-defaults))))) ;;}}} ;;{{{ Updating Hooks @@ -574,7 +575,7 @@ This function and those it calls do the actual work of setting the different keymaps, syntax tables, local variables, etc. for submodes." (when (mmm-update-current-submode) (mmm-save-changed-local-variables mmm-previous-overlay - mmm-previous-submode) + mmm-previous-submode) (let ((mode (or mmm-current-submode mmm-primary-mode))) (mmm-update-mode-info mode) (mmm-set-local-variables mode) @@ -586,8 +587,7 @@ different keymaps, syntax tables, local variables, etc. for submodes." (ignore-errors (funcall func))))) (defun mmm-add-hooks () - (make-local-hook 'post-command-hook) - (add-hook 'post-command-hook 'mmm-update-submode-region nil 'local)) + (add-hook 'post-command-hook 'mmm-update-submode-region nil 'local)) (defun mmm-remove-hooks () (remove-hook 'post-command-hook 'mmm-update-submode-region 'local)) @@ -600,33 +600,33 @@ different keymaps, syntax tables, local variables, etc. for submodes." Return a list \(VAR ...). In some cases, VAR will be a cons cell \(GETTER . SETTER) -- see `mmm-save-local-variables'." (mapcan #'(lambda (element) - (and (if (and (consp element) - (cdr element) - (cadr element)) - (eq (cadr element) type) - (eq type 'global)) - (if (and (consp element) - (cddr element) - (not (eq (caddr element) t))) - (if (functionp (caddr element)) - (funcall (caddr element)) - (member mode (caddr element))) - t) - (list (if (consp element) (car element) element)))) - mmm-save-local-variables)) + (and (if (and (consp element) + (cdr element) + (cadr element)) + (eq (cadr element) type) + (eq type 'global)) + (if (and (consp element) + (cddr element) + (not (eq (caddr element) t))) + (if (functionp (caddr element)) + (funcall (caddr element)) + (member mode (caddr element))) + t) + (list (if (consp element) (car element) element)))) + mmm-save-local-variables)) (defun mmm-get-locals (type) "Get the local variables and values for TYPE from this buffer. Return \((VAR VALUE) ...). In some cases, VAR will be of the form \(GETTER . SETTER) -- see `mmm-save-local-variables'." (mapcan #'(lambda (var) - (if (consp var) - `((,var ,(funcall (car var)))) - (and (boundp var) - ;; This seems logical, but screws things up. - ;;(local-variable-p var) - `((,var ,(symbol-value var)))))) - (mmm-get-local-variables-list type major-mode))) + (if (consp var) + `((,var ,(funcall (car var)))) + (and (boundp var) + ;; This seems logical, but screws things up. + ;;(local-variable-p var) + `((,var ,(symbol-value var)))))) + (mmm-get-local-variables-list type major-mode))) (defun mmm-get-saved-local (mode var) "Get the value of the local variable VAR saved for MODE, if any." @@ -636,45 +636,45 @@ Return \((VAR VALUE) ...). In some cases, VAR will be of the form "Set all the local variables saved for MODE. Looks up both global, buffer, and region saves." (mapcar #'(lambda (var) - ;; (car VAR) may be (GETTER . SETTER) - (if (consp (car var)) - (funcall (cdar var) (cadr var)) - (make-local-variable (car var)) - (set (car var) (cadr var)))) - (mmm-get-saved-local-variables mode))) + ;; (car VAR) may be (GETTER . SETTER) + (if (consp (car var)) + (funcall (cdar var) (cadr var)) + (make-local-variable (car var)) + (set (car var) (cadr var)))) + (mmm-get-saved-local-variables mode))) (defun mmm-get-saved-local-variables (mode) (append (get mode 'mmm-local-variables) - (cdr (assq mode mmm-buffer-saved-locals)) - (let ((ovl (mmm-overlay-at (point)))) - (if ovl - (overlay-get ovl 'mmm-local-variables) - mmm-region-saved-locals-for-dominant)))) + (cdr (assq mode mmm-buffer-saved-locals)) + (let ((ovl (mmm-overlay-at (point)))) + (if ovl + (overlay-get ovl 'mmm-local-variables) + mmm-region-saved-locals-for-dominant)))) (defun mmm-save-changed-local-variables (ovl mode) "Save by-buffer and by-region variables for OVL and MODE. Called when we move to a new submode region, with OVL and MODE the region and mode for the previous position." (let ((buffer-vars (cdr (assq (or mode mmm-primary-mode) - mmm-buffer-saved-locals))) - (region-vars (if ovl - (overlay-get ovl 'mmm-local-variables) - mmm-region-saved-locals-for-dominant)) - (set-local-value - #'(lambda (var) - (setcar (cdr var) - ;; (car VAR) may be (GETTER . SETTER) - (if (consp (car var)) - (funcall (caar var)) - (symbol-value (car var))))))) + mmm-buffer-saved-locals))) + (region-vars (if ovl + (overlay-get ovl 'mmm-local-variables) + mmm-region-saved-locals-for-dominant)) + (set-local-value + #'(lambda (var) + (setcar (cdr var) + ;; (car VAR) may be (GETTER . SETTER) + (if (consp (car var)) + (funcall (caar var)) + (symbol-value (car var))))))) (mapc set-local-value buffer-vars) (mapc set-local-value region-vars))) (defun mmm-clear-local-variables () "Clear all buffer- and region-saved variables for current buffer." (setq mmm-buffer-saved-locals () - mmm-region-saved-locals-defaults () - mmm-region-saved-locals-for-dominant ())) + mmm-region-saved-locals-defaults () + mmm-region-saved-locals-for-dominant ())) ;;}}} @@ -693,22 +693,22 @@ region and mode for the previous position." "Turn on font lock iff any mode in the buffer enables it." (when mmm-font-lock-available-p (if (some #'(lambda (mode) - (get mode 'mmm-font-lock-mode)) + (get mode 'mmm-font-lock-mode)) (cons mmm-primary-mode (mapcar #'(lambda (ovl) (overlay-get ovl 'mmm-mode)) (mmm-overlays-overlapping (point-min) (point-max))))) - (font-lock-mode 1) + (font-lock-mode 1) (font-lock-mode 0)))) (defun mmm-refontify-maybe (&optional start stop) "Re-fontify from START to STOP, or entire buffer, if enabled." (and font-lock-mode (if (or start stop) - (font-lock-fontify-region (or start (point-min)) - (or stop (point-max))) - (font-lock-fontify-buffer)))) + (font-lock-fontify-region (or start (point-min)) + (or stop (point-max))) + (font-lock-fontify-buffer)))) ;;}}} ;;{{{ Get Submode Regions @@ -721,23 +721,23 @@ region and mode for the previous position." "Return a list of all submode-change positions from START to STOP. The list is sorted in order of increasing buffer position." (sort (remove-duplicates - (list* start stop - (mapcan #'(lambda (ovl) - `(,(overlay-start ovl) - ,(overlay-end ovl))) - (mmm-overlays-overlapping start stop)))) - #'<)) - -(defun mmm-regions-in (start stop) + (list* start stop + (mapcan #'(lambda (ovl) + `(,(overlay-start ovl) + ,(overlay-end ovl))) + (mmm-overlays-overlapping start stop)))) + #'<)) + +(defun mmm-regions-in (start stop &optional flag delim) "Return a list of regions of the form (MODE BEG END) whose disjoint union covers the region from START to STOP, including delimiters." - (let ((regions - (maplist #'(lambda (pos-list) - (if (cdr pos-list) - (list (or (mmm-submode-at (car pos-list) 'beg) - mmm-primary-mode) - (car pos-list) (cadr pos-list)))) - (mmm-submode-changes-in start stop)))) + (let ((regions + (maplist #'(lambda (pos-list) + (if (cdr pos-list) + (list (or (mmm-submode-at (car pos-list) 'beg) + mmm-primary-mode) + (car pos-list) (cadr pos-list)))) + (mmm-submode-changes-in start stop)))) (setcdr (last regions 2) nil) regions)) @@ -748,13 +748,13 @@ is a list of elements of the form \(BEG END). The disjoint union all of the REGIONS covers START to STOP." (let ((regions (mmm-regions-in start stop))) (mapcar #'(lambda (mode) - (cons mode - (mapcan #'(lambda (region) - (if (eq mode (car region)) - (list (cdr region)))) - regions))) - ;; All the modes - (remove-duplicates (mapcar #'car regions))))) + (cons mode + (mapcan #'(lambda (region) + (if (eq mode (car region)) + (list (cdr region)))) + regions))) + ;; All the modes + (remove-duplicates (mapcar #'car regions))))) ;;}}} ;;{{{ Fontify Regions @@ -771,9 +771,9 @@ of the REGIONS covers START to STOP." ;; I don't know why it does this, but let's undo it here. (let ((font-lock-beginning-of-syntax-function 'mmm-beginning-of-syntax)) (mapc #'(lambda (elt) - (when (get (car elt) 'mmm-font-lock-mode) - (mmm-fontify-region-list (car elt) (cdr elt)))) - (mmm-regions-alist start stop))) + (when (get (car elt) 'mmm-font-lock-mode) + (mmm-fontify-region-list (car elt) (cdr elt)))) + (mmm-regions-alist start stop))) ;; With jit-lock, this causes blips in the mode line and menus. ;; Shouldn't be necessary here, since it's in post-command-hook too. ;;(mmm-update-submode-region) @@ -783,20 +783,20 @@ of the REGIONS covers START to STOP." "Fontify REGIONS, each like \(BEG END), in mode MODE." (save-excursion (let (;(major-mode mode) - (func (get mode 'mmm-fontify-region-function))) + (func (get mode 'mmm-fontify-region-function))) (mapc #'(lambda (reg) - (goto-char (car reg)) - ;; Here we do the same sort of thing that - ;; `mmm-update-submode-region' does, but we force it - ;; to use a specific mode, and don't save anything, - ;; fontify, or change the mode line. - (mmm-set-current-submode mode) - (mmm-set-local-variables mode) - (funcall func (car reg) (cadr reg) nil) - ;; Catch changes in font-lock cache. - (mmm-save-changed-local-variables - mmm-current-overlay mmm-current-submode)) - regions)))) + (goto-char (car reg)) + ;; Here we do the same sort of thing that + ;; `mmm-update-submode-region' does, but we force it + ;; to use a specific mode, and don't save anything, + ;; fontify, or change the mode line. + (mmm-set-current-submode mode) + (mmm-set-local-variables mode) + (funcall func (car reg) (cadr reg) nil) + ;; Catch changes in font-lock cache. + (mmm-save-changed-local-variables + mmm-current-overlay mmm-current-submode)) + regions)))) ;;}}} ;;{{{ Beginning of Syntax @@ -804,11 +804,11 @@ of the REGIONS covers START to STOP." (defun mmm-beginning-of-syntax () (goto-char (let ((ovl (mmm-overlay-at (point))) - (func (get (or mmm-current-submode mmm-primary-mode) - 'mmm-beginning-of-syntax-function))) + (func (get (or mmm-current-submode mmm-primary-mode) + 'mmm-beginning-of-syntax-function))) (max (if ovl (overlay-start ovl) (point-min)) - (if func (progn (funcall func) (point)) (point-min)) - (point-min))))) + (if func (progn (funcall func) (point)) (point-min)) + (point-min))))) ;;}}} diff --git a/mmm/mmm-sample.el b/mmm/mmm-sample.el index fe327c95..daf663c4 100644 --- a/mmm/mmm-sample.el +++ b/mmm/mmm-sample.el @@ -61,7 +61,7 @@ :front "<script\[^>\]*\\(language=\"javascript\\([0-9.]*\\)\"\\|type=\"text/javascript\"\\)\[^>\]*>" :back"</script>" :insert ((?j js-tag nil @ "<script language=\"JavaScript\">" - @ "\n" _ "\n" @ "</script>" @)) + @ "\n" _ "\n" @ "</script>" @)) ) (js-inline :submode javascript @@ -96,35 +96,35 @@ and MODE is a major mode function symbol.") (or (mmm-ensure-modename ;; First try the user override variable. (some #'(lambda (pair) - (if (string-match (car pair) string) (cdr pair) nil)) - mmm-here-doc-mode-alist)) + (if (string-match (car pair) string) (cdr pair) nil)) + mmm-here-doc-mode-alist)) (let ((words (split-string (downcase string) "[_-]+"))) - (or (mmm-ensure-modename - ;; Try the whole name, stopping at "mode" if present. - (intern - (mapconcat #'identity - (nconc (ldiff words (member "mode" words)) - (list "mode")) - "-"))) - ;; Try each word by itself (preference list) - (some #'(lambda (word) - (mmm-ensure-modename (intern word))) - words) - ;; Try each word with -mode tacked on - (some #'(lambda (word) - (mmm-ensure-modename - (intern (concat word "-mode")))) - words) - ;; Try each pair of words with -mode tacked on - (loop for (one two) on words - if (mmm-ensure-modename - (intern (concat one two "-mode"))) - return it) - ;; I'm unaware of any modes whose names, minus `-mode', - ;; are more than two words long, and if the entire mode - ;; name (perhaps minus `-mode') doesn't occur in the - ;; here-document name, we can give up. - (signal 'mmm-no-matching-submode nil))))) + (or (mmm-ensure-modename + ;; Try the whole name, stopping at "mode" if present. + (intern + (mapconcat #'identity + (nconc (ldiff words (member "mode" words)) + (list "mode")) + "-"))) + ;; Try each word by itself (preference list) + (some #'(lambda (word) + (mmm-ensure-modename (intern word))) + words) + ;; Try each word with -mode tacked on + (some #'(lambda (word) + (mmm-ensure-modename + (intern (concat word "-mode")))) + words) + ;; Try each pair of words with -mode tacked on + (loop for (one two) on words + if (mmm-ensure-modename + (intern (concat one two "-mode"))) + return it) + ;; I'm unaware of any modes whose names, minus `-mode', + ;; are more than two words long, and if the entire mode + ;; name (perhaps minus `-mode') doesn't occur in the + ;; here-document name, we can give up. + (signal 'mmm-no-matching-submode nil))))) (mmm-add-classes '((here-doc @@ -135,7 +135,7 @@ and MODE is a major mode function symbol.") :delimiter-mode nil :match-submode mmm-here-doc-get-mode :insert ((?d here-doc "Here-document Name: " @ "<<" str _ "\n" - @ "\n" @ str "\n" @)) + @ "\n" @ str "\n" @)) ))) ;;}}} @@ -150,18 +150,18 @@ and MODE is a major mode function symbol.") :save-matches 1 :match-name "embperl" :match-face (("[+" . mmm-output-submode-face) - ("[-" . mmm-code-submode-face) - ("[!" . mmm-init-submode-face) - ("[*" . mmm-code-submode-face) - ("[$" . mmm-special-submode-face)) + ("[-" . mmm-code-submode-face) + ("[!" . mmm-init-submode-face) + ("[*" . mmm-code-submode-face) + ("[$" . mmm-special-submode-face)) :insert ((?p embperl "Region Type (Character): " @ "[" str - @ " " _ " " @ str "]" @) - (?+ embperl+ ?p . "+") - (?- embperl- ?p . "-") - (?! embperl! ?p . "!") - (?* embperl* ?p . "*") - (?$ embperl$ ?p . "$") - ) + @ " " _ " " @ str "]" @) + (?+ embperl+ ?p . "+") + (?- embperl- ?p . "-") + (?! embperl! ?p . "!") + (?* embperl* ?p . "*") + (?$ embperl$ ?p . "$") + ) ) (embperl-comment :submode text-mode @@ -189,8 +189,8 @@ and MODE is a major mode function symbol.") :back "_?:>" :match-name "eperl" :insert ((?p eperl-code nil @ "<:" @ " " _ " " @ ":>" @) - (?: eperl-code ?p . nil) - (?_ eperl-code_ nil @ "<:" @ " " _ " " @ "_:>" @))) + (?: eperl-code ?p . nil) + (?_ eperl-code_ nil @ "<:" @ " " _ " " @ "_:>" @))) (eperl-comment :submode text :face mmm-comment-submode-face @@ -210,24 +210,24 @@ and MODE is a major mode function symbol.") ;; buffer-local variable with markers for positions, but the trick ;; is knowing when to expire the cache. (let ((bounds - (save-excursion - (save-match-data - (goto-char (point-max)) - (backward-page) - (and (re-search-forward "^\\(.*\\)Local Variables:" nil t) - (list (match-string 1) - (progn (end-of-line) (point)) - (and (search-forward - (format "%sEnd:" (match-string 1)) - nil t) - (progn (beginning-of-line) - (point))))))))) + (save-excursion + (save-match-data + (goto-char (point-max)) + (backward-page) + (and (re-search-forward "^\\(.*\\)Local Variables:" nil t) + (list (match-string 1) + (progn (end-of-line) (point)) + (and (search-forward + (format "%sEnd:" (match-string 1)) + nil t) + (progn (beginning-of-line) + (point))))))))) (and bounds (caddr bounds) - (save-match-data - (string-match (format "^%s" (regexp-quote (car bounds))) - (match-string 0))) - (> (match-beginning 0) (cadr bounds)) - (< (match-end 0) (caddr bounds))))) + (save-match-data + (string-match (format "^%s" (regexp-quote (car bounds))) + (match-string 0))) + (> (match-beginning 0) (cadr bounds)) + (< (match-end 0) (caddr bounds))))) (defun mmm-file-variables-find-back (bound) (forward-sexp) @@ -258,14 +258,14 @@ and MODE is a major mode function symbol.") (jsp-code :submode java :match-face (("<%!" . mmm-declaration-submode-face) - ("<%=" . mmm-output-submode-face) - ("<%" . mmm-code-submode-face)) + ("<%=" . mmm-output-submode-face) + ("<%" . mmm-code-submode-face)) :front "<%[!=]?" :back "%>" :match-name "jsp" :insert ((?% jsp-code nil @ "<%" @ " " _ " " @ "%>" @) - (?! jsp-declaration nil @ "<%!" @ " " _ " " @ "%>" @) - (?= jsp-expression nil @ "<%=" @ " " _ " " @ "%>" @)) + (?! jsp-declaration nil @ "<%!" @ " " _ " " @ "%>" @) + (?= jsp-expression nil @ "<%=" @ " " _ " " @ "%>" @)) ) (jsp-directive :submode text-mode @@ -321,7 +321,7 @@ and MODE is a major mode function symbol.") :front "<\\?\\(php\\)?" :back "\\?>" :insert ((?p php-section nil @ "<?php" @ " " _ " " @ "?>" @) - (?b php-block nil @ "<?php" @ "\n" _ "\n" @ "?>" @)) + (?b php-block nil @ "<?php" @ "\n" _ "\n" @ "?>" @)) ))) ;;}}} diff --git a/mmm/mmm-univ.el b/mmm/mmm-univ.el index 7c16df20..02504383 100644 --- a/mmm/mmm-univ.el +++ b/mmm/mmm-univ.el @@ -39,17 +39,17 @@ (string-match "[a-zA-Z-]+" string) (setq string (match-string 0 string)) (let ((modestr (intern (if (string-match "mode\\'" string) - string - (concat string "-mode"))))) + string + (concat string "-mode"))))) (or (mmm-ensure-modename modestr) - (signal 'mmm-no-matching-submode nil)))) + (signal 'mmm-no-matching-submode nil)))) (mmm-add-classes `((universal :front "{%\\([a-zA-Z-]+\\)%}" :back "{%/~1%}" :insert ((?/ universal "Submode: " @ "{%" str "%}" @ "\n" _ "\n" - @ "{%/" str "%}" @)) + @ "{%/" str "%}" @)) :match-submode mmm-univ-get-mode :save-matches 1 ))) diff --git a/mmm/mmm-utils.el b/mmm/mmm-utils.el index b61e8806..bdb9704f 100644 --- a/mmm/mmm-utils.el +++ b/mmm/mmm-utils.el @@ -44,12 +44,12 @@ means not hidden, not a minibuffer, not in batch mode, and not in of `mmm-never-modes'." `(unless (or (eq (aref (buffer-name) 0) ?\ ) - (window-minibuffer-p (selected-window)) - (memq major-mode mmm-never-modes) - noninteractive - ;; Unnecessary as now hidden + (window-minibuffer-p (selected-window)) + (memq major-mode mmm-never-modes) + noninteractive + ;; Unnecessary as now hidden ;;; (equal (buffer-name) mmm-temp-buffer-name) - ) + ) ,@body)) ;;;(def-edebug-spec mmm-valid-buffer t) @@ -64,7 +64,7 @@ restrictions, and match data." `(save-excursion (save-restriction (save-match-data - ,@body)))) + ,@body)))) ;;;(def-edebug-spec mmm-save-all t) @@ -78,8 +78,8 @@ substituted for the corresponding REGEXP wherever it matches." (let ((case-fold-search nil)) (save-match-data (dolist (pair arg-pairs) - (while (string-match (car pair) string) - (setq string (replace-match (cdr pair) t t string)))))) + (while (string-match (car pair) string) + (setq string (replace-match (cdr pair) t t string)))))) string) (defun mmm-format-matches (string &optional on-string) @@ -91,11 +91,11 @@ ON-STRING, if supplied, means to use the match data from a `string-match' on that string, rather than the global match data." (when (stringp string) (let ((old-data (match-data)) - subexp) + subexp) (save-match-data - (while (string-match "~\\([0-9]\\)" string) - (setq subexp (string-to-number (match-string-no-properties 1 string)) - string (replace-match + (while (string-match "~\\([0-9]\\)" string) + (setq subexp (string-to-number (match-string-no-properties 1 string)) + string (replace-match (save-match-data (set-match-data old-data) (match-string-no-properties subexp on-string)) @@ -120,8 +120,8 @@ Use of this macro can make code more readable when there are a lot of PARAMS, but less readable when there are only a few. Also best used only when it is important that nil values disappear." `(append ,@(mapcar #'(lambda (param) - (macroexpand `(mmm-save-keyword ,param))) - params))) + (macroexpand `(mmm-save-keyword ,param))) + params))) ;;}}} ;;{{{ Looking Back At @@ -134,10 +134,10 @@ back that that many characters before point. Otherwise, it defaults to string." (eq (point) (save-excursion - (and (re-search-backward regexp - (- (point) (or bound (length regexp))) - t) - (match-end 0))))) + (and (re-search-backward regexp + (- (point) (or bound (length regexp))) + t) + (match-end 0))))) ;;}}} ;;{{{ Markers diff --git a/mmm/mmm-vars.el b/mmm/mmm-vars.el index 7130e58b..80e92ef2 100644 --- a/mmm/mmm-vars.el +++ b/mmm/mmm-vars.el @@ -107,7 +107,7 @@ '(c-mode c++-mode objc-mode pike-mode java-mode jde-mode javascript-mode php-mode)) -(defvar mmm-save-local-variables +(defvar mmm-save-local-variables `(;; Don't use `function' (#') here!! We're already inside `quote'! major-mode comment-start @@ -119,9 +119,9 @@ comment-line-break-function sentence-end ,@(when mmm-xemacs - '(mode-popup-menu - (((lambda () current-menubar) . set-buffer-menubar)) - )) + '(mode-popup-menu + (((lambda () current-menubar) . set-buffer-menubar)) + )) font-lock-keywords font-lock-keywords-only font-lock-keywords-case-fold-search @@ -145,12 +145,12 @@ ,@(mapcar #'(lambda (var) (list var nil mmm-c-derived-modes)) '(c++-template-syntax-table - c-<-op-cont-regexp - c->-op-cont-regexp + c-<-op-cont-regexp + c->-op-cont-regexp c-after-suffixed-type-decl-key c-after-suffixed-type-maybe-decl-key c-any-class-key - c-any-class-key + c-any-class-key c-asm-stmt-kwds c-assignment-op-regexp c-backslash-column @@ -159,27 +159,27 @@ c-block-comment-prefix c-block-decls-with-vars c-block-stmt-1-key - c-block-stmt-1-key + c-block-stmt-1-key c-block-stmt-1-kwds c-block-stmt-2-key - c-block-stmt-2-key + c-block-stmt-2-key c-block-stmt-2-kwds - c-brace-list-key - c-cast-parens + c-brace-list-key + c-cast-parens + c-class-key c-class-key - c-class-key c-class-kwds c-cleanup-list - c-colon-type-list-re + c-colon-type-list-re c-comment-only-line-offset c-comment-prefix-regexp c-comment-start-regexp - c-comment-start-regexp + c-comment-start-regexp c-cpp-defined-fns c-current-comment-prefix c-decl-block-key - c-decl-block-key - c-decl-prefix-re + c-decl-block-key + c-decl-prefix-re c-decl-spec-kwds c-doc-comment-start-regexp c-expr-kwds @@ -190,9 +190,9 @@ c-hanging-comment-ender-p c-hanging-comment-starter-p c-hanging-semi\&comma-criteria - c-identifier-key + c-identifier-key c-identifier-last-sym-match - c-identifier-start + c-identifier-start c-identifier-syntax-modifications c-identifier-syntax-table c-in-comment-lc-prefix @@ -204,89 +204,89 @@ c-keywords c-keywords-obarray c-keywords-regexp - c-keywords-regexp + c-keywords-regexp c-known-type-key c-label-key - c-label-key + c-label-key c-label-kwds c-label-kwds-regexp - c-label-kwds-regexp + c-label-kwds-regexp c-label-minimum-indentation c-lambda-kwds - c-literal-start-regexp - c-nonsymbol-chars + c-literal-start-regexp + c-nonsymbol-chars c-nonsymbol-token-regexp c-not-decl-init-keywords c-offsets-alist - c-opt-<>-arglist-start + c-opt-<>-arglist-start c-opt-<>-arglist-start-in-paren - c-opt-<>-sexp-key + c-opt-<>-sexp-key c-opt-access-key - c-opt-access-key + c-opt-access-key + c-opt-asm-stmt-key c-opt-asm-stmt-key - c-opt-asm-stmt-key c-opt-bitfield-key - c-opt-bitfield-key + c-opt-bitfield-key c-opt-block-decls-with-vars-key c-opt-block-stmt-key - c-opt-block-stmt-key - c-opt-cpp-prefix - c-opt-cpp-start + c-opt-block-stmt-key + c-opt-cpp-prefix + c-opt-cpp-start c-opt-decl-spec-key c-opt-friend-key - c-opt-friend-key + c-opt-friend-key c-opt-identifier-concat-key c-opt-inexpr-block-key - c-opt-inexpr-block-key + c-opt-inexpr-block-key c-opt-inexpr-brace-list-key c-opt-inexpr-class-key - c-opt-inexpr-class-key + c-opt-inexpr-class-key + c-opt-lambda-key c-opt-lambda-key - c-opt-lambda-key c-opt-method-key - c-opt-method-key + c-opt-method-key c-opt-postfix-decl-spec-key c-opt-type-component-key - c-opt-type-concat-key - c-opt-type-modifier-key - c-opt-type-suffix-key + c-opt-type-concat-key + c-opt-type-modifier-key + c-opt-type-suffix-key + c-other-decl-block-key c-other-decl-block-key - c-other-decl-block-key c-other-decl-block-kwds c-other-decl-kwds c-overloadable-operators-regexp - c-paragraph-separate - c-paragraph-start - c-paren-stmt-key - c-primary-expr-regexp - c-primitive-type-key + c-paragraph-separate + c-paragraph-start + c-paren-stmt-key + c-primary-expr-regexp + c-primitive-type-key c-primitive-type-kwds c-protection-kwds - c-recognize-<>-arglists + c-recognize-<>-arglists + c-recognize-knr-p c-recognize-knr-p - c-recognize-knr-p - c-recognize-paren-inits + c-recognize-paren-inits c-recognize-typeless-decls c-regular-keywords-regexp - c-simple-stmt-key + c-simple-stmt-key c-simple-stmt-kwds c-special-brace-lists - c-special-brace-lists - c-specifier-key + c-special-brace-lists + c-specifier-key c-specifier-kwds - c-stmt-delim-chars + c-stmt-delim-chars c-stmt-delim-chars-with-comma c-symbol-key - c-symbol-key - c-symbol-start + c-symbol-key + c-symbol-start c-syntactic-eol - c-syntactic-ws-end - c-syntactic-ws-start - c-type-decl-prefix-key - c-type-decl-suffix-key - c-type-prefix-key - comment-end - comment-start + c-syntactic-ws-end + c-syntactic-ws-start + c-type-decl-prefix-key + c-type-decl-suffix-key + c-type-prefix-key + comment-end + comment-start comment-start-skip)) ;; Skeleton insertion skeleton-transformation @@ -375,8 +375,8 @@ of coloring respectively. specify a face." :group 'mmm-faces :type '(choice (const :tag "None" 0) - (const :tag "Low" 1) - (const :tag "High" 2))) + (const :tag "Low" 1) + (const :tag "High" 2))) (defface mmm-init-submode-face '((t (:background "Pink"))) "Face used for submodes containing initialization code." @@ -503,8 +503,8 @@ and EXT, but no classes are activated. See `mmm-global-mode'." :group 'mmm :type '(repeat (list (symbol :tag "Major Mode") - (string :tag "Filename Regexp") - (symbol :tag "Class"))) + (string :tag "Filename Regexp") + (symbol :tag "Class"))) :require 'mmm-mode) (defun mmm-add-mode-ext-class (mode ext class) @@ -530,9 +530,9 @@ for submodes of LANGUAGE. The last element of MODES should be a mode which will always be available." :group 'mmm :type '(repeat (cons symbol - (repeat - (restricted-sexp :match-alternatives - (fboundp)))))) + (repeat + (restricted-sexp :match-alternatives + (fboundp)))))) (defun mmm-add-to-major-mode-preferences (language mode &optional default) "Set the preferred major mode for LANGUAGE to MODE. @@ -543,10 +543,10 @@ may be used by packages to ensure that some mode is present, but not override any user-specified mode." (let ((pair (assq language mmm-major-mode-preferences))) (if pair - ;; Existing mode preferences - (if default - (setcdr pair (cons mode (cdr pair))) - (setcdr pair (append (cdr pair) (list mode)))) + ;; Existing mode preferences + (if default + (setcdr pair (cons mode (cdr pair))) + (setcdr pair (append (cdr pair) (list mode)))) ;; No existing mode preference (add-to-list 'mmm-major-mode-preferences (list language mode))))) @@ -555,7 +555,7 @@ override any user-specified mode." Valid submode names are either `fboundp' or present as the `car' of an element in `mmm-major-mode-preferences'." (if (or (fboundp symbol) - (assq symbol mmm-major-mode-preferences)) + (assq symbol mmm-major-mode-preferences)) symbol nil)) @@ -567,8 +567,8 @@ first `fboundp' element of the `cdr' is returned, or nil if none." (if (fboundp mode) mode (car (remove-if-not - #'fboundp - (cdr (assq mode mmm-major-mode-preferences)))))) + #'fboundp + (cdr (assq mode mmm-major-mode-preferences)))))) ;;}}} ;;{{{ Delimiter Regions @@ -630,7 +630,7 @@ to. This variable must be set before MMM Mode is loaded." (defun mmm-use-old-command-keys () "Use the old command keys \(no control modifer) in MMM Mode." (setq mmm-command-modifiers '() - mmm-insert-modifiers '(control))) + mmm-insert-modifiers '(control))) ;;}}} ;;{{{ MMM Hooks @@ -659,8 +659,8 @@ applied in a buffer." "Run the hook named `mmm-<BODY>-<SUFFIX>-hook', if it exists. If SUFFIX is nil or unsupplied, run `mmm-<BODY>-hook' instead." (let ((hook (intern-soft (if suffix - (format "mmm-%s-%s-hook" body suffix) - (format "mmm-%s-hook" body))))) + (format "mmm-%s-%s-hook" body suffix) + (format "mmm-%s-hook" body))))) (if hook (run-hooks hook)))) (defun mmm-run-major-hook () @@ -731,8 +731,8 @@ an existing buffer." `mmm-mode-ext-classes-alist' for more information." :group 'mmm :type '(choice (const :tag "Always" t) - (const :tag "Never" nil) - (other :tag "Maybe" maybe)) + (const :tag "Never" nil) + (other :tag "Maybe" maybe)) :require 'mmm-mode) ;; These are not traditional editing modes, so mmm makes no sense, and @@ -949,19 +949,19 @@ and is not for the user to see.") "Add CLASSES and a \"grouping class\" named GROUP which calls them all. The CLASSES are all made private, i.e. non-user-visible." (mmm-add-classes (mapcar #'(lambda (class) - (append class - '(:private t))) - classes)) + (append class + '(:private t))) + classes)) (add-to-list 'mmm-classes-alist - (list group :classes (mapcar #'first classes)))) + (list group :classes (mapcar #'first classes)))) (defun mmm-add-to-group (group classes) "Add CLASSES to the \"grouping class\" named GROUP. The CLASSES are all made private, i.e. non-user-visible." (mmm-add-classes (mapcar #'(lambda (class) - (append class - '(:private t))) - classes)) + (append class + '(:private t))) + classes)) (mmm-set-class-parameter group :classes (append (mmm-get-class-parameter group :classes) (mapcar #'first classes)))) @@ -1012,9 +1012,9 @@ Set automatically from `mmm-mode-ext-classes-alist'.") Uses `mmm-mode-ext-classes-alist' to find submode classes." (or mmm-mode-ext-classes (setq mmm-mode-ext-classes - (mapcar #'third - (remove-if-not #'mmm-mode-ext-applies - mmm-mode-ext-classes-alist))))) + (mapcar #'third + (remove-if-not #'mmm-mode-ext-applies + mmm-mode-ext-classes-alist))))) (defun mmm-clear-mode-ext-classes () "Clear classes added by major mode and filename." @@ -1023,25 +1023,25 @@ Uses `mmm-mode-ext-classes-alist' to find submode classes." (defun mmm-mode-ext-applies (element) (destructuring-bind (mode ext class) element (and (if mode - (eq mode - ;; If MMM is on in this buffer, use the primary mode, - ;; otherwise use the normal indicator. - (or mmm-primary-mode major-mode)) - t) - (if ext - (and (buffer-file-name) - (save-match-data - (string-match ext (buffer-file-name)))) - t)))) + (eq mode + ;; If MMM is on in this buffer, use the primary mode, + ;; otherwise use the normal indicator. + (or mmm-primary-mode major-mode)) + t) + (if ext + (and (buffer-file-name) + (save-match-data + (string-match ext (buffer-file-name)))) + t)))) (defun mmm-get-all-classes (global) "Return a list of all classes applicable to the current buffer. These come from mode/ext associations, `mmm-classes', and interactive history, as well as `mmm-global-classes' if GLOBAL is non-nil." (append mmm-interactive-history - (if (listp mmm-classes) mmm-classes (list mmm-classes)) - (if global mmm-global-classes ()) - (mmm-get-mode-ext-classes))) + (if (listp mmm-classes) mmm-classes (list mmm-classes)) + (if global mmm-global-classes ()) + (mmm-get-mode-ext-classes))) ;;}}} |
