Function: same-window-prefix
same-window-prefix is an interactive and byte-compiled function
defined in window.el.gz.
Signature
(same-window-prefix)
Documentation
Display the buffer of the next command in the same window.
The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Even when the default rule should display the buffer in a new window,
force its display in the already selected window.
When switch-to-buffer-obey-display-actions is non-nil,
switch-to-buffer commands are also supported.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun same-window-prefix ()
"Display the buffer of the next command in the same window.
The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Even when the default rule should display the buffer in a new window,
force its display in the already selected window.
When `switch-to-buffer-obey-display-actions' is non-nil,
`switch-to-buffer' commands are also supported."
(interactive)
(display-buffer-override-next-command
(lambda (buffer alist)
(setq alist (append '((inhibit-same-window . nil)) alist))
(cons (or
(display-buffer-same-window buffer alist)
(display-buffer-use-some-window buffer alist))
'reuse))
nil "[same-window]")
(message "Display next command buffer in the same window..."))