From ee297210cffb9e8d05912686a39fa158414ba050 Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Thu, 26 May 2016 21:47:18 -0400 Subject: [PATCH] Preserve buffer point in windows by default (Bug#4041). * doc/lispref/windows.texi: Mention new default. * etc/NEWS: Mention new default. * lisp/window.el (switch-to-buffer-preserve-window-point): Default to t. --- doc/lispref/windows.texi | 5 +++-- etc/NEWS | 3 +++ lisp/window.el | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 9a09b35371..015c557ef6 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -2171,8 +2171,9 @@ This option does not affect non-interactive calls of @code{switch-to-buffer}. @end defopt -By default, @code{switch-to-buffer} shows the buffer at its position of -@code{point}. This behavior can be tuned using the following option. +By default, @code{switch-to-buffer} tries to preserve +@code{window-point}. This behavior can be tuned using the following +option. @defopt switch-to-buffer-preserve-window-point If this variable is @code{nil}, @code{switch-to-buffer} displays the diff --git a/etc/NEWS b/etc/NEWS index d1eadd56a2..56f0ef8de2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -176,6 +176,9 @@ where you can cancel them with the 'c' command. ** The new function 'read-multiple-choice' prompts for multiple-choice questions, with a handy way to display help texts. ++++ +** 'switch-to-buffer-preserve-window-point' now defaults to t. + * Editing Changes in Emacs 25.2 diff --git a/lisp/window.el b/lisp/window.el index bd5275bffc..f699e21fd3 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7147,7 +7147,7 @@ buffer with the name BUFFER-OR-NAME and return that buffer." buffer)) (other-buffer))) -(defcustom switch-to-buffer-preserve-window-point nil +(defcustom switch-to-buffer-preserve-window-point t "If non-nil, `switch-to-buffer' tries to preserve `window-point'. If this is nil, `switch-to-buffer' displays the buffer at that buffer's `point'. If this is `already-displayed', it tries to -- 2.39.2