[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 4af0c6b990 084/230: Remove vestigal push-* code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 4af0c6b990 084/230: Remove vestigal push-* code |
Date: |
Sun, 7 Jul 2024 19:00:18 -0400 (EDT) |
branch: elpa/dslide
commit 4af0c6b990a82ba71e6dad7da7a2ac3495e1de70
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
Remove vestigal push-* code
The idea was that slides might push a restriction and pop it off the stack.
Because of how child action composition has to work, this was deemed not
that
useful.
The deck no longer knows the depth of children, so it also cannot do this
properly. Until child actions all play nice, this cannot be re-implemented.
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
macro-slides.el | 78 ++++++++-------------------------------------------------
1 file changed, 10 insertions(+), 68 deletions(-)
diff --git a/macro-slides.el b/macro-slides.el
index 13773e12e3..458c385324 100644
--- a/macro-slides.el
+++ b/macro-slides.el
@@ -658,14 +658,7 @@ work as well.")
:initform nil
:documentation "Steps to run before next steps.
FORM is just a list as steps will always be run before any
-sequence ends or makes progress..")
- (sequence-callbacks
- :initform '(nil)
- :documentation "Steps that run only when sequences end.
-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."))
+sequence ends or makes progress.."))
"The Deck is responsible for selecting the parent node and
maintaining state between mode activations or when switching
@@ -875,82 +868,32 @@ find the slide that displays that POINT."
(eq (oref obj base-buffer) (buffer-base-buffer
(oref obj slide-buffer)))))
-(defun ms-push-kill-buffer ()
- "Push a step to kill the current buffer.")
-
-(defun ms-push-window-config (&optional pop-when step)
+(defun ms-push-window-config (&optional step)
"Save the window configuration and narrowing for restoration.
-POP-WHEN will add a callback to restore the restriction.
-
-Optional POP-WHEN decides when to restore the config. See
-`ms-push-step' for details.
Optional STEP argument will decide if the callback counts as a step or will
return nil so that it is only run for effects."
(let ((window-config (current-window-configuration)))
(ms-push-step
(lambda (_) (prog1 step
- (set-window-configuration window-config)))
- pop-when)))
-
-(defun ms-push-restriction (&optional pop-when step)
- "Save the current buffer restriction for restoration.
-POP-WHEN will add a callback to restore the restriction.
-
-Optional POP-WHEN decides when to restore the config. See
-`ms-push-step' for details.
-
-Optional STEP argument will decide if the callback counts as a step or will
-return nil so that it is only run for effects."
- (let* ((begin (point-min-marker))
- (end (point-max-marker))
- (size (buffer-size))
- (restricted (/= (- end begin) size)))
- (ms-push-step
- (lambda (_) (prog1 step
- (if restricted
- (narrow-to-region begin end)
- (widen))))
- pop-when)))
+ (set-window-configuration window-config))))))
-;; TODO pop the sequence root on stop.
-(defun ms-push-step (fun &optional pop-when)
+(defun ms-push-step (fun)
"Run FUN as next step.
-FUN is a function of a single argument, `forward' or `backward'.
+FUN is a function of a single optional argument, `forward' or
+`backward'. nil indicates that the callback is being cleaned up,
+usually to quit the presentation or change to contents.
The return value is interpreted as progress, so return non-nil if
you want FUN to count as a step or nil if FUN is only run for
effects.
-Optional POP-WHEN argument means run FUN after current sequence
-ends. Three kinds of values are understood:
-
-- `step' or nil: next step.
-
-- integer: Depth of parents. 0 is the current sequence.
-
-- `sequence': always equivalent to 0. Just run when the current
- sequence ends. TODO ⚠️ This could be unstable if actions become
- sub-sequences, which is currently intended.
-
-- `root': run before cleanup. Equivalent to passing an integer
- equal to one less than the sequence depth.
-
If you need multiple steps, consider adding steps inside of FUN
for recursive dynamic steps rather than adding a lot of steps at
once, which requires the functions to be removed or return nil."
(unless (ms-live-p)
(error "No active deck"))
- (cond ((eq pop-when 'step)
- (push fun (oref ms--deck step-callbacks)))
- ((or (eq pop-when 'sequence)
- (eq pop-when 0))
- (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 (nth pop-when
- (oref ms--deck sequence-callbacks)))))))
+ (push fun (oref ms--deck step-callbacks)))
;; * Slide
(defclass ms-slide (ms-parent ms-stateful-sequence)
@@ -1510,7 +1453,7 @@ stateful-sequence class methods. METHOD-NAME is a
string."
;; TODO make it just a link action?
(cl-defmethod ms-step-forward ((obj ms-action-image))
(when-let ((link (ms-section-next obj 'link)))
- (ms-push-window-config 'step nil)
+ (ms-push-window-config nil)
;; TODO success detection
(let ((org-link-frame-setup '((file . find-file)))
@@ -1532,7 +1475,7 @@ stateful-sequence class methods. METHOD-NAME is a
string."
(cl-defmethod ms-step-backward ((obj ms-action-image))
(when-let ((link (ms-section-previous obj 'link)))
- (ms-push-window-config 'step nil)
+ (ms-push-window-config nil)
;; TODO success detection
(let ((org-link-frame-setup '((file . find-file)))
@@ -2554,7 +2497,6 @@ source buffer."
;; Animation timers especially should be stopped
;; TODO ensure cleanup is thorough even if there's a lot of failures.
- ;; TODO make the deck a child sequence of a presentation ;-)
(ms--cleanup-state)
(setq ms--deck nil)
- [nongnu] elpa/dslide 0d9518c64e 049/230: Include demo org for feedback on configuration markup, (continued)
- [nongnu] elpa/dslide 0d9518c64e 049/230: Include demo org for feedback on configuration markup, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0016bc71aa 058/230: pushing some changes to the demo reflecting config API updates, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide d0a0678463 070/230: Removed face remapping (it was sent to master-of-ceremonies), ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 618b803f95 067/230: !refactor Telescopio, the parents now call through their children, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide bdd5fff8d6 064/230: moving some code for packaging, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide a462b0a4ba 062/230: babel blocks should only clear results when configured to do so, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide aed4afd84a 063/230: implement hiding children, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 199bb5b68b 079/230: Properties standardized to MS_ prefix, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide ada6553434 080/230: missed a few updates to property names, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide fca6e33a6c 060/230: Properly declare generic methods, reconcile documentation, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 4af0c6b990 084/230: Remove vestigal push-* code,
ELPA Syncer <=
- [nongnu] elpa/dslide 0cbd0b7bab 081/230: Remove vestigal ms-slide-hook, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 1d61b6ffc1 083/230: Codify the hooks and lifecycle feedback messages, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 31fc027f52 057/230: !temporary basic composition support, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 09b9e5bc63 071/230: keep-fill implementation for hiding, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 2c515e58d0 127/230: remove redundant actions in demo, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 5cf6e1d521 102/230: option to hide mode line when displaying images, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0087bce96f 082/230: Finished some incomplete parts of the README, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 7e0cf003b0 092/230: don't log feedback messages to the message log, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 1472ac4601 137/230: package lint, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide d33205f260 138/230: soft-require hide-mode-line, ELPA Syncer, 2024/07/07