[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 393985506a 021/230: After-narrow-hook
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 393985506a 021/230: After-narrow-hook |
Date: |
Sun, 7 Jul 2024 19:00:09 -0400 (EDT) |
branch: elpa/dslide
commit 393985506af71d165a025bded24a9441e2c74d9f
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
After-narrow-hook
Whenever restriction is updated, run the after-narrow-hook
Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
macro-slides.el | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/macro-slides.el b/macro-slides.el
index 0ae961c685..beeb81e23d 100644
--- a/macro-slides.el
+++ b/macro-slides.el
@@ -259,6 +259,12 @@ contents. It is run after any slide actions."
:group 'macro-slides
:type 'hook)
+(defcustom ms-narrow-hook nil
+ "Runs whenever the slide buffer restriction is updated.
+Use this hook for behaviors that affect the displayed region.
+Slides and sequences that do not display themselves or only
+affect display in another buffer will not trigger this hook.")
+
(defcustom ms-contents-hook nil
"Runs last after switching to contents."
:group 'macro-slides
@@ -833,7 +839,9 @@ their init."
;; already
(error "No slide selected"))
- (let (progress reached-end)
+ (let ((restriction-min (point-min))
+ (restriction-max (point-max))
+ progress reached-end)
;; Burn up a step callback until one returns non-nil
(when-let ((steps (and (slot-boundp obj 'step-callbacks)
(oref obj step-callbacks))))
@@ -903,6 +911,10 @@ their init."
;; A lot of progress may have happened, but there will be only one feedback
;; message.
(when progress
+ ;; If the restriction was updated, call the after-narrow hook
+ (when (not (and (= restriction-min (point-min))
+ (= restriction-max (point-max))))
+ (run-hooks 'ms-narrow-hook))
(ms--feedback :forward))
(when reached-end
@@ -922,7 +934,9 @@ their init."
;; and they should implement an actual `ms-end' method as well as idempotent
;; `ms-init' and `ms-final' if any support for going backwards is disireable.
- (let (progress reached-beginning)
+ (let ((restriction-min (point-min))
+ (restriction-max (point-max))
+ progress reached-beginning)
;; Burn up a step callback until one returns non-nil
(when-let ((steps (and (slot-boundp obj 'step-callbacks)
(oref obj step-callbacks))))
@@ -1001,6 +1015,10 @@ their init."
;; A lot of progress may have happened, but there will be only one feedback
;; message.
(cond (progress
+ ;; If the restriction was updated, call the after-narrow hook
+ (when (not (and (= restriction-min (point-min))
+ (= restriction-max (point-max))))
+ (run-hooks 'ms-narrow-hook))
(ms--feedback :backward))
(reached-beginning
(user-error "No more previous slides!")))))
- [nongnu] elpa/dslide 015796186f 048/230: !fixme Not sure if this is necessary. Shipping my last tested., (continued)
- [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
- [nongnu] elpa/dslide 393985506a 021/230: After-narrow-hook,
ELPA Syncer <=
- [nongnu] elpa/dslide dddbc58e20 020/230: The repackaging. org-tree-slide -> macro-slides, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 10ee601187 007/230: enable lexical binding, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide b9219d205c 023/230: typos, comments, line-noise, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 1dbbed70f8 025/230: missing custom group & type, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 63d93ec6bf 028/230: Dead code on slide, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 9a67bc2f3e 026/230: line noise, compiler warnings, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 3e7ceb0845 024/230: missing deps, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 1d8041aba1 027/230: Sequence (slide) callbacks, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide da4e8dd412 016/230: user error instead of silent failure, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 018b39cfa5 030/230: Remove some coupling between actions and slides, ELPA Syncer, 2024/07/07