]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix a bug in 'switch-to-buffer'
authorMartin Rudalics <rudalics@gmx.at>
Sun, 23 Jun 2024 08:26:57 +0000 (10:26 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 24 Jun 2024 07:07:20 +0000 (09:07 +0200)
* lisp/window.el (switch-to-buffer): When asked to switch to the
buffer of the selected window,
'switch-to-buffer-obey-display-actions' is non-nil and
'pop-to-buffer' uses the selected window, don't try to restore
window start and point from 'window-prev-buffers' (Bug#71616).

(cherry picked from commit 5f8a9cd4b6f4441c158a750ad7c5b937b559edd4)

lisp/window.el

index e25704f438650068bf1466966a7eb9d5bdab840c..27833c4e4cd078a61b963e29414a36d85882b269 100644 (file)
@@ -9180,9 +9180,14 @@ Return the buffer switched to."
         (pop-to-buffer buffer norecord)))
      (t
       (when switch-to-buffer-obey-display-actions
-        (let ((selected-window (selected-window)))
+        (let* ((selected-window (selected-window))
+              (old-window-buffer (window-buffer selected-window)))
           (pop-to-buffer-same-window buffer norecord)
-          (when (eq (selected-window) selected-window)
+         ;; Do not ask for setting start and point when showing the
+         ;; same buffer in the old selected window (Bug#71616).
+          (when (and (eq (selected-window) selected-window)
+                    (not (eq (window-buffer selected-window)
+                             old-window-buffer)))
             (setq set-window-start-and-point t))))
 
       (when set-window-start-and-point