1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-08 08:43:52 -08:00

Allow C-x 4 4, C-x 5 5, C-x t t to handle commands that use switch-to-buffer

* lisp/window.el (display-buffer-override-next-command):
Temporarily set switch-to-buffer-obey-display-actions to t,
and revert back to the original value afterwards.
This allows other-window-prefix, other-frame-prefix, other-tab-prefix,
windmove-display-in-direction to override the default behavior of
commands that use switch-to-buffer.
https://lists.gnu.org/archive/html/emacs-devel/2022-06/msg00483.html
This commit is contained in:
Juri Linkov 2022-06-09 09:40:52 +03:00
parent ec987e3e17
commit d7270b4445

View file

@ -8931,6 +8931,7 @@ to deactivate this overriding action."
(let* ((old-window (or (minibuffer-selected-window) (selected-window)))
(new-window nil)
(minibuffer-depth (minibuffer-depth))
(obey-display switch-to-buffer-obey-display-actions)
(clearfun (make-symbol "clear-display-buffer-overriding-action"))
(postfun (make-symbol "post-display-buffer-override-next-command"))
(action (lambda (buffer alist)
@ -8955,6 +8956,7 @@ to deactivate this overriding action."
(funcall post-function old-window new-window)))))
(fset clearfun
(lambda ()
(setq switch-to-buffer-obey-display-actions obey-display)
(setcar display-buffer-overriding-action
(delq action (car display-buffer-overriding-action)))))
(fset postfun
@ -8971,6 +8973,7 @@ to deactivate this overriding action."
(add-hook 'post-command-hook postfun)
(when echofun
(add-hook 'prefix-command-echo-keystrokes-functions echofun))
(setq switch-to-buffer-obey-display-actions t)
(push action (car display-buffer-overriding-action))
exitfun))