emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dslide 91652de16a 15/16: Bug fix for reverse-in-place (!)


From: ELPA Syncer
Subject: [nongnu] elpa/dslide 91652de16a 15/16: Bug fix for reverse-in-place (!)
Date: Mon, 25 Nov 2024 01:00:03 -0500 (EST)

branch: elpa/dslide
commit 91652de16ad5a17dcace61c149e70a84656be5ed
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>

    Bug fix for reverse-in-place (!)
    
    The manual section on progress tracking is must-read for working on this 
stuff.
    The scheme for reverse-in-place is supposed to use the :end property when 
going
    backwards.  Instead, it was only comparing the :begin property, resulting in
    bugs that would affect actions that were very particular.
    
    The first pass of the new image action features, with its callbacks and 
punching
    the progress tracking marker, excited this failure mode.
---
 dslide.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dslide.el b/dslide.el
index 607a17fe23..f59db36fe0 100644
--- a/dslide.el
+++ b/dslide.el
@@ -2309,8 +2309,8 @@ and NO-RECURSION are described in `org-element-map'."
 (defun dslide--section-next
     (heading type after &optional pred inclusive info no-recursion)
   "Return HEADING's next element of TYPE.
-By default, matches only after AFTER but with optional INCLUSIVE,
-also includes matches at AFTER.
+By default, matches only beginning after AFTER but with optional
+INCLUSIVE, also includes matches beginning exactly at AFTER.
 
 PRED, INFO, FIRST-MATCH, and NO-RECURSION are described in
 `org-element-map'."
@@ -2321,20 +2321,24 @@ PRED, INFO, FIRST-MATCH, and NO-RECURSION are described 
in
     (dslide--section-map
      heading type combined-pred info t no-recursion)))
 
+;; ⚠️ Check the manual section on progress tracking!  INCLUSIVE was used to
+;; implement reverse-in-place in the action methods.
 (defun dslide--section-previous
     (heading type before &optional pred inclusive info no-recursion)
   "Return HEADING's previous element of TYPE.
-By default, matches only before BEFORE but with optional
-INCLUSIVE, also includes matches exactly at BEFORE.
+By default, matches only beginning before BEFORE but with optional
+INCLUSIVE, also includes matches ending exactly at BEFORE.
 
 PRED, INFO, FIRST-MATCH, and NO-RECURSION are described in
 `org-element-map'."
   (let* ((combined-pred (dslide-and
                          pred
                          (lambda (e) (funcall (if inclusive #'<= #'<)
-                                         (org-element-property :begin e) 
before)))))
+                                         (org-element-property
+                                          (if inclusive :end :begin) e)
+                                         before)))))
     ;; We can't map in reverse, so just retrieve all matched elements and
-    ;; return the last one.
+    ;; return the last one matched.
     (car (last (dslide--section-map
                 heading type combined-pred info nil no-recursion)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]