]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow C-x 4 4, C-x 5 5, C-x t t to handle commands that use switch-to-buffer
authorJuri Linkov <juri@linkov.net>
Thu, 9 Jun 2022 06:40:52 +0000 (09:40 +0300)
committerJuri Linkov <juri@linkov.net>
Thu, 9 Jun 2022 06:41:52 +0000 (09:41 +0300)
* 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

lisp/window.el

index 1b8fe2b26288e09f7c52fe9048d6a420140bb4b5..eba888a89dd6e8e121cf3caea40dfe85e8f6f28f 100644 (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))