]> git.eshelyaron.com Git - emacs.git/commit
Improve scoring algorithm for flex-style completions
authorJoão Távora <joaotavora@gmail.com>
Sun, 27 Oct 2019 00:33:54 +0000 (01:33 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sun, 27 Oct 2019 00:46:56 +0000 (01:46 +0100)
commit63fd71cd092de8daded15e32c268215b62c488b9
tree24c4105207ebceddd71570b241e0425306a2ce8d
parentf4ee7c83823b7a9369e79dafa70e4fd98633704a
Improve scoring algorithm for flex-style completions

The previous algorithm had two problems: it considered non-matches in
the beginning and end of the string as matching "holes" and failed to
penalize larger holes, making flex-score-match-tightness only
effective in some corner cases.

The new formula, which is described in code and in pseudo-code in the
comments, fixes these problems.

As a result, by default, C-h f flex now correctly bubbles up
"company-search-flex-regexp" to the top, in front of "file-exists-p".
With a flex-score-match-tightness smaller than 1.0, the situation is
reversed.

* lisp/minibuffer.el (flex-score-match-tightness): Adjust default
value.  Improve docstring example.
(completion-pcm--hilit-commonality): Improve example.  Remove unused
variable.  Improve algorithm.
lisp/minibuffer.el