all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87zh8txsdc.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvr1u68mci.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 23 Jun 2020 00:09:06 -0400")

>>> 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	other threads:[~2020-06-23 23:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200621233622.23590.68753@vcs0.savannah.gnu.org>
     [not found] ` <20200621233623.C811520A26@vcs0.savannah.gnu.org>
2020-06-22  0:29   ` master ce4ec17: Fix display-buffer-override-next-command to call action only once (bug#39722) Stefan Monnier
2020-06-22  0:35     ` Juri Linkov
2020-06-22  3:38       ` Stefan Monnier
2020-06-23  0:01         ` Juri Linkov
2020-06-23  4:09           ` Stefan Monnier
2020-06-23 23:45             ` Juri Linkov [this message]
2020-06-24  5:14               ` Stefan Monnier
2020-06-24 23:58                 ` Juri Linkov
2020-06-28 22:14                   ` Juri Linkov
2020-06-29 12:29                     ` Stefan Monnier
2020-06-29 22:43                       ` Juri Linkov
2020-06-30  2:48                         ` Stefan Monnier
2020-06-30  8:52                           ` Kévin Le Gouguec
2020-06-30 21:31                           ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh8txsdc.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.