2

If I do M-x insert TAB Emacs shows a list of possible completions like below

Possible completions are:
insert-abbrevs              insert-anniversary-diary-entry
insert-block-diary-entry    insert-buffer
insert-char                 insert-cyclic-diary-entry
insert-diary-entry          insert-file
insert-file-literally       insert-kbd-macro
insert-monthly-diary-entry  insert-pair
insert-parentheses          insert-register
insert-weekly-diary-entry   insert-yearly-diary-entry

What if one likes to have a list of all completions in which the string insert exists, for example auto-insert which is not given in the above list.

3

*insert TAB will work for execute-extended-command, but smex is just much better.

| improve this answer | |
2

Others have mentioned smex and icicles which give such completions. I'll add Helm. Install from MELPA with M-x package-install helm. (helm-mode t) will turn it on globally. It doesn't steal your M-x key for itself, so also add (global-set-key (kbd "M-x") 'helm-M-x) to give it the key.

| improve this answer | |
1

In Icicles you get such completion using S-TAB (by default - you can change the key, of course).

By default:

  • TAB gives you prefix completion. (Or vanilla Emacs completion - e.g., *insert TAB will do as @abo-abo indicated.)

  • S-TAB gives you "apropos"-style (i.e., regexp) completion, which of course includes substring completion.

Just use a different completion key, TAB or S-TAB, to get a different kind of completion. And for each of these keys you can use different completion methods, including various fuzzy completion methods. You can cycle among the methods using C-( (for TAB) and M-( (for S-TAB).

All of this is true not only for M-x but for everything - any minibuffer input completion.


And BTW, Icicles does not "steal" your M-x key. Whether you keep M-x bound to standard command execute-extended-command or you bind it to Icicles multi-command icicle-execute-extended-command is up to you. And in either case you can take advantage of Icicles completion when icicle-mode is turned on. (If you turn off icicle-mode then you are back to vanilla Emacs behavior, for M-x and for everything else.)

By default, you do get special multi-command behavior for M-x, but it is trivial to customize option icicle-top-level-key-bindings to choose which keys you want to have take advantage of any special Icicles commands.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.