[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scroll-on-jump ea74496fa1 10/31: Fix recursive calls to an
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scroll-on-jump ea74496fa1 10/31: Fix recursive calls to animate scrolling |
Date: |
Thu, 7 Jul 2022 12:03:12 -0400 (EDT) |
branch: elpa/scroll-on-jump
commit ea74496fa172783f27c8ae509f84398e151bfb28
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Fix recursive calls to animate scrolling
It's possible that advice to animate scrolling is called
from a function which is already animating scrolling.
In this case only respect the outer-most call to perform animation.
---
scroll-on-jump.el | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/scroll-on-jump.el b/scroll-on-jump.el
index 6925bc72f4..5bf22eb27f 100644
--- a/scroll-on-jump.el
+++ b/scroll-on-jump.el
@@ -395,9 +395,7 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(window (selected-window))
(point-prev (point))
- (point-next nil)
-
- (has-context-changed t))
+ (point-next nil))
(prog1
(save-excursion
@@ -413,20 +411,20 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
,@body)
(setq point-next (point))))
- (when
- (and
- (eq buf (current-buffer))
- (eq window (selected-window))
- (eq buf (window-buffer window)))
- (setq has-context-changed nil))
-
(cond
- (has-context-changed
- ;; Context changed, use a fallback.
- (goto-char point-next))
- (t
- ;; Calculate the new window start.
- (scroll-on-jump-auto-center window point-prev point-next))))))
+ ( ;; Perform animated scroll.
+ (and
+ ;; Buffer/Context changed.
+ (eq buf (window-buffer window)) (eq buf (current-buffer)) (eq
window (selected-window))
+
+ ;; Disallow recursion.
+ (not (boundp 'scroll-on-jump--resurse)))
+
+ (let ((scroll-on-jump--resurse t))
+ (scroll-on-jump-auto-center window point-prev point-next)))
+
+ (t ;; Context changed or recursed, simply jump.
+ (goto-char point-next))))))
;;;###autoload
(defmacro scroll-on-jump-interactive (fn)
- [nongnu] elpa/scroll-on-jump a2d6996a36 24/31: Cleanup: use defgroup, (continued)
- [nongnu] elpa/scroll-on-jump a2d6996a36 24/31: Cleanup: use defgroup, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 7b2919f8d8 27/31: Fix smooth (pixel) scrolling not being used in most cases, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 1f2349edf4 04/31: Fix scrolling down when the point is at the beginning of the buffer, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump e8b79d35d4 09/31: Cleanup: split scroll-on-jump--scroll-impl into it's own function, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 028e672391 03/31: Cleanup: no need for `let*`, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump eb77ab1920 02/31: readme: add a more complete example, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 9c333320ea 05/31: Don't catch and re-raise errors, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 7a51468bdd 14/31: Cleanup: declare variable, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 0cf26a15bb 26/31: Cleanup: use window-body-height, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump df8b208ba7 16/31: readme: add melpa link, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump ea74496fa1 10/31: Fix recursive calls to animate scrolling,
ELPA Syncer <=
- [nongnu] elpa/scroll-on-jump 055144ca83 12/31: Disable moving the point when the destination point doesn't move, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-jump 30e23e8694 01/31: Initial commit, ELPA Syncer, 2022/07/07