]> git.eshelyaron.com Git - emacs.git/commit
Improve sorting of flex completion style with non-nil minibuffer-default
authorJoão Távora <joaotavora@gmail.com>
Sun, 22 Dec 2019 11:52:17 +0000 (12:52 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sun, 22 Dec 2019 11:52:32 +0000 (12:52 +0100)
commit2fa8fd18dfb0dc673ea82491de952a45b84c6667
tree68c535e615edbaacc97a08b32e2859036a4af003
parentba042176d8931cdf9441b3b4919ec74b75019494
Improve sorting of flex completion style with non-nil minibuffer-default

This affects the behaviour of flex completion when there is a default
completion and the user hasn't entered any input pattern to flex-match
against.  It is most visible when icomplete-mode or fido-mode are
being used in conjunctio.

When using M-x man, for instance, the default completion is picked
from text around point.  Say it is "emacs" (for Emacs's man page).  It
will not match the intended completion, "emacs(1)", exactly.  If the
user hasn't yet given any input to the completion prompt, that
completion should bubble to top so that
icomplete-force-complete-and-exit will select it, but it didn't.

This new approach uses 'string-prefix-p' instead of 'equal' to find
the default to bubble to the top.  This strategy could eventually be
improved, most naturally by flex-matching the default string to all
the candidates and picking the highest scoring one.

Additionally, the new strategy only considers minibuffer-default if
there is no input in the minibuffer, which seems sensible and produces
a small but noticeable speedup.

* lisp/minibuffer.el (completion--flex-adjust-metadata):
Reformulate sorting strategy.
lisp/minibuffer.el