aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2022-06-09 09:40:52 +0300
committerJuri Linkov2022-06-09 09:41:52 +0300
commitd7270b4445778b10a4d8ff9516dfa188ceeecf31 (patch)
tree4157670768c97767ed622fce1b251604394cf946
parentec987e3e1786d06ffd306e5717b4d7fd118f05ac (diff)
downloademacs-d7270b4445778b10a4d8ff9516dfa188ceeecf31.tar.gz
emacs-d7270b4445778b10a4d8ff9516dfa188ceeecf31.zip
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
-rw-r--r--lisp/window.el3
1 files changed, 3 insertions, 0 deletions
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."
8931 (let* ((old-window (or (minibuffer-selected-window) (selected-window))) 8931 (let* ((old-window (or (minibuffer-selected-window) (selected-window)))
8932 (new-window nil) 8932 (new-window nil)
8933 (minibuffer-depth (minibuffer-depth)) 8933 (minibuffer-depth (minibuffer-depth))
8934 (obey-display switch-to-buffer-obey-display-actions)
8934 (clearfun (make-symbol "clear-display-buffer-overriding-action")) 8935 (clearfun (make-symbol "clear-display-buffer-overriding-action"))
8935 (postfun (make-symbol "post-display-buffer-override-next-command")) 8936 (postfun (make-symbol "post-display-buffer-override-next-command"))
8936 (action (lambda (buffer alist) 8937 (action (lambda (buffer alist)
@@ -8955,6 +8956,7 @@ to deactivate this overriding action."
8955 (funcall post-function old-window new-window))))) 8956 (funcall post-function old-window new-window)))))
8956 (fset clearfun 8957 (fset clearfun
8957 (lambda () 8958 (lambda ()
8959 (setq switch-to-buffer-obey-display-actions obey-display)
8958 (setcar display-buffer-overriding-action 8960 (setcar display-buffer-overriding-action
8959 (delq action (car display-buffer-overriding-action))))) 8961 (delq action (car display-buffer-overriding-action)))))
8960 (fset postfun 8962 (fset postfun
@@ -8971,6 +8973,7 @@ to deactivate this overriding action."
8971 (add-hook 'post-command-hook postfun) 8973 (add-hook 'post-command-hook postfun)
8972 (when echofun 8974 (when echofun
8973 (add-hook 'prefix-command-echo-keystrokes-functions echofun)) 8975 (add-hook 'prefix-command-echo-keystrokes-functions echofun))
8976 (setq switch-to-buffer-obey-display-actions t)
8974 (push action (car display-buffer-overriding-action)) 8977 (push action (car display-buffer-overriding-action))
8975 exitfun)) 8978 exitfun))
8976 8979