From: Juri Linkov Date: Thu, 9 Jun 2022 06:40:52 +0000 (+0300) Subject: Allow C-x 4 4, C-x 5 5, C-x t t to handle commands that use switch-to-buffer X-Git-Tag: emacs-29.0.90~1910^2~139 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d7270b4445778b10a4d8ff9516dfa188ceeecf31;p=emacs.git 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 --- diff --git a/lisp/window.el b/lisp/window.el index 1b8fe2b2628..eba888a89dd 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -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))