[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 98c9c95505 099/230: custom implementation of pulse
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 98c9c95505 099/230: custom implementation of pulse |
Date: |
Sun, 7 Jul 2024 19:00:20 -0400 (EDT) |
branch: elpa/dslide
commit 98c9c95505b712b0817dda3110c348a8a98598be
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
custom implementation of pulse
lives until the next step
most importantly, supports multiple overlays because some actions need to
highlight multiple things during each step.
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
macro-slides.el | 44 ++++++++++++++++++++++++++++++++++++--------
1 file changed, 36 insertions(+), 8 deletions(-)
diff --git a/macro-slides.el b/macro-slides.el
index 60fd2b866a..2d96fd863b 100644
--- a/macro-slides.el
+++ b/macro-slides.el
@@ -365,7 +365,7 @@ obvious display style."
(defface ms-highlight
'((t :inherit hl-line))
- "Face used when following in the base buffer.
+ "Face used in base buffer to highlight progress.
See `ms-base-follows-slide'."
:group 'macro-slides)
@@ -384,10 +384,13 @@ See `ms-base-follows-slide'."
This is global. If a presentation is active, you can look at this variable to
coordinate with it.")
-(defvar-local ms--overlays nil
+(defvar ms--overlays nil
"Overlays used to hide or change contents display.")
-(defvar-local ms--header-overlay nil
+(defvar ms--step-overlays nil
+ "Overlays that only live for one step.")
+
+(defvar ms--header-overlay nil
"Flag to check the status of overlay for a slide header.")
;; Shouldn't need one per buffer
@@ -714,6 +717,9 @@ their init."
;; already
(error "No slide selected"))
+ (while ms--step-overlays
+ (delete-overlay (pop ms--step-overlays)))
+
(let (progress reached-end)
;; Burn up a step callback until one returns non-nil
(when-let ((steps (oref obj step-callbacks)))
@@ -762,6 +768,9 @@ their init."
;; already
(error "No slide selected"))
+ (while ms--step-overlays
+ (delete-overlay (pop ms--step-overlays)))
+
;; Going backward is almost the same as going forward. The big difference is
;; that when a slide is instantiated, it needs to be sent to its end.
Usually
;; the default implementation, which calls step-forward until progress is
@@ -2219,7 +2228,9 @@ hooks must occur in the deck's :slide-buffer."
(defun ms--delete-overlays ()
"Delete content overlays."
(while ms--overlays
- (delete-overlay (pop ms--overlays))))
+ (delete-overlay (pop ms--overlays)))
+ (while ms--step-overlays
+ (delete-overlay (pop ms--step-overlays))))
(defun ms--animate (goal-time overlay initial-line-height)
(if (time-less-p goal-time (current-time))
@@ -2425,15 +2436,32 @@ Optional ERROR if you want to process
`wrong-type-argument'."
(org-fold-show-all)
(ms-init ms--deck))
+(defun ms--base-buffer-highlight-line (&optional pos face)
+ "Highlight line containing POS or current point.
+Optional FACE defaults to `ms-highlight'."
+ (unless (ms-live-p)
+ (error "Live deck not found"))
+ (let ((buffer (current-buffer))
+ (face (or face 'ms-highlight)))
+ (set-buffer (oref ms--deck base-buffer))
+ (save-excursion
+ (when pos (goto-char pos))
+ (let* ((beg (progn (vertical-motion 0) (point)))
+ (end (progn (vertical-motion 1) (point)))
+ (overlay (make-overlay beg end)))
+ (overlay-put overlay 'face face)
+ (push overlay ms--step-overlays)))
+ (set-buffer buffer)))
+
(defun ms--follow (progress)
"Set the base buffer window point to PROGRESS.
PROGRESS must be an integer buffer location, not a marker."
(unless (ms-live-p)
(error "Live deck not found"))
(let ((pos (cond ((integerp progress) progress)
- ((eieio-object-p progress)
- (marker-position (oref progress begin)))
- ((markerp progress) (marker-position progress)))))
+ ((eieio-object-p progress)
+ (marker-position (oref progress begin)))
+ ((markerp progress) (marker-position progress)))))
(when (null pos)
(warn "Progress was null! %s" progress))
(when (and pos ms-base-follows-slide)
@@ -2442,7 +2470,7 @@ PROGRESS must be an integer buffer location, not a
marker."
(<= pos (point-max)))
(widen))
(goto-char pos)
- (pulse-momentary-highlight-one-line pos 'ms-highlight)
+ (ms--base-buffer-highlight-line)
;; TODO maybe only two of these are actually necessary
(org-fold-show-context)
(org-fold-show-entry)
- [nongnu] elpa/dslide 5cce77b4eb 032/230: some readme updates, (continued)
- [nongnu] elpa/dslide 5cce77b4eb 032/230: some readme updates, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 86fb3a7e0d 056/230: Pass an :inline argument to every child action, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 280b028e11 065/230: !dirty, pre-refactor commit to comment on architecture, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide aea35ee8e7 073/230: line-noise renaming, comments..., ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 3945a6a759 061/230: assorted doc noise and one change to be consistent with docstring, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 3d52359eb9 066/230: Babel blocks can run multiple end, init, and final blocks, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 997fc0905a 106/230: results none is preferable during presentation, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 2650f33a78 100/230: success & error highlights for babel slides, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide a9052e5ae2 129/230: demo directions a bit more interactive and clear, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 56fde60604 120/230: dslide-contents-header -> dslide-header, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 98c9c95505 099/230: custom implementation of pulse,
ELPA Syncer <=
- [nongnu] elpa/dslide 5c4728025e 111/230: dslide-backward -> dslide-presentation-backward, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide e38a7ff5ac 125/230: Introduction in demo, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 4a85855383 133/230: remove redundant :after, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide d6f732a080 145/230: collect animation code, use the centralized error indication, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 9cc2872b4b 050/230: update readme to reflect reality, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide b8a70b893d 052/230: options for image action, include-linked, refresh, kill-buffer, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide af7169b85b 044/230: helpful package high-level comments, ELPA Syncer, 2024/07/07
- [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