[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide f3ae2af0cc 039/230: changed sequence-callbacks to n
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide f3ae2af0cc 039/230: changed sequence-callbacks to not include sequence as a key |
Date: |
Sun, 7 Jul 2024 19:00:13 -0400 (EDT) |
branch: elpa/dslide
commit f3ae2af0cc1c688b661b2b2a62a8f3e12fd49b9d
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
changed sequence-callbacks to not include sequence as a key
I had expected that targeting a specific parent sequence might be useful,
but
using these keys means obtaining them, and I can't think of a good way to
obtain
them that isn't reaching through places that should not be reached.
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
macro-slides.el | 56 ++++++++++++++++++++++++++++++++++----------------------
1 file changed, 34 insertions(+), 22 deletions(-)
diff --git a/macro-slides.el b/macro-slides.el
index c6e34c3cf7..a7e701ae98 100644
--- a/macro-slides.el
+++ b/macro-slides.el
@@ -769,9 +769,10 @@ sequence ends or makes progress..")
(sequence-callbacks
:initform '(nil)
"Steps that run only when sequences end.
-Form is an alist of (SEQUENCE . STEPS) where STEPS is a list
-of step callbacks. When sub-sequences are started, (SEQUENCE) is
-pushed onto this list."))
+Form is a list of STEPS where STEPS is a list of callbacks. The
+length of this list is equal to the depth of the current
+sequence. See `ms-push-step' for information about how to push a
+step deeper into the sequences."))
"The Deck is responsible for selecting the parent node and
maintaining state between mode activations or when switching
@@ -841,12 +842,13 @@ their init."
;; callback and see if it can make progress.
(unless result
;; Burn up a step callback until one returns non-nil
- (when-let ((steps (and (slot-boundp obj 'sequence-callbacks)
- (oref obj sequence-callbacks))))
- (while (and (not progress)
- steps)
+ (when-let* ((sequence-callbacks (oref obj sequence-callbacks))
+ (steps (car sequence-callbacks)))
+ (while (and (not progress) steps)
(setq progress (funcall (pop steps) 'forward)))
- (oset obj sequence-callbacks steps)))
+ ;; If all the steps for this sequence were consumed, pop a layer.
+ (unless steps
+ (oset obj sequence-callbacks (cdr sequence-callbacks)))))
(unless (or progress result)
;; Next check if there is a parent slide, which is true unless the
@@ -866,11 +868,15 @@ their init."
(when next-slide
(ms--debug next-slide))
- ;; When switching to a parent slide, we will finalize the old slide.
- ;; When switching to a child, we will not finalize the parent.
(when next-slide
+ (unless switching-to-parent
+ ;; Push a new sequence-callbacks level
+ (push nil (oref obj sequence-callbacks)))
(oset obj slide next-slide)
+
+ ;; When switching to a parent slide, we will finalize the old slide.
+ ;; When switching to a child, we will not finalize the parent.
(cond
(switching-to-parent
;; TODO slide re-entry when parent can still make progress
@@ -878,6 +884,7 @@ their init."
(t
(when switching-to-sibling
(ms-final current-slide))
+
;; TODO extract behavior and add to other navigation actions
(when ms-base-follows-slide
(let ((pos (marker-position (oref next-slide begin))))
@@ -943,12 +950,13 @@ their init."
;; callback and see if it can make progress.
(unless result
;; Burn up a step callback until one returns non-nil
- (when-let ((steps (and (slot-boundp obj 'sequence-callbacks)
- (oref obj sequence-callbacks))))
- (while (and (not progress)
- steps)
+ (when-let* ((sequence-callbacks (oref obj sequence-callbacks))
+ (steps (car sequence-callbacks)))
+ (while (and (not progress) steps)
(setq progress (funcall (pop steps) 'backward)))
- (oset obj sequence-callbacks steps)))
+ ;; If all the steps for this sequence were consumed, pop a layer.
+ (unless steps
+ (oset obj sequence-callbacks (cdr sequence-callbacks)))))
(unless (or progress result)
;; Next check if there is a parent slide, which is true unless the
@@ -969,15 +977,19 @@ their init."
(when previous-slide
(ms--debug previous-slide))
- ;; When switching to a parent slide, we will finalize the old slide.
- ;; When switching to a child, we will not finalize the parent.
(when previous-slide
- ;; TODO exhaust next slide callbacks
+ (unless switching-to-parent
+ ;; Push a new sequence-callbacks level
+ (push nil (oref obj sequence-callbacks)))
+
(oset obj slide previous-slide)
+
+ ;; When switching to a parent slide, we will finalize the old slide.
+ ;; When switching to a child, we will not finalize the parent.
(cond
(switching-to-parent
;; TODO slide re-entry when parent can still make progress?
- (ms-final current-slide)
+ (ms-final current-slide))
(t
(when switching-to-sibling
(ms-final current-slide))
@@ -1105,12 +1117,12 @@ once, which requires the functions to be removed or
return nil."
(push fun (oref ms--deck step-callbacks)))
((or (eq pop-when 'sequence)
(eq pop-when 0))
- (push fun (cdar (oref ms--deck sequence-callbacks))))
+ (push fun (car (oref ms--deck sequence-callbacks))))
((integerp pop-when)
(if (>= pop-when (length (oref ms--deck sequence-callbacks)))
(error "Requested depth exceeds sequence depth")
- (push fun (cdr (nth pop-when
- (oref ms--deck sequence-callbacks))))))))
+ (push fun (nth pop-when
+ (oref ms--deck sequence-callbacks)))))))
;; * Slide
(defclass ms-slide (ms-parent ms-stateful-sequence)
- [nongnu] elpa/dslide 198a80255b 072/230: move lifecycle & commands to end of package, (continued)
- [nongnu] elpa/dslide 198a80255b 072/230: move lifecycle & commands to end of package, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide f130bedeab 078/230: Update readme, rearrange some demo headlines, bump minor version, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0a59731410 075/230: Navigation from contents to same heading, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide dc5d0b965e 119/230: disinformation cleanup, a few lingering ms symbols, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide a8f7174ef3 095/230: dead expression, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide f24e5b8538 088/230: Rename argument, display-action -> display, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 18e079c83f 113/230: Clean up misinformation & propagate naming, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 4af6955e23 090/230: missing feedback on last slide, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 8bc5783536 051/230: Sorry taka. It's been a good 13 years of org-tree-slide, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 45a9620a54 054/230: babel blocks can now be used in both directions, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide f3ae2af0cc 039/230: changed sequence-callbacks to not include sequence as a key,
ELPA Syncer <=
- [nongnu] elpa/dslide 015796186f 048/230: !fixme Not sure if this is necessary. Shipping my last tested., ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 4e2086e49e 034/230: rename display-state -> slide-buffer-state, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 30196efe70 010/230: The header overlay should be buffer local, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide e75488d7ac 018/230: rearrange, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide cf56e034ff 008/230: Overlays for selective display of contents, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 39a9045682 011/230: Simplify blank-lines expression using make-string, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0316764255 006/230: moving a comment, automatic formatting, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 3969814eb4 015/230: rearrangement, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide a0460d4070 012/230: Return early by user-error when not in org-tree-slide-mode, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0732479ac8 019/230: rearrange, ELPA Syncer, 2024/07/07