[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding missing C-x 5 C-j and C-x t C-j commands
From: |
Juri Linkov |
Subject: |
Re: Adding missing C-x 5 C-j and C-x t C-j commands |
Date: |
Wed, 08 Jun 2022 19:08:24 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>>> I have a question the other way. I forgot that `C-x 5 .'
>>> exists and tried `C-x 5 5 M-.' and was surprised to find it
>>> didn't work (it opened in the same frame as if I just did
>>> `M-.'. Is it supposed to work or should I open a bug?
>>
>> It does the right thing after customizing
>> switch-to-buffer-obey-display-actions to t.
>
> Yes I see that too.
>
>> Maybe its default value should be changed to t?
>
> At least the docstring of other-frame-prefix (and friends) should
> be clearer about it's effect. I don't think I'm supposed to know
> which commands use switch-to-buffer internally.
Maybe more commands should use pop-to-buffer-same-window
instead of switch-to-buffer. But OTOH, too much commands
already use switch-to-buffer.
> If the default value isn't changed, maybe other-frame-prefix
> should let bind it to t since if you're using it you presumably
> want a new frame. Same for the window and tab variants.
> project.el seems to do this in project--other-place-command
> which the project-other-{frame,window,tab}-commands use.
I'm not sure if the default value can be changed,
but you are right about other-frame-prefix.
I didn't know that project--other-place-command
let binds it to t. But doing the same is not possible
in other-frame-prefix, that just sets a display action
for the next command. So a more elaborate fix is required:
diff --git a/lisp/window.el b/lisp/window.el
index 1b8fe2b262..eba888a89d 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8931,6 +8931,7 @@ display-buffer-override-next-command
(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 @@ display-buffer-override-next-command
(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 @@ display-buffer-override-next-command
(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))