[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auto-overlays 55e868d 30/93: auto-o-suicide also needs
From: |
Stefan Monnier |
Subject: |
[elpa] externals/auto-overlays 55e868d 30/93: auto-o-suicide also needs to remove old properties. |
Date: |
Mon, 14 Dec 2020 13:00:31 -0500 (EST) |
branch: externals/auto-overlays
commit 55e868d33b4086a94b7c94adfbe81bbc7466d607
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@dr-qubit.org>
auto-o-suicide also needs to remove old properties.
---
auto-overlays.el | 44 +++++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/auto-overlays.el b/auto-overlays.el
index f4918f9..60b16d4 100644
--- a/auto-overlays.el
+++ b/auto-overlays.el
@@ -36,8 +36,8 @@
;; * fixed `auto-overlay-load-overlays' so that it doesn't parse matches that
;; are within higher priority exclusive overlays
;; * improved update scheduling by collapsing updates for overlapping regions
-;; * fixed `auto-o-match-overlay' to remove properties due to old matches
-;; before setting new properties
+;; * fixed `auto-o-match-overlay' and `auto-o-suicide' to remove properties
+;; due to old matches before setting new properties
;;
;; Version 0.8.1
;; * modified `auto-o-run-after-change-functions' to cope more robustly with
@@ -1061,10 +1061,12 @@ was saved."
;; If FORCE is non-nil, O-SELF is deleted irrespective of whether its
;; overlay still matches.
+ ;; have to widen temporarily
(save-restriction
(widen)
- ;; this is here to avoid a weird bug(?) where the modification-hooks seem
- ;; to be called occasionally for overlays that have already been deleted
+ ;; this condition is here to avoid a weird Emacs bug(?) where the
+ ;; modification-hooks seem to be called occasionally for overlays that
+ ;; have already been deleted
(when (overlay-buffer o-self)
;; if match overlay no longer matches the text it covers...
(unless (and (not force)
@@ -1072,16 +1074,26 @@ was saved."
(goto-char (overlay-start o-self))
(looking-at (auto-o-regexp o-self)))
(= (match-end 0) (overlay-end o-self)))
- ;; if we have a parent overlay, call appropriate suicide function,
+
+ ;; if we have a parent overlay...
+ (let* ((o-parent (overlay-get o-self 'parent))
+ (o-other (overlay-get o-parent
+ (if (eq (auto-o-edge o-self) 'start)
+ 'start 'end))))
+ (when o-parent
+ ;; if parent's properties have been set by us, remove them
+ (when (or (null o-other)
+ (>= (auto-o-compound-rank o-self)
+ (auto-o-compound-rank o-other)))
+ (dolist (p (auto-o-props o-self))
+ (overlay-put o-parent (car p) nil)))
+ ;; call appropriate suicide function
+ (funcall (auto-o-suicide-function o-self) o-self)))
;; schedule an update (necessary since if match regexp contains
;; "context", we may be comitting suicide only for the match overlay
- ;; to be recreated in a slightly different place), then delete
- ;; ourselves
- (when (overlay-get o-self 'parent)
- (funcall (auto-o-suicide-function o-self) o-self))
- ;; Note: not supplying the 'set-id can avoid multiple, effectively
- ;; identical auto-overlay-update calls
+ ;; to be recreated in a slightly different place)
(auto-o-schedule-update (overlay-start o-self))
+ ;; delete ourselves
(delete-overlay o-self)))
)
)
@@ -1297,13 +1309,15 @@ properties)."
;; (Note: this sometimes sets the overlay's properties to the ones it
;; already had, but it hardly seems worth checking for that)
(unless no-props
- ;; when start was matched before and is being changed, remove properties
- ;; due to old start match
+ ;; when start was previously matched and is being changed, remove
+ ;; properties due to old start match
+ ;; Note: no need to check if properties were really set by start match,
+ ;; since if not they will be recreated below
(when (and start old-o-start)
(dolist (p (auto-o-props old-o-start))
(overlay-put overlay (car p) nil)))
- ;; when end was matched before and is being changed, remove properties
- ;; due to old end match
+ ;; when end was previously matched and is being changed, remove
+ ;; properties due to old end match (see note above)
(when (and end old-o-end)
(dolist (p (auto-o-props old-o-end))
(overlay-put overlay (car p) nil)))
- [elpa] externals/auto-overlays 75c2c75 82/93: Improve auto-overlays-in/at-point docstrings., (continued)
- [elpa] externals/auto-overlays 75c2c75 82/93: Improve auto-overlays-in/at-point docstrings., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays d107a02 84/93: Reparse auto-overlays on loading/unloading regexp definitions., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 033900e 90/93: Fix some quoting problems in doc strings, Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays db9036a 92/93: * packages/auto-overlays/: Activate lexical-binding., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays d66bab4 11/93: Fixed "self" regexp bugs in auto-overlay package., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 86c25df 14/93: Removed auto-overlay-functions variable, and implemented new regexp class interface, Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 622afa4 13/93: Another very similar bug fix to do with updating exclusive overlays., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 1db0b95 22/93: Various minor bug fixes, and changes to bring packages up to date, Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays ea600c4 27/93: Bug fixes to new update scheduling, and to loading overlays from file., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 734371d 43/93: Changed @ignore Texinfo command to flat overlay class., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 55e868d 30/93: auto-o-suicide also needs to remove old properties.,
Stefan Monnier <=
- [elpa] externals/auto-overlays 5d5e09e 45/93: trivial whitespace changes, Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 0936d26 39/93: Work around goto-line bug., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays ff75a63 49/93: Bug-fix in auto-overlay-load-definition, Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 9e8ef72 36/93: Modified interface functions for defining auto-overlay regexps., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 5539596 56/93: Added missing (eval-when-compile (require 'cl))., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 0f02ef9 57/93: Fixed minor spelling errors in docstrings., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays f66e655 66/93: Update package headers for ELPA., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays cdf4e6a 70/93: Fix copyright assignment in auto-overlays manual., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 464d9ea 77/93: Refactor auto-overlay-regexps format and implement match hooks., Stefan Monnier, 2020/12/14
- [elpa] externals/auto-overlays 9fe619d 85/93: Fix bugs in auto-overlay saving/loading., Stefan Monnier, 2020/12/14