emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/scroll-on-jump a614bc7f8f 06/31: Fix the case when the win


From: ELPA Syncer
Subject: [nongnu] elpa/scroll-on-jump a614bc7f8f 06/31: Fix the case when the windows buffer is not the current-buffer
Date: Thu, 7 Jul 2022 12:03:12 -0400 (EDT)

branch: elpa/scroll-on-jump
commit a614bc7f8f31272b5675f268f8f9774c7da04d30
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Fix the case when the windows buffer is not the current-buffer
    
    This happens when opening a help window `C-h, f` for example.
    
    In this case the window position isn't a point that can be used
    in the current buffer.
---
 scroll-on-jump.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/scroll-on-jump.el b/scroll-on-jump.el
index dc8472ed0c..7a3f1f3c42 100644
--- a/scroll-on-jump.el
+++ b/scroll-on-jump.el
@@ -390,7 +390,6 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as 
well."
   `
   (let
     ( ;; Set in case we have an error.
-      (err-value nil)
       (buf (current-buffer))
       (window (selected-window))
 
@@ -413,20 +412,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)))
+      (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)))
+          (goto-char point-next))
         (t
           ;; Calculate the new window start.
-          (scroll-on-jump-auto-center window point-prev point-next)))
-
-      (when err-value
-        ;; Re-raise the error.
-        (signal (car err-value) (cdr err-value))))))
+          (scroll-on-jump-auto-center window point-prev point-next))))))
 
 ;;;###autoload
 (defmacro scroll-on-jump-interactive (fn)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]