[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7422b45 341/433: * mmm-regions-in: Keep overlay references
From: |
Dmitry Gutov |
Subject: |
[elpa] master 7422b45 341/433: * mmm-regions-in: Keep overlay references in the return value |
Date: |
Thu, 15 Mar 2018 19:44:32 -0400 (EDT) |
branch: master
commit 7422b45d32e1aa75785f3dd40206f68d4a127fd7
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
* mmm-regions-in: Keep overlay references in the return value
* mmm-fontify-region-list, mmm-syntax-propertize-function: Use them.
* mmm-erb-scan-region: Same.
* mmm-submode-overlay-at: Remove, not used anymore.
And bump the version, this is a change in the API.
Hopefuly, a relatively safe one.
---
mmm-erb.el | 4 ++--
mmm-mode.el | 2 +-
mmm-region.el | 29 ++++++++++++-----------------
3 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/mmm-erb.el b/mmm-erb.el
index f563a5a..f7dd566 100644
--- a/mmm-erb.el
+++ b/mmm-erb.el
@@ -214,12 +214,12 @@
(defun mmm-erb-scan-region (region)
(when region ; Can be nil if a line is empty, for example.
- (destructuring-bind (submode beg end) region
+ (destructuring-bind (submode beg end ovl) region
(let ((scan-fn (plist-get '(ruby-mode mmm-erb-scan-erb
js-mode mmm-erb-scan-ejs)
submode)))
(and scan-fn
- (overlay-get (mmm-overlay-at beg) 'mmm-special-tag)
+ (overlay-get ovl 'mmm-special-tag)
(save-excursion
(goto-char beg)
(skip-syntax-forward "-")
diff --git a/mmm-mode.el b/mmm-mode.el
index 26984d0..296e7c2 100644
--- a/mmm-mode.el
+++ b/mmm-mode.el
@@ -6,7 +6,7 @@
;; Package: mmm-mode
;; Author: Michael Abraham Shulman <address@hidden>
;; Keywords: convenience, faces, languages, tools
-;; Version: 0.4.8
+;; Version: 0.5.0
;; Revision: $Id: mmm-mode.el,v 1.17 2004/06/16 14:14:18 alanshutko Exp $
diff --git a/mmm-region.el b/mmm-region.el
index 04ba779..ae7986f 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -200,15 +200,6 @@ and update the saved previous values."
(setq mmm-current-submode mode
mmm-current-overlay ovl))
-;; TODO: Only used in `mmm-fontify-region-list', so far.
-;; Might be worth eliminating by making `mmm-regions-alist' include overlay
-;; references, not just the bounds of regions.
-(defun mmm-submode-overlay-at (mode &optional pos)
- "Return the highest priority region of MODE at POS or point, if any."
- (find-if #'(lambda (ovl)
- (eq (overlay-get ovl 'mmm-mode) mode))
- (mmm-overlays-at pos 'all)))
-
(defun mmm-submode-at (&optional pos type)
"Return the submode at POS \(or point), or NIL if none.
See `mmm-included-p' for values of TYPE."
@@ -704,21 +695,24 @@ The list is sorted in order of increasing buffer
position."
#'<))
(defun mmm-regions-in (start stop)
- "Return a list of regions of the form (MODE BEG END) whose disjoint
+ "Return a list of regions of the form (MODE BEG END OVL) 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))))
+ (when (cdr pos-list)
+ (let ((ovl (mmm-overlay-at (car pos-list) 'beg)))
+ (list (if ovl
+ (overlay-get ovl 'mmm-mode)
+ mmm-primary-mode)
+ (car pos-list) (cadr pos-list)
+ ovl))))
(mmm-submode-changes-in start stop))))
(setcdr (last regions 2) nil)
regions))
(defun mmm-regions-alist (start stop)
"Return a list of lists of the form \(MODE . REGIONS) where REGIONS
-is a list of elements of the form \(BEG END). The disjoint union all
+is a list of elements of the form \(BEG END OVL). The disjoint union all
of the REGIONS covers START to STOP."
(let ((regions (mmm-regions-in start stop))
alist)
@@ -773,7 +767,7 @@ of the REGIONS covers START to STOP."
;; `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-pair mode (mmm-submode-overlay-at mode))
+ (mmm-set-current-pair mode (caddr reg))
(mmm-set-local-variables (unless (eq mmm-previous-submode
mode)
mode)
mmm-current-overlay)
@@ -805,9 +799,10 @@ of the REGIONS covers START to STOP."
(let* ((mode (car elt))
(func (get mode 'mmm-syntax-propertize-function))
(beg (cadr elt)) (end (caddr elt))
+ (ovl (cadddr elt))
(syntax-propertize-chunk-size (- end beg)))
(goto-char beg)
- (mmm-set-current-pair mode (mmm-submode-overlay-at mode))
+ (mmm-set-current-pair mode ovl)
(mmm-set-local-variables mode mmm-current-overlay)
(save-restriction
(if mmm-current-overlay
- [elpa] master bcc5adf 351/433: Define mmm-indent-line-function and its default value, (continued)
- [elpa] master bcc5adf 351/433: Define mmm-indent-line-function and its default value, Dmitry Gutov, 2018/03/15
- [elpa] master 8ab7041 297/433: Adjust indentation in primary mode for ERB blocks, Dmitry Gutov, 2018/03/15
- [elpa] master 68b2135 282/433: Fix obsolete backquotes, Dmitry Gutov, 2018/03/15
- [elpa] master e3ef1f8 267/433: Collapsed undo of insertion into one command., Dmitry Gutov, 2018/03/15
- [elpa] master 6dcd817 337/433: * mmm-syntax-propertize-function: Use font-lock-syntactic-keywords, Dmitry Gutov, 2018/03/15
- [elpa] master ea8a1b8 342/433: Rebinding syntax-propertize-chunk-size is pointless, Dmitry Gutov, 2018/03/15
- [elpa] master 970b52a 298/433: Check for EJS "blocks", Dmitry Gutov, 2018/03/15
- [elpa] master 20e65af 372/433: Primary mode spf should see the whole buffer, Dmitry Gutov, 2018/03/15
- [elpa] master 2590b31 401/433: Update the checklist, Dmitry Gutov, 2018/03/15
- [elpa] master 5f80383 364/433: Fix typo: global-mmm-mode -> mmm-global-mode, Dmitry Gutov, 2018/03/15
- [elpa] master 7422b45 341/433: * mmm-regions-in: Keep overlay references in the return value,
Dmitry Gutov <=
- [elpa] master 6156c7a 349/433: Add URL header, Dmitry Gutov, 2018/03/15
- [elpa] master 55bba22 343/433: Merge pull request #21 from dgutov/syntax-propertize, Dmitry Gutov, 2018/03/15
- [elpa] master f6dd37f 264/433: Added instructions for installing CVS version., Dmitry Gutov, 2018/03/15
- [elpa] master ddb7b42 393/433: fix the problem that mmm-major-mode-preferences has no effect for css., Dmitry Gutov, 2018/03/15
- [elpa] master 00c10a6 429/433: And more, Dmitry Gutov, 2018/03/15
- [elpa] master 859d231 417/433: Update the copyright notices, Dmitry Gutov, 2018/03/15
- [elpa] master 52d2714 388/433: Fix #40, Dmitry Gutov, 2018/03/15
- [elpa] master 48ca941 270/433: *** empty log message ***, Dmitry Gutov, 2018/03/15
- [elpa] master 42bbc22 238/433: * mmm-sample.el (here-doc): Added quotes to here-doc regexp., Dmitry Gutov, 2018/03/15
- [elpa] master 61b9cf4 325/433: Don't pass nil to mmm-set-local-variables, Dmitry Gutov, 2018/03/15