Question

Can someone explain, with an example, what does ido-enable-flex-matching do compared to plain ido?

And can flex matching be used when dealing with files in addition to buffers? (and does that require any additional setup?)

Was it helpful?

Solution

Without looking at the code, I can guess, because the effect is the same, that it is done the same way Icicles does it: add .* after each character in your input except the last, and use string-match to match the resulting regexp against the candidates.

E.g.: Input: abc. Handled as regexp: a.*b.*c. Or similar. All that does is match each of the characters in your input against the candidate, but also allow for possibly other candidate chars in between successive chars of your input. It's a kind of poor man's "fuzzy" matching. More info, including comparison with other fuzzy matching approaches.

OTHER TIPS

From the Emacs manual entry on Flexible Matching:

The flexible matching implies that any item which simply contains all of the entered characters in the specified sequence will match.

For example, if you have four files alpha, beta, gamma, and delta, entering ‘aa’ will match alpha and gamma, while ‘ea’ matches beta and delta. If prefix matching is also active, ‘aa’ only matches alpha, while ‘ea’ does not match any files.

Flex matching can be used when dealing with files and buffers. If you add (setq ido-enable-flex-matching t) and (setq ido-everywhere t) in your .emacs file you should be good to go for files and buffers. To use ido in more places than that, check out the ido-ubiquitous package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top