emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master ce4ec17: Fix display-buffer-override-next-command to call act


From: Juri Linkov
Subject: Re: master ce4ec17: Fix display-buffer-override-next-command to call action only once (bug#39722)
Date: Wed, 24 Jun 2020 02:45:19 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>> I'm not sure how.  I think `C-x 4 4` followed by `C-u` will work thanks
>>> to the (eq this-command command) check (because
>>> `prefix-command-preserve-state` does (setq this-command last-command)),
>>> but I don't think the reverse will work.
>> Could you give an example of a key sequence where this might not work?
>
> `C-u C-x 5 5 C-x =` won't display the extra info requested by the `C-u`.
>
> You can still get it with `C-x 5 5 C-u C-x =`, but the user shouldn't
> have to remember in which order prefix commands need to be entered.

The feature was intentionally designed this way for several reasons:

1. it should be easier for the users to build the key sequence
   when the prefix is in front of the main command key sequence,
   not before the command that requests a new window/frame;

2. to allow adding arguments to the commands `C-x 4 4` and `C-x 5 5`.

The design was based on the existing command `windmove-display-in-direction`
where the prefix arg can be given to not select the displayed window.

Similarly, the prefix arg could be added to `C-x 4 4` and `C-x 5 5`
to request displaying the buffer in another window/frame,
but not to select the displayed window.

Then `C-u C-x 5 5 C-u C-x =` will display the Help buffer in another frame
without selecting it.

>> display-buffer-overriding-action has exactly the same format as
>> display-buffer-fallback-action, and display-buffer-fallback-action
>> holds a list of actions:
>>
>>   (defconst display-buffer-fallback-action
>>     '((display-buffer--maybe-same-window  ;FIXME: why isn't this redundant?
>>        display-buffer-reuse-window
>>        display-buffer--maybe-pop-up-frame-or-window
>>        display-buffer-in-previous-window
>>        display-buffer-use-some-window
>>        ;; If all else fails, pop up a new frame.
>>        display-buffer-pop-up-frame))
>
> Look again!  This is not a list of functions: it's a cons cell whose car
> is a list of functions.

It seems currently it works because no other code tries to modify
display-buffer-overriding-action, but really functions should be added
to the car of display-buffer-overriding-action, or maybe even better
not to add but replace display-buffer-overriding-action with own value.

>> Incidentally, the echo area feedback and the extra transient keymap
>> is exactly what is currently discussed for project-switch-project
>> where `C-x p p` displays a short menu in the echo area and reads keys
>> to run commands from the project.el prefix keymap.
>
> I was referring to the each area info also displayed by `C-u`, via
> `prefix-command-echo-keystrokes-functions`.  Nothing fancy like a menu:
> just a brief mention to reflect the fact that a prefix command is "about
> to be applied".

Currently `C-x 5 5` just displays the message before the next command:

  "Display next command buffer in a new frame..."

but using `prefix-command-echo-keystrokes-functions` it could display
"[other-frame]" like other-frame-window does for every following key press.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]