unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: "Omar Antolín Camarena" <omar@matem.unam.mx>
Cc: 45035@debbugs.gnu.org
Subject: bug#45035: 28.0.50; Command completion annotations show minibuffer keybindings
Date: Sat, 05 Dec 2020 22:51:41 +0200	[thread overview]
Message-ID: <875z5gdkky.fsf@mail.linkov.net> (raw)
In-Reply-To: <87k0ty2xnw.fsf@matem.unam.mx> ("Omar Antolín Camarena"'s message of "Thu, 03 Dec 2020 19:00:03 -0600")

> If from M-x you switch to the *Completions* buffer, it will show
> keybindings as annotations next to the command names. Unfortunately, it
> shows the key bindings that are active in the minibuffer, while it would
> be more useful to show the keybindings active in the buffer in which you pressed M-x.
>
> Here's a simple recipe to see the issue from emacs -Q:
>
> Run emacs -Q. You will have eval-print-last-sexp bound to C-j in the
> scratch buffer, and minibuffer-complete-and-exit bound to C-j in the
> minibuffer, of course.
>
> Try this: while in the scratch buffer, type M-x and part of either of
> those two commands, and then press M-v to switch to the *Completions*
> buffer. For eval-print-last-sexp you'll see no annotation, and for
> minibuffer-complete-and-exit you'll see C-j.
>
> This illustrates the fact that the key bindings in the annotation are
> those from the minibuffer.
>
> The problem is that when the function read-extended-command--annotation
> is called, the minibuffer is active. If people agree that it would be
> better to show the key bindings in the last buffer active before the
> minibuffer, one way to get this behavior is by modifying
> minibuffer-completion-help. That function obtains the
> annotation-function metadatum and stores it in a variable called afun.
> The form that actually calls afun could be wrapped in with-minibuffer-selected-window, for example.

Thanks, I think your idea is correct.  But I'm not sure if
minibuffer-completion-help is the right place for wrapping in
with-minibuffer-selected-window.  This means that all calls of
annotation-function will be in the original buffer, whereas
only read-extended-command--annotation needs such wrapping.

Or do you care that such wrapping will be called for every command
in read-extended-command--annotation?  Then instead of annotation-function
you could try to use a new function affixation-function that is called
only once, so you could add wrapping to it.





  reply	other threads:[~2020-12-05 20:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04  1:00 bug#45035: 28.0.50; Command completion annotations show minibuffer keybindings Omar Antolín Camarena
2020-12-05 20:51 ` Juri Linkov [this message]
2020-12-07  2:50   ` Omar Antolín Camarena
2020-12-16  9:15     ` Juri Linkov
2020-12-16 21:27       ` Omar Antolín Camarena
2020-12-16 21:27       ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=875z5gdkky.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=45035@debbugs.gnu.org \
    --cc=omar@matem.unam.mx \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).