[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 1aa45a2223 05/16: Only cleanup overlays in finish,
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 1aa45a2223 05/16: Only cleanup overlays in finish, only for this slide |
Date: |
Mon, 25 Nov 2024 01:00:01 -0500 (EST) |
branch: elpa/dslide
commit 1aa45a2223489e2df52d5ee6994e98486a71d128
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
Only cleanup overlays in finish, only for this slide
A generational strategy is probably needed, such that we push overlays when
doing child slides so that we can nuke them more easily and accurately
---
dslide.el | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/dslide.el b/dslide.el
index 64b40d7f55..277f05decc 100644
--- a/dslide.el
+++ b/dslide.el
@@ -934,6 +934,8 @@ order.")
(mapc #'dslide-final (oref obj section-actions))
(when-let ((slide-action (oref obj slide-action)))
(dslide-final slide-action))
+ ;; Clean up stale overlays
+ (dslide--slide-cleanup-overlays obj)
;; Clean up heading marker, which is shared by children
(set-marker (oref obj begin) nil))
@@ -947,6 +949,24 @@ order.")
(dslide-backward slide-action))
(dslide--map-find #'dslide-backward (oref obj section-actions))))
+(cl-defmethod dslide--slide-cleanup-overlays ((obj dslide-slide))
+ ;; Use this only during final. TODO We might need a better way to store and
+ ;; purge these overlays. A generational strategy might be better.
+ (setq dslide-overlays
+ (let ((beg (oref obj begin))
+ (end (save-restriction
+ (goto-char (oref obj begin))
+ (org-element-property
+ :end (org-element-at-point))))
+ filtered)
+ (dolist (o dslide-overlays filtered)
+ (let ((o-beg (overlay-start o))
+ (o-end (overlay-end o)))
+ ;; conservatively only deletes fully contained overlays
+ (if (and (>= o-beg beg) (<= o-end end) )
+ (delete-overlay o)
+ (push o filtered)))))))
+
(cl-defgeneric dslide--map-find (pred sequence)
"Find first non-nil return value from mapping PRED over SEQUENCE."
(let (found)
@@ -1760,14 +1780,6 @@ restriction, meaning no progress was made.")
(dslide--section-end heading))))
(unless (and (<= (point-min) begin)
(>= (point-max) end))
- ;; Restriction changes are a good moment to clean up overlays dumped
- ;; into `dslide-overlays'. ⚠️ However, this doesn't properly handle
- ;; the case that the new restriction contains the old restriction,
- ;; meaning some of the existing overlays may still be necessary. This
- ;; should be good for now since there are no known cases where this
- ;; edge case is reached.
- (while dslide-overlays
- (delete-overlay (pop dslide-overlays)))
(narrow-to-region begin end)
(dslide-hide-filtered-children obj)
(when (and dslide-slide-in-effect
- [nongnu] elpa/dslide 513b1109fb 06/16: Get rid of erroneous step padding in simple slide images, (continued)
- [nongnu] elpa/dslide 513b1109fb 06/16: Get rid of erroneous step padding in simple slide images, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 8b4336db4d 02/16: use the current slide's filter, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 6d9ebfb79a 08/16: clean up propertize action for showing off, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide f59c85784c 11/16: Aha! image-keyword interplay fixed, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 10b1386cf4 03/16: Hide the newline after each affiliated keyword, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide d2217bc74f 07/16: Quick fix for TODO and tag hiding in contents, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 91652de16a 15/16: Bug fix for reverse-in-place (!), ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 7949a5f337 09/16: Hiding filtered headings needs to collapse display completely, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide ad7f189032 10/16: reverse action list when going backwards or starting at the end, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 0e027e0527 04/16: Clip newline from text property action overlay region, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 1aa45a2223 05/16: Only cleanup overlays in finish, only for this slide,
ELPA Syncer <=
- [nongnu] elpa/dslide 0d9a1f6c27 16/16: Release 0.5.5, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 0c5b00b4ec 01/16: line noise, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 3aa8ea4bcc 12/16: Good things for the manual. Updates to generated., ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 0a068013b3 13/16: Image feature cleanups. Good to go 👌, ELPA Syncer, 2024/11/25
- [nongnu] elpa/dslide 3fbc0a6cfb 14/16: implement peeking for section and child mapping, ELPA Syncer, 2024/11/25