[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e41d6a5 067/433: Allowed dynamically specified submodes.
From: |
Dmitry Gutov |
Subject: |
[elpa] master e41d6a5 067/433: Allowed dynamically specified submodes. |
Date: |
Thu, 15 Mar 2018 19:43:36 -0400 (EDT) |
branch: master
commit e41d6a5034831853234c15b3e322a54968728d0c
Author: mas <mas>
Commit: mas <mas>
Allowed dynamically specified submodes.
---
mmm-class.el | 55 +++++++++++++++++++++++++++----------------------------
1 file changed, 27 insertions(+), 28 deletions(-)
diff --git a/mmm-class.el b/mmm-class.el
index 42888a6..3d85624 100644
--- a/mmm-class.el
+++ b/mmm-class.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2000 by Michael Abraham Shulman
;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-class.el,v 1.5 2000/06/27 02:46:56 mas Exp $
+;; Version: $Id: mmm-class.el,v 1.6 2000/06/30 02:42:46 mas Exp $
;;{{{ GPL
@@ -99,21 +99,14 @@ error once all classes have been applied."
;;{{{ Apply All Classes
(defun* mmm-apply-all (&key (start (point-min)) (stop (point-max)))
- "MMM-ify START to STOP by mode/ext, `mmm-classes', and history."
+ "MMM-ify from START to STOP by all submode classes.
+The classes come from mode/ext, `mmm-classes', `mmm-global-classes',
+and interactive history."
(mmm-clear-overlays start stop 'strict)
- (mmm-apply-classes (mmm-get-all-classes) :start start :stop stop)
+ (mmm-apply-classes (mmm-get-all-classes t) :start start :stop stop)
(mmm-update-current-submode)
(mmm-refontify-maybe start stop))
-(defun mmm-refontify-maybe (start stop)
- "Re-fontify from START to STOP."
- (and (featurep 'font-lock)
- font-lock-mode
- (if (or start stop)
- (font-lock-fontify-region (or start (point-min))
- (or stop (point-max)))
- (font-lock-fontify-buffer))))
-
;;}}}
;;{{{ Scan for Regions
@@ -124,8 +117,10 @@ error once all classes have been applied."
(beg-sticky (not (number-or-marker-p front)))
(end-sticky (not (number-or-marker-p back)))
(front-offset 0) (back-offset 0) front-verify back-verify
- front-form back-form creation-hook
- &allow-other-keys)
+ front-form back-form creation-hook match-submode
+ ;insert
+ &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
@@ -144,19 +139,20 @@ the rest of the arguments are for an actual class being
applied. See
(t
(mmm-save-all
(goto-char start)
- (loop for (beg end front-form back-form) =
+ (loop for (beg end front-form back-form matched-submode) =
(apply #'mmm-match-region :start (point)
(mmm-save-keywords front back stop
save-matches front-offset back-offset front-verify
- back-verify front-form back-form))
+ back-verify front-form back-form match-submode))
while beg
while (/= beg end) ; Sanity check
do
(condition-case nil
- (mmm-make-region submode beg end :face face
- :front front-form :back back-form
- :beg-sticky beg-sticky :end-sticky end-sticky
- :creation-hook creation-hook)
+ (mmm-make-region
+ (or matched-submode submode) beg end
+ :face face :front front-form :back back-form
+ :beg-sticky beg-sticky :end-sticky end-sticky
+ :creation-hook creation-hook)
;; If our region is invalid, go back to the end of the front
;; match and continue on.
(mmm-invalid-parent (goto-char (- beg front-offset)))))))))
@@ -166,19 +162,22 @@ the rest of the arguments are for an actual class being
applied. See
(defun* mmm-match-region
(&key front back start stop front-verify back-verify front-offset
- back-offset save-matches front-form back-form)
+ back-offset save-matches front-form back-form match-submode)
"Find the first valid region between point and STOP.
-Return \(BEG END FRONT-FORM BACK-FORM) specifying the region. See
-`mmm-match-and-verify' for the valid values of FRONT and BACK
-\(markers, regexps, or functions)."
+Return \(BEG END FRONT-FORM BACK-FORM SUBMODE) specifying the
+region. See `mmm-match-and-verify' for the valid values of FRONT and
+BACK \(markers, regexps, or functions)."
(when (mmm-match-and-verify front start stop front-verify)
- (let ((beg (+ (match-end 0) front-offset))
- (front-form (mmm-get-form front-form)))
+ (let* ((beg (+ (match-end 0) front-offset))
+ (front-form (mmm-get-form front-form))
+ (submode (if match-submode
+ (mmm-save-all (funcall match-submode front-form))
+ nil)))
(when (mmm-match-and-verify (mmm-format-matches back save-matches)
beg stop back-verify)
(let ((end (+ (match-beginning 0) back-offset))
(back-form (mmm-get-form back-form)))
- (values beg end front-form back-form))))))
+ (values beg end front-form back-form submode))))))
(defun mmm-match-and-verify (pos start stop &optional verify)
"Find first match for POS between point and STOP satisfying VERIFY.
@@ -214,7 +213,7 @@ 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) (funcall form))
+ ((functionp form) (mmm-save-all (funcall form)))
((listp form) (car form))))
(defun mmm-default-get-form ()
- [elpa] master 81f8c38 082/433: (mmm-font-lock-available-p): Added flag., (continued)
- [elpa] master 81f8c38 082/433: (mmm-font-lock-available-p): Added flag., Dmitry Gutov, 2018/03/15
- [elpa] master 3a6b21e 083/433: (mmm-enable-font-lock, mmm-update-font-lock-buffer, mmm-update-mode-info):, Dmitry Gutov, 2018/03/15
- [elpa] master fcc2f71 071/433: Released 0.4.2., Dmitry Gutov, 2018/03/15
- [elpa] master 174bfd8 085/433: (mmm-mode-off): Reset font-lock variables., Dmitry Gutov, 2018/03/15
- [elpa] master 3858a4e 069/433: (mmm-mode-on-maybe): Conditioned font-lock updating on mmm-mode., Dmitry Gutov, 2018/03/15
- [elpa] master 24f432b 051/433: Released 0.4.0., Dmitry Gutov, 2018/03/15
- [elpa] master f3c157e 072/433: # Updated for 0.4.2., Dmitry Gutov, 2018/03/15
- [elpa] master 26aea58 055/433: (mmm-never-modes): Added `eshell-mode'., Dmitry Gutov, 2018/03/15
- [elpa] master bda9c32 056/433: (mmm-check-changed-buffers): Added check against minibuffers., Dmitry Gutov, 2018/03/15
- [elpa] master f290ed6 058/433: (mmm-check-changed-buffers): Checked for live buffer., Dmitry Gutov, 2018/03/15
- [elpa] master e41d6a5 067/433: Allowed dynamically specified submodes.,
Dmitry Gutov <=
- [elpa] master b47953f 078/433: (mmm-keywords-used): Added :classes., Dmitry Gutov, 2018/03/15
- [elpa] master 4d6f499 087/433: # Created file to aid developer(s)., Dmitry Gutov, 2018/03/15
- [elpa] master b5ba692 076/433: Reordered Inspection and Creation for byte compiler., Dmitry Gutov, 2018/03/15
- [elpa] master c0edb53 077/433: Released 0.4.2a., Dmitry Gutov, 2018/03/15
- [elpa] master 57ea76d 052/433: (mmm-overlays-in): Added DELIM parameter., Dmitry Gutov, 2018/03/15
- [elpa] master ef3eb61 070/433: # Did stuff, updated comments., Dmitry Gutov, 2018/03/15
- [elpa] master 877b10b 065/433: Added Embperl., Dmitry Gutov, 2018/03/15
- [elpa] master f1bfef8 048/433: Changed mmm-global-mode to use post-command-hook method rather than, Dmitry Gutov, 2018/03/15
- [elpa] master 6c74ab7 075/433: Moved mmm-mode variable to mmm-vars.el., Dmitry Gutov, 2018/03/15
- [elpa] master c608d3a 079/433: (mmm-insert-by-key): Made inserted regions beg- and end-sticky., Dmitry Gutov, 2018/03/15