[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 57ea76d 052/433: (mmm-overlays-in): Added DELIM parameter.
From: |
Dmitry Gutov |
Subject: |
[elpa] master 57ea76d 052/433: (mmm-overlays-in): Added DELIM parameter. |
Date: |
Thu, 15 Mar 2018 19:43:33 -0400 (EDT) |
branch: master
commit 57ea76d93b7a39157366e3a508648b834d63cc5c
Author: mas <mas>
Commit: mas <mas>
(mmm-overlays-in): Added DELIM parameter.
(mmm-submode-changes-in): Added strict flags calling overlays-in.
---
mmm-region.el | 47 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)
diff --git a/mmm-region.el b/mmm-region.el
index 55f99b9..9c91aaa 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2000 by Michael Abraham Shulman
;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-region.el,v 1.12 2000/06/27 19:22:56 mas Exp $
+;; Version: $Id: mmm-region.el,v 1.13 2000/06/28 01:15:50 mas Exp $
;;{{{ GPL
@@ -165,16 +165,21 @@ but none starting at POS, and if `all', return both."
((end all) t)))
(t t)))
-(defun mmm-overlays-in (start stop &optional strict)
+(defun mmm-overlays-in (start stop &optional strict delim)
"Return the MMM overlays in START to STOP, in decreasing priority.
If STRICT is non-nil, include only those overlays which are entirely
-contained in the region, including their delimiters \(if any)."
+contained in the region. In this case, if DELIM is non-nil, the
+region delimiters, if any, must also be included."
(mmm-sort-overlays
(remove-if-not #'(lambda (ovl)
(and (overlay-get ovl 'mmm)
(or (not strict)
- (>= stop (mmm-back-end ovl))
- (<= start (mmm-front-start ovl)))))
+ (>= stop (if delim
+ (mmm-back-end ovl)
+ (overlay-end ovl)))
+ (<= start (if delim
+ (mmm-front-start ovl)
+ (overlay-start ovl))))))
(overlays-in (max start (point-min))
(min stop (point-max))))))
@@ -210,13 +215,14 @@ Set by `mmm-update-current-submode'.")
(defun mmm-update-current-submode (&optional pos)
"Update current and previous position variables to POS.
Return non-nil if the current region changed."
- (if (eq mmm-current-overlay (mmm-overlay-at (or pos (point))))
- nil
- (setq mmm-previous-overlay mmm-current-overlay
- mmm-previous-submode mmm-current-submode)
- (setq mmm-current-overlay (mmm-overlay-at (or pos (point)))
- mmm-current-submode (mmm-submode-at (or pos (point))))
- t))
+ (let ((ovl (mmm-overlay-at (or pos (point)))))
+ (if (eq ovl mmm-current-overlay)
+ nil
+ (setq mmm-previous-overlay mmm-current-overlay
+ mmm-previous-submode mmm-current-submode)
+ (setq mmm-current-overlay ovl
+ mmm-current-submode (if ovl (overlay-get ovl 'mmm-mode)))
+ t)))
(defun mmm-set-current-submode (mode &optional pos)
"Set the current submode to MODE and the current region to whatever
@@ -390,13 +396,6 @@ Not used under XEmacs.")
"Update all MMM properties correctly for the current position.
This function and those it calls do the actual work of setting the
different keymaps, syntax tables, local variables, etc. for submodes."
- ;; This next line is necessary because some derived modes can fool
- ;; MMM Mode into thinking they're really the parent mode. For
- ;; example, texinfo-mode looks like text-mode to the major mode
- ;; hook, and hence doesn't get its properties updated. FIXME: If we
- ;; use the post-command-hook way, this should be unnecessary.
- (mmm-update-mode-info major-mode)
-
(when (mmm-update-current-submode)
(mmm-save-changed-local-variables mmm-previous-overlay
mmm-previous-submode)
@@ -417,13 +416,10 @@ different keymaps, syntax tables, local variables, etc.
for submodes."
(force-mode-line-update)))
(defun mmm-add-hooks ()
-; (make-local-hook 'change-major-mode-hook)
-; (add-hook 'change-major-mode-hook 'mmm-mode-off nil 'local)
(make-local-hook 'post-command-hook)
(add-hook 'post-command-hook 'mmm-update-submode-region nil 'local))
(defun mmm-remove-hooks ()
- (remove-hook 'change-major-mode-hook 'mmm-mode-off 'local)
(remove-hook 'post-command-hook 'mmm-update-submode-region 'local))
;;}}}
@@ -517,13 +513,15 @@ region and mode for the previous position."
(defun mmm-submode-changes-in (start stop)
"Return a list of all submode-change positions from START to STOP.
-The list is sorted in order of increasing buffer position."
+The list is sorted in order of increasing buffer position, and the
+boundary positions are included."
(sort (remove-duplicates
(list* start stop
(mapcan #'(lambda (ovl)
`(,(overlay-start ovl)
,(overlay-end ovl)))
- (mmm-overlays-in start stop))))
+ (mmm-overlays-in start stop t t))))
+
#'<))
(defun mmm-regions-in (start stop)
@@ -587,6 +585,7 @@ of the REGIONS covers START to STOP."
(mmm-set-local-variables mode)
(funcall func (car reg) (cadr reg) nil))
regions))))
+
;;}}}
;;{{{ Beginning of Syntax
- [elpa] master 24f432b 051/433: Released 0.4.0., (continued)
- [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, 2018/03/15
- [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 <=
- [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
- [elpa] master e8be7cb 081/433: # Removed (require 'font-lock)., Dmitry Gutov, 2018/03/15
- [elpa] master db933b6 084/433: (mmm-make-temp-buffer): Added as workaround for make-indirect-buffer., Dmitry Gutov, 2018/03/15
- [elpa] master 7971c49 080/433: (mmm-update-mode-info): Killed any lingering temporary buffers., Dmitry Gutov, 2018/03/15
- [elpa] master 5837c90 066/433: Fixed font-lock woes (hopefully)., Dmitry Gutov, 2018/03/15
- [elpa] master 9d39887 088/433: # Updated stuff., Dmitry Gutov, 2018/03/15