Emacs has had suggesting keybindings for some time (according to git
blame
, about four years): if you M-x some command, and that command has a keybinding, it will show sth like
You can run the command ‘find-file’ with C-x C-f
for two seconds (by default). It is quite nice, non-intrusive and helpful.
Emacs 25.1 took that to the next level. When you M-x some command now, and it is possible to M-x it with much fewer keystrokes (thanks to autocompletion), a message like
You can run the command ‘emacs-uptime’ with M-x -upt RET
will be shown.
And for some reason I don’t like it. Not that it’s bad; it’s not, and it can be useful. I just find it annoying sometimes, especially that it does not play well with Ivy: in stock Emacs, it will not annoy you if your way of invoking the command is not much longer that the optimum, and with Ivy this mechanism somehow won’t work. Anyway, it turns out that it’s easy to disable: just put this line
(setq extended-command-suggest-shorter nil)
in your init.el
. (You can also customize the option suggest-key-bindings
to the length of time in seconds – not necessarily an integer! – to change the amout of time the message is visible.)
In case you actually want to have that hint, here’s one way to do it:
(defun display-extended-command-shorter (command) "Display information on a shorter way to M-x a command." (interactive (list (read-extended-command))) (message "The command `%s' can be invoked with `M-x %s'" command (execute-extended-command--shorter command command)))