GNU bug report logs -
#45035
28.0.50; Command completion annotations show minibuffer keybindings
Previous Next
Reported by: Omar Antolín Camarena <omar <at> matem.unam.mx>
Date: Fri, 4 Dec 2020 01:01:02 UTC
Severity: normal
Tags: fixed
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> 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.
This bug report was last modified 4 years and 159 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.