From: Jürgen Hartmann Date: Tue, 23 Jun 2015 15:43:58 +0000 (+0200) Subject: Respect ‘switch-to-visible-buffer’ more rigidly. (Bug#20861) X-Git-Tag: emacs-25.0.90~1666 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=abe07ef01ccb61968e6aebc1178dbefb683a27ae;p=emacs.git Respect ‘switch-to-visible-buffer’ more rigidly. (Bug#20861) * lisp/window.el (switch-to-visible-buffer): Doc adjustment. (switch-to-prev-buffer, switch-to-next-buffer): Respect switch-to-visible-buffer independent of the windows history. Copyright-paperwork-exempt: yes --- diff --git a/lisp/window.el b/lisp/window.el index 6e4571167ea..a4ed9ea7216 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -3874,12 +3874,10 @@ before was current this also makes BUFFER the current buffer." (defcustom switch-to-visible-buffer t "If non-nil, allow switching to an already visible buffer. If this variable is non-nil, `switch-to-prev-buffer' and -`switch-to-next-buffer' may switch to an already visible buffer -provided the buffer was shown before in the window specified as -argument to those functions. If this variable is nil, -`switch-to-prev-buffer' and `switch-to-next-buffer' always try to -avoid switching to a buffer that is already visible in another -window on the same frame." +`switch-to-next-buffer' may switch to an already visible buffer. +If this variable is nil, `switch-to-prev-buffer' and +`switch-to-next-buffer' always try to avoid switching to a buffer +that is already visible in another window on the same frame." :type 'boolean :version "24.1" :group 'windows) @@ -3950,7 +3948,8 @@ to it." (or (null pred) (funcall pred buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) (or bury-or-kill (not (memq buffer next-buffers)))) - (if (get-buffer-window buffer frame) + (if (and (not switch-to-visible-buffer) + (get-buffer-window buffer frame)) ;; Try to avoid showing a buffer visible in some other window. (unless visible (setq visible buffer)) @@ -4052,7 +4051,8 @@ found." (or (null pred) (funcall pred buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) (not (assq buffer (window-prev-buffers window)))) - (if (get-buffer-window buffer frame) + (if (and (not switch-to-visible-buffer) + (get-buffer-window buffer frame)) ;; Try to avoid showing a buffer visible in some other window. (setq visible buffer) (setq new-buffer buffer)