[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 9874ec8263 204/230: Recenter follow buffer on slide
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 9874ec8263 204/230: Recenter follow buffer on slide change |
Date: |
Sun, 7 Jul 2024 19:00:39 -0400 (EDT) |
branch: elpa/dslide
commit 9874ec8263b466f910200cdb8972127c8d2be9da
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
Recenter follow buffer on slide change
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
dslide.el | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/dslide.el b/dslide.el
index ab583dbbf7..b16ddff7cb 100644
--- a/dslide.el
+++ b/dslide.el
@@ -722,6 +722,7 @@ Class can be overridden to affect root behaviors. See
(error "No slide selected"))
(let ((inhibit-redisplay t)
+ (old-point-min (point-min))
progress
reached-end)
(while dslide--step-overlays
@@ -762,7 +763,7 @@ Class can be overridden to affect root behaviors. See
;; message.
(when progress
(dslide--feedback :forward)
- (dslide--follow progress))
+ (dslide--follow progress (not (= old-point-min (point-min)))))
(when reached-end
(dslide--feedback :after-last-slide)
@@ -783,6 +784,7 @@ Class can be overridden to affect root behaviors. See
;; backwards is desirable.
(let ((inhibit-redisplay t)
+ (old-point-min (point-min))
progress
reached-beginning)
(while dslide--step-overlays
@@ -825,7 +827,7 @@ Class can be overridden to affect root behaviors. See
;; message.
(cond (progress
(dslide--feedback :backward)
- (dslide--follow progress))
+ (dslide--follow progress (not (= old-point-min (point-min)))))
(reached-beginning
(user-error "No more previous slides!")))))
@@ -2728,10 +2730,11 @@ Optional FACE defaults to `dslide-highlight'."
(set-buffer buffer)))
;; TODO use this to implement `dslide-goto'
-(defun dslide--follow (progress)
+(defun dslide--follow (progress &optional scroll)
"Set the base buffer window point to PROGRESS.
PROGRESS is a slide object, marker, buffer position, org element,
-org object or boolean (which will be ignored)."
+org object or boolean (which will be ignored). Optional scroll
+will advance the windows to the current buffer restriction"
(unless (dslide-live-p)
(error "Live deck not found"))
(let ((pos (cond ((integerp progress) progress)
@@ -2745,6 +2748,8 @@ org object or boolean (which will be ignored)."
(when (and (not (booleanp progress)) (null pos))
(message "Incomprehensible progress reported: %s" progress))
(when (and pos dslide-base-follows-slide)
+ (set-buffer (oref dslide--deck slide-buffer))
+ (setq slide-buffer-point-min (point-min))
(set-buffer (oref dslide--deck base-buffer))
(unless (and (>= pos (point-min))
(<= pos (point-max)))
@@ -2756,7 +2761,14 @@ org object or boolean (which will be ignored)."
(org-fold-show-entry)
(org-fold-show-subtree)
(when-let ((windows (get-buffer-window-list (current-buffer) nil t)))
- (mapc (lambda (w) (set-window-point w pos)) windows))
+ (mapc (lambda (w)
+ (set-window-point w pos)
+ (when scroll
+ (with-selected-window w
+ (goto-char slide-buffer-point-min)
+ ;; TODO 10 is completely arbitrary
+ (recenter 10))))
+ windows))
(set-buffer (oref dslide--deck slide-buffer)))))
(defun dslide-display-contents ()
- [nongnu] elpa/dslide 32547dbe24 176/230: Remove child actions (pretty major refactor), (continued)
- [nongnu] elpa/dslide 32547dbe24 176/230: Remove child actions (pretty major refactor), ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide f9a1c47bf7 179/230: Get rid of redundant parent slot on slides, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 7784e7ad06 183/230: introducing every-child slide action, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide c9eeb66a9e 187/230: No-header slide action was incorrect in the demo, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 20c4a44f18 184/230: line noise, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 09b750ae6c 189/230: attempted to clean up some misinformation and update recommendations, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide ef1421cb82 190/230: Version 0.5.1, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide f529a1ed6b 193/230: Video url, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide ed197cf5cc 191/230: Finalize the current slide before displaying contents, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide baedd89de4 195/230: macro expansion was creating an unused expression, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 9874ec8263 204/230: Recenter follow buffer on slide change,
ELPA Syncer <=
- [nongnu] elpa/dslide 8dd7b6490b 206/230: enable clearing results going backward and after exiting the slide, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 41a5681e00 210/230: compiler warning, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 2b5c56ab84 219/230: use sub-headings for demos, some drive-by, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide d0e1177ab5 218/230: ensure correct scroll position in all windows, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0aac570ba0 211/230: punching a compiler warning, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide ce3805d697 216/230: remove sneaky plus symbols from applying patch manually, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 25a0f79723 213/230: adminsitrative & version bump, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 54e2a8fdc4 230/230: readme fixups., ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 907e004bca 226/230: Configurable header function, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 8f56d6914d 221/230: Fix fat-finger in d0e1177, ELPA Syncer, 2024/07/07