[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 15c766d 216/433: * mmm-vars.el (mmm-classes-alist): Docume
From: |
Dmitry Gutov |
Subject: |
[elpa] master 15c766d 216/433: * mmm-vars.el (mmm-classes-alist): Document new keywords. |
Date: |
Thu, 15 Mar 2018 19:44:04 -0400 (EDT) |
branch: master
commit 15c766d75ef912bce262d7349a18cc27bc65f95d
Author: alanshutko <alanshutko>
Commit: alanshutko <alanshutko>
* mmm-vars.el (mmm-classes-alist): Document new keywords.
* mmm.texinfo (Region Placement): Document the front-match,
back-match and end-not-begin keywords.
* mmm-class.el (mmm-match-region, mmm-ify): Add front-match &
back-match keywords to specify which submatch to treat as the
delimiter. Add end-not-begin key.
(mmm-match->point): Add front-match and back-match args.
---
ChangeLog | 12 ++++++++++++
mmm-class.el | 42 +++++++++++++++++++++++++++---------------
mmm-vars.el | 10 +++++++++-
mmm.texinfo | 8 ++++++++
version.texi | 2 +-
5 files changed, 57 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 736658b..87931bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-02-18 Alan Shutko <address@hidden>
+
+ * mmm-vars.el (mmm-classes-alist): Document new keywords.
+
+ * mmm.texinfo (Region Placement): Document the front-match,
+ back-match and end-not-begin keywords.
+
+ * mmm-class.el (mmm-match-region, mmm-ify): Add front-match &
+ back-match keywords to specify which submatch to treat as the
+ delimiter. Add end-not-begin key.
+ (mmm-match->point): Add front-match and back-match args.
+
2001-02-12 Alan Shutko <address@hidden>
* mmm-mason.el (mmm-mason-end-line,mmm-mason-start-line): Use bolp
diff --git a/mmm-class.el b/mmm-class.el
index de76843..8ed79c6 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.14 2001/01/14 01:26:09 mas Exp $
+;; Version: $Id: mmm-class.el,v 1.15 2001/02/19 03:18:16 alanshutko Exp $
;;{{{ GPL
@@ -126,6 +126,9 @@ and interactive history."
front-verify back-verify
front-form back-form creation-hook
match-submode match-face
+ (front-match 0)
+ (back-match 0)
+ end-not-begin
;insert
&allow-other-keys
)
@@ -138,7 +141,9 @@ the rest of the arguments are for an actual class being
applied. See
all
(list :start start :stop stop :beg-sticky beg-sticky
:end-sticky end-sticky :front-offset front-offset
- :back-offset back-offset)))
+ :back-offset back-offset
+ :front-match 0
+ :back-match 0)))
(cond
;; If we have a class list, apply them all.
(classes
@@ -154,7 +159,7 @@ the rest of the arguments are for an actual class being
applied. See
(mmm-save-all
(goto-char start)
(loop for (beg end matched-front matched-back
- matched-submode matched-face back-to) =
+ matched-submode matched-face back-to resume-at) =
(apply #'mmm-match-region :start (point) all)
while beg
while (or (not end) (/= beg end)) ; Sanity check
@@ -164,7 +169,7 @@ the rest of the arguments are for an actual class being
applied. See
(apply #'mmm-make-region (or matched-submode submode)
beg end :front matched-front :back matched-back
:face (or matched-face face) all)
- (goto-char end))
+ (goto-char resume-at))
;; If our region is invalid, go back to the end of the
;; front match and continue on.
(mmm-invalid-parent (goto-char back-to)))
@@ -180,6 +185,7 @@ the rest of the arguments are for an actual class being
applied. See
(&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
+ front-match back-match end-not-begin
&allow-other-keys)
"Find the first valid region between point and STOP.
Return \(BEG END FRONT-FORM BACK-FORM SUBMODE FACE BACK-TO) specifying
@@ -188,8 +194,9 @@ and BACK \(markers, regexps, or functions). A nil value
for END means
that MATCH-SUBMODE failed to find a valid submode. BACK-TO is the
point at which the search should continue if the region is invalid."
(when (mmm-match-and-verify front start stop front-verify)
- (let ((beg (mmm-match->point include-front front-offset))
- (back-to (match-end 0))
+ (let ((beg (mmm-match->point include-front front-offset
+ front-match back-match))
+ (back-to (match-end front-match))
(front-form (mmm-get-form front-form)))
(let ((submode (if match-submode
(condition-case nil
@@ -210,16 +217,21 @@ point at which the search should continue if the region
is invalid."
(mmm-format-matches back)
back)
beg stop back-verify)
- (let ((end (mmm-match->point (not include-back) back-offset))
- (back-form (mmm-get-form back-form)))
- (values beg end front-form back-form submode face back-to)))))))
-
-(defun mmm-match->point (beginp offset)
- "Find a point of starting or stopping from the match data.
-If BEGINP, start at \(match-beginning 0), else \(match-end 0), and
-move OFFSET. Handles all values for OFFSET--see `mmm-classes-alist'."
+ (let* ((end (mmm-match->point (not include-back) back-offset
+ front-match back-match))
+ (back-form (mmm-get-form back-form))
+ (resume-at (if end-not-begin
+ (match-end back-match)
+ end)))
+ (values beg end front-form back-form submode face back-to
resume-at)))))))
+
+(defun mmm-match->point (beginp offset front-match back-match)
+ "Find a point of starting or stopping from the match data. If
+BEGINP, start at \(match-beginning FRONT-MATCH), else \(match-end
+BACK-MATCH), and move OFFSET. Handles all values for OFFSET--see
+`mmm-classes-alist'."
(save-excursion
- (goto-char (if beginp (match-beginning 0) (match-end 0)))
+ (goto-char (if beginp (match-beginning front-match) (match-end
back-match)))
(dolist (spec (if (listp offset) offset (list offset)))
(if (numberp spec)
(forward-char (or spec 0))
diff --git a/mmm-vars.el b/mmm-vars.el
index 3b8368a..8542681 100644
--- a/mmm-vars.el
+++ b/mmm-vars.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2000 by Michael Abraham Shulman
;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-vars.el,v 1.44 2001/02/10 06:18:16 viritrilbia Exp $
+;; Version: $Id: mmm-vars.el,v 1.45 2001/02/19 03:18:16 alanshutko Exp $
;;{{{ GPL
@@ -599,6 +599,11 @@ for BACK \(the search starts at the beginning of the
submode region),
save that the beginning of its match \(or the end, if INCLUDE-BACK is
non-nil) becomes the end of the submode region, plus BACK-OFFSET.
+FRONT-MATCH and BACK-MATCH default to zero. They specify which
+sub-match of the FRONT and BACK regexps to treat as the delimiter.
+This number will be passed to any calls to `match-beginning' and
+company.
+
FRONT- and BACK-OFFSET default to 0. In addition to numbers, they can
also be functions to call which should move point to the correct
position for the beginning or end of the submode region. Common
@@ -653,6 +658,9 @@ should go, and the symbol `@' in four different places: at
the
beginning of the front delimiter, the beginning of the submode region,
the end of the submode region, and the end of the back delimiter.
+If END-NOT-BEGIN is non-nil, it specifies that a BACK delimiter cannot
+begin a new submode region.
+
PRIVATE, if supplied and non-nil, means that this class is a private
or internal class, usually one invoked by another class via :classes,
and is not for the user to see.")
diff --git a/mmm.texinfo b/mmm.texinfo
index 3ed400b..2a8ff60 100644
--- a/mmm.texinfo
+++ b/mmm.texinfo
@@ -1578,6 +1578,12 @@ matching the @code{:front} (respectively, @code{:back})
regular
expression. In other words, these keywords specify whether or not the
delimiter strings are @emph{included} in the submode region.
+When @code{:front} and @code{:back} are regexps, the delimiter is
+normally considered to be the entire matched region. This can be
+changed using the @code{:front-match} and @code{:back-match}
+keywords. The values of the keywords is a number specifying the
+submatch. This defaults to zero (specifying the whole regexp).
+
Two more keywords which affect the placement of the region
@code{:front-offset} and @code{:back-offset}, which both take integers
as arguments. The argument of @code{:front-offset} (respectively,
@@ -1612,6 +1618,8 @@ beginning of the next line), and begin the submode region
there. This
coincides with the normal behavior of here-documents: they begin on the
following line and go until the ending flag.
+If the @code{:back} should not be able to start a new submode region,
+set the @code{:end-not-begin} keyword to non-nil.
@node Submode Groups, Calculated Submodes, Region Placement, Writing Classes
@comment node-name, next, previous, up
diff --git a/version.texi b/version.texi
index 88866f9..a682f10 100644
--- a/version.texi
+++ b/version.texi
@@ -1,3 +1,3 @@
address@hidden UPDATED 15 January 2001
address@hidden UPDATED 8 February 2001
@set EDITION 0.4.6
@set VERSION 0.4.6
- [elpa] master 1742b06 362/433: Add mmm-erb.el to lisp_LISP, (continued)
- [elpa] master 1742b06 362/433: Add mmm-erb.el to lisp_LISP, Dmitry Gutov, 2018/03/15
- [elpa] master 4eeeef0 371/433: Add first test ever, Dmitry Gutov, 2018/03/15
- [elpa] master 0d4108b 345/433: Make README more up-to-date, Dmitry Gutov, 2018/03/15
- [elpa] master f261642 398/433: Merge pull request #50 from syohex/fix-invalid-function-call, Dmitry Gutov, 2018/03/15
- [elpa] master 4085494 402/433: Release 0.5.4, Dmitry Gutov, 2018/03/15
- [elpa] master 99539e8 340/433: Rewrite mmm-regions-alist for performance, Dmitry Gutov, 2018/03/15
- [elpa] master 4f79b74 373/433: Add two failing tests, Dmitry Gutov, 2018/03/15
- [elpa] master bdc7d47 273/433: (html-js): Support JS version in language attribute., Dmitry Gutov, 2018/03/15
- [elpa] master f926613 206/433: # Applied patch from Alan Shutko <address@hidden>., Dmitry Gutov, 2018/03/15
- [elpa] master c68cee0 411/433: Merge pull request #73 from AdamNiederer/master, Dmitry Gutov, 2018/03/15
- [elpa] master 15c766d 216/433: * mmm-vars.el (mmm-classes-alist): Document new keywords.,
Dmitry Gutov <=
- [elpa] master 6e50485 268/433: Added html-php submode class., Dmitry Gutov, 2018/03/15
- [elpa] master c6a30e3 251/433: Trimmed ancient docstring., Dmitry Gutov, 2018/03/15
- [elpa] master 30811bc 249/433: Added new files to be byte-compiled (Joe Kelsey), Dmitry Gutov, 2018/03/15
- [elpa] master 7b783ee 308/433: Don't confuse script tags with EJS tags, Dmitry Gutov, 2018/03/15
- [elpa] master 00c99c7 278/433: (lisp_LISP): Added mmm-myghty.el., Dmitry Gutov, 2018/03/15
- [elpa] master ad24c9d 275/433: * mmm-noweb.el (mmm-syntax-region-list), Dmitry Gutov, 2018/03/15
- [elpa] master a27d7af 329/433: Allow toggling whitespace-mode after initialization, Dmitry Gutov, 2018/03/15
- [elpa] master ce3cb79 367/433: * mmm-update-mode-info: bind `buffer-file-truename' to nil, Dmitry Gutov, 2018/03/15
- [elpa] master 37f6dea 396/433: mmm-indent-line: Use primary mode if submode ends right here, Dmitry Gutov, 2018/03/15
- [elpa] master 1b9406d 361/433: Released 0.5.0, Dmitry Gutov, 2018/03/15