3

Is there any way of getting Helm to default to the shortest match? In many cases the way Helm works at the moment (unless I have some weird configuration) is inferior to vanilla Emacs in many cases.

An example... I want to invoke "revert-buffer".

In standard Emacs it's 9 keystrokes:

M-x revert <tab> <return>

In Helm mode it's 13:

M-x revert-b C-n C-n C-n <return>.

...although if it was set to default to the shortest match (which makes sense, Occam's razor, right?) it would be something like 8:

M-x rev buf <return>
2
  • I get 5 keystrokes with smex and flx-ido-mode: C-t rb C-n RET.
    – abo-abo
    Mar 30 '15 at 13:20
  • But with Helm you get 6 keystrokes and key binding for the command available. It is already my favorite for executing command and learn a key binding at the same time, so you don't repeat yourself with: looking up the key binding (C-h f then type the command then RET) and executing the command (M-x then type the command then RET); if you are lucky you still have to press the key binding to execute that command.
    – Tu Do
    Mar 30 '15 at 13:31
4

Use helm-M-x. It is not bound to M-x by default, so you have to do it yourself:

(global-set-key (kbd "M-x") 'helm-M-x)

with helm-M-x, I only need to type re buf to get revert-buffer as the first match.

You can learn more about Helm in this guide.

3
  • Thanks, that does indeed fix it, although I don't understand why the default M-x doesn't default to the shortest match.
    – Rich Smith
    Mar 30 '15 at 10:57
  • Because the default M-x runs execute-extended-command, which is vanilla M-x with Helm interface. helm-M-x is an entirely different command. You see more goodis in helm-M-x, such as key binding of each command if available and C-z to see the description of each command.
    – Tu Do
    Mar 30 '15 at 11:03
  • With helm-M-x-fuzzy-match set to true, it's enough with M-x rvb... Mar 30 '15 at 20:43

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.