From: Martin Rudalics Date: Sun, 23 Jun 2024 08:26:57 +0000 (+0200) Subject: Fix a bug in 'switch-to-buffer' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c3d3f5fe6b4ffb32ccd846ec8031859a960e50d9;p=emacs.git Fix a bug in 'switch-to-buffer' * 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) --- diff --git a/lisp/window.el b/lisp/window.el index e25704f4386..27833c4e4cd 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -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