From 8a27b0cad7dcffd0af9b3b38028ac12276a85c1b Mon Sep 17 00:00:00 2001 From: Zajcev Evgeny Date: Tue, 1 Dec 2020 09:33:05 +0100 Subject: [PATCH] Fix use of 'switch-to-buffer-preserve-window-point' * lisp/window.el (switch-to-buffer): Respect buffer local value of 'switch-to-buffer-preserve-window-point' variable. --- lisp/window.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 82976bf8364..daa5c67df8b 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8566,13 +8566,13 @@ Return the buffer switched to." (when set-window-start-and-point (let* ((entry (assq buffer (window-prev-buffers))) - (displayed (and (eq switch-to-buffer-preserve-window-point - 'already-displayed) + (preserve-win-point + (buffer-local-value 'switch-to-buffer-preserve-window-point + buffer)) + (displayed (and (eq preserve-win-point 'already-displayed) (get-buffer-window buffer 0)))) (set-window-buffer nil buffer) - (when (and entry - (or (eq switch-to-buffer-preserve-window-point t) - displayed)) + (when (and entry (or (eq preserve-win-point t) displayed)) ;; Try to restore start and point of buffer in the selected ;; window (Bug#4041). (set-window-start (selected-window) (nth 1 entry) t) -- 2.39.5