]> git.eshelyaron.com Git - emacs.git/commit
Robustify completion match scoring for optimized patterns
authorJoão Távora <joaotavora@gmail.com>
Mon, 28 Dec 2020 09:20:17 +0000 (09:20 +0000)
committerJoão Távora <joaotavora@gmail.com>
Mon, 28 Dec 2020 23:09:29 +0000 (23:09 +0000)
commitd199a4640f53673a3bba79ab82cf819009e65e8f
tree4e13a56ce39a8b335ce44d54fcee663b14fa2273
parentd180a41dbb8e4e8d94d30a023c2d86d92c73c4f1
Robustify completion match scoring for optimized patterns

Fixes: bug#42149
The function completion-pcm--hilit-commonality, which propertizes and
scores a previously confirmed match, expected its PATTERN argument to
match the strings of COMPLETIONS entirely (i.e. up to the string's
very end).  But sometimes the ending wildcard, represented by the
'any' atom in PATTERN, is optimized away by
completion-pcm--optimize-pattern.  Although this is mostly benign in
terms of highlighting commonality, it leads to incorrect score values.

In this change, we ensure that completion-pcm--hilit-commonality is
aware of this exception and isn't affected by it.  We also document
the function a bit better and simplify its workings.

Originally reported by Dario Gjorgjevski <dario.gjorgjevski@gmail.com>

* lisp/minibuffer.el (completion-pcm--hilit-commonality):
Simplify.  Add docstring.

* lisp/minibuffer.el (completion-pcm--hilit-commonality): Add
docstring
lisp/minibuffer.el