4 ms·
> Even the current version of Emacs doesn't do fuzzy completion for M-x commands, just start-of-token completion; out of the box the completion is a little basi
by flurie 5y ago
> Even the current version of Emacs doesn't do fuzzy completion for M-x commands, just start-of-token completion; out of the box the completion is a little basic. I know there are packages which make this a lot better, but you have to know about the packages. :)
This is not quite true.
The minibuffer, which is what vanilla Emacs uses for M-x command completion, has a set of completion styles, ordered by preference. You can find the full set of completion categories supported by Emacs in the variable completion-styles-alist. Among those is one called flex, which allows for full fuzzy matching between provided tokens.
This is not a default minibuffer completion style, but it provided without additional packages. One would add it by adding it to the list of completion styles used by the minibuffer as specified by the variable completion-styles. I recommend trying it out.
- taeric 5y agoTIL. Planning to play with that in the near future. Thanks!
- chipotle_coyote 5y agoInteresting! It still doesn't quite shake my suspicion that the best documentation for Emacs is "find somebody else who knows more about Emacs than you do," but to be fair that's not unique to Emacs. :)
- flurie 5y agoHonestly, I wouldn't have been able to tell you this two weeks ago. I know all this now because completions in a language I don't normally use felt off somehow, and figuring out the solution involved going deep on how Emacs handles completions. That ended up not being relevant to the root cause, which was a change in Doom causing snippets to be overvalued in LSP completion, but at least I know a lot more about vanilla completion methods now!
- yissp 5y agoThis is a helpful tip, but I feel like it kinda reinforces the broader point about emacs's lack of discoverability. I've been using it for years and wasn't aware of this feature until today.
- Jtsummers 5y agoM-x customize-apropos some-string This is how I've discovered most things outside of just reading the documentation (and usually I go to the documentation once I find it). It's also helpful that the info pages in emacs are also searchable with: M-x info-apropos some-string Both are kind of firehoses, but C-s inside the resulting buffer can usually narrow it down pretty quickly. I'd like to know what other editors have a discovery system like this built-in.