[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 659a5d1429 169/230: inline child action overhaul. m
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 659a5d1429 169/230: inline child action overhaul. much better |
Date: |
Sun, 7 Jul 2024 19:00:32 -0400 (EDT) |
branch: elpa/dslide
commit 659a5d14293e98b59dff2f3579889d65920fab15
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
inline child action overhaul. much better
uses overlays now. this design is much more apt to composing actions. An
inline child could have an inline child etc.
Still need inline reveal animation for this, but this is better
Also fixed a bug.
Also simplied the number of places that touch the restriction
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
dslide.el | 54 ++++++++++++++++++++++++++++++++++--------------------
test/demo.org | 1 +
2 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/dslide.el b/dslide.el
index 7c1cae59d6..55fa1f0761 100644
--- a/dslide.el
+++ b/dslide.el
@@ -1740,11 +1740,21 @@ state from being at the first child heading."
;; TODO override the child's own child action
(defclass dslide-child-action-inline (dslide-child-action)
- ((children
+ ((overlays
+ :initform nil)
+ (children
:initform nil
:documentation "Children that have been instantiated."))
"Display children inline with the parent.")
+(cl-defmethod dslide-begin ((obj dslide-child-action-inline))
+ (let ((level (1+ (org-element-property :level (dslide-heading obj)))))
+ (oset obj overlays
+ (dslide--contents-map (dslide-heading obj) 'headline
+ (lambda (e)
+ (when (= (org-element-property :level e) level)
+ (dslide-hide-element e)))))))
+
(cl-defmethod dslide-forward ((obj dslide-child-action-inline))
(let (progress exhausted)
(while (not (or progress exhausted))
@@ -1753,16 +1763,23 @@ state from being at the first child heading."
(dslide-forward child)))
;; If the child didn't make progress, try to load up the next child
(unless progress
- (if-let* ((child-heading (dslide-deck-forward-child obj))
+ (if-let* ((child-heading (dslide-child-next obj))
(child (dslide--make-slide
child-heading
- (oref dslide--deck slide)
- :slide-action #'dslide-action-narrow
+ (oref dslide--deck slide) ; TODO hack
+ :slide-action 'none
:inline t
- ;; TODO this won't compose at all
- :slide-action-args '(:include-restriction t
:with-children t)
:child-action 'none)))
- (progn (dslide-begin child)
+ (progn (mapc #'delete-overlay
+ (seq-intersection (oref obj overlays)
+ (overlays-at (org-element-property
+ :begin
+ child-heading))))
+ (dslide-begin child)
+ (when dslide-slide-in-effect
+ (dslide-animation-setup
+ (org-element-property :begin child-heading)
+ (org-element-property :end child-heading)))
(setq progress child)
(push child (oref obj children)))
(setq exhausted t))))
@@ -1775,32 +1792,28 @@ state from being at the first child heading."
(setq progress (when-let* ((child (car (oref obj children))))
(dslide-backward child)))
- ;; If the child didn't make progress, narrow it away
+ ;; If the child didn't make progress, hide it with an overlay
(unless progress
(let* ((finished (pop (oref obj children)))
(heading (dslide-heading finished)))
- (dslide-deck-backward-child obj) ; for marker effects 💡
- ;; TODO do this with overlays in a nested child ☢️
- (when heading
- (narrow-to-region (point-min) (org-element-property :begin
heading))
- (run-hooks 'dslide-narrow-hook))
+ (dslide-child-previous obj) ; for marker effects 💡
+ (push (dslide-hide-element heading) (oref obj overlays))
(dslide-final finished)
- (setq progress (car (oref obj children))))))
+ (setq progress (or (car (oref obj children))
+ (dslide-heading obj))))))
progress))
-(cl-defmethod dslide-end :after ((obj dslide-child-action-inline))
+(cl-defmethod dslide-end ((obj dslide-child-action-inline))
(dslide-marker obj (org-element-property :begin (dslide-heading obj)))
(let (exhausted)
(while (not exhausted)
;; If the child didn't make progress, try to load up the next child
- (if-let* ((child-heading (dslide-deck-forward-child obj)))
+ (if-let* ((child-heading (dslide-child-next obj)))
(let* ((child (dslide--make-slide
child-heading
- (oref dslide--deck slide)
+ (oref dslide--deck slide) ; TODO hack.
+ :slide-action 'none
:inline t
- ;; TODO this won't compose at all
- :slide-action #'dslide-action-narrow
- :slide-action-args '(:include-restriction t
:with-children t)
:child-action 'none)))
(let ((dslide-slide-in-effect nil))
(dslide-end child))
@@ -1808,6 +1821,7 @@ state from being at the first child heading."
(setq exhausted t)))))
(cl-defmethod dslide-final :after ((obj dslide-child-action-inline))
+ (mapc #'delete-overlay (oref obj overlays))
(mapc #'dslide-final (oref obj children)))
;; * Filters
diff --git a/test/demo.org b/test/demo.org
index 255eff7e8b..3d035d9a82 100644
--- a/test/demo.org
+++ b/test/demo.org
@@ -39,6 +39,7 @@ Be sure to customize the faces used for highlighting progress
and babel block ex
You probably want to define these in your theme, using ~set-face-attribute~.
* Inline Children
:PROPERTIES:
+:DSLIDE_SLIDE_ACTION: dslide-action-narrow :with-children t
:DSLIDE_CHILD_ACTION: dslide-child-action-inline
:END:
- You won't believe these animations
- [nongnu] elpa/dslide 1472ac4601 137/230: package lint, (continued)
- [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
- [nongnu] elpa/dslide c131653996 139/230: Remove extraneous +1, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 76ff3c1b06 151/230: - dumping off some minor cleanup line noise, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide bdc16a2b5d 148/230: multiple animation timers, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide ccb8064891 152/230: ensure-slide-buffer only displays when not already displayed, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide cd785d24b3 160/230: Override default dbase-end implementation for image action, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 24253f64c0 157/230: introducing reverse-in-place, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide dbcf00d38d 161/230: allow inclusive matching in section mapping, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide df1fca1b87 167/230: animations are set up without restriction, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 659a5d1429 169/230: inline child action overhaul. much better,
ELPA Syncer <=
- [nongnu] elpa/dslide 90f9ff272d 175/230: correcting some mininformation, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0f123e3638 177/230: Rename DSLIDE_SECTION_ACTIONS -> DSLIDE_ACTIONS, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide fd7acfa477 186/230: fix item reveal progress indication (broken a bit in recent rewrite), ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide afff88a6ca 202/230: Update following buffers even in different frames, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 57eca5d498 203/230: dslide-develop initialization was not quite complete, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 8a893d858b 215/230: Proper generic methods for eldoc completions, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 8f2a651695 212/230: cleanups-for-elpa, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 299a4de7da 220/230: replace video link with github asset, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 164392855b 227/230: Small fixups for the readme rendering, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 6de2d70e6a 086/230: Clean up any pushed callbacks, ELPA Syncer, 2024/07/07