svbck.org

Emacs find of the day: M-X

I was supposed to do some actual work, but rather chose to set up a custom-key-map, as one does as it is weekend. In the process I learned about a hither unknown command to me, tied to M-X.

And yes, it's the upper-case X.

The key-binding is tied to the command execute-extended-command-for-buffer which shows only commands relevant to the current buffer.

As described in describe-function:

Query user for a command relevant for the current mode, and then execute it. This is like ‘execute-extended-command’, but it limits the completions to commands that are particularly relevant to the current buffer. This includes commands that have been marked as being specially designed for the current major mode (and enabled minor modes), as well as commands bound in the active local key maps.

This is a great tool for discovery of commands and/or keybindings that are either new to me, or which I had forgotten.

20240224t175006m-x-screenshotscreenshot

Naturally I have tied the command also to my WIP keymap.


UPDATE 2024-02-29:

It was pointed to me on Mastodon that this command is relatively new and was added to Emacs 28. Thanks to Philip for the hint.

#emacs