GNU bug report logs -
#39035
Show key bindings on M-x completion
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Wed, 8 Jan 2020 10:18:01 UTC
Severity: wishlist
Tags: fixed
Fixed in version 28.1
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 39035 <at> debbugs.gnu.org (full text, mbox):
> Indeed, not hard at all:
Looks about right, thanks.
> + (if (and suggest-key-bindings (eq action 'metadata))
> + '(metadata
> + (annotation-function . read-extended-command--annotation)
> + (category . suggest-key-bindings))
The `category` should describe the things that are being completed,
i.e. `command` rather than `suggest-key-bindings`.
> +(defun read-extended-command--annotation (command-name)
> + (let* ((function (and (stringp command-name) (intern-soft command-name)))
> + (binding (where-is-internal function overriding-local-map t)))
> + (when binding
> + (format " (%s)" (if (stringp binding)
> + (concat "M-x " binding " RET")
> + (key-description binding))))))
Since we're in the middle of a `M-x`, I think a `M-x foo RET` annotation
would not be useful at all: better not put anything when a command has
no corresponding key binding (one could argue that it could be useful to
put the `M-x <shortenedname> RET` like `M-x re-u RET` for
`rename-uniquely`, but it would be too costly to compute and still
wouldn't be terribly useful).
Stefan
This bug report was last modified 5 years and 198 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.