]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix use of 'switch-to-buffer-preserve-window-point'
authorZajcev Evgeny <zevlg@yandex.ru>
Tue, 1 Dec 2020 08:33:05 +0000 (09:33 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Tue, 1 Dec 2020 08:33:05 +0000 (09:33 +0100)
* lisp/window.el (switch-to-buffer): Respect buffer local value
of 'switch-to-buffer-preserve-window-point' variable.

lisp/window.el

index 82976bf8364aac1a5b0481885e2d2551eed1ffe9..daa5c67df8be2170eddf58bc207c07c1622b9eba 100644 (file)
@@ -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)