]> git.eshelyaron.com Git - emacs.git/commit
Allow completion frontends to fontify results just-in-time
authorJoão Távora <joaotavora@gmail.com>
Wed, 25 Oct 2023 12:45:01 +0000 (13:45 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 26 Oct 2023 13:12:34 +0000 (14:12 +0100)
commit1cbbd51f390f91b1db45bbd1dddd3c06f0db6366
treee12d65e52d4d2a0cee79710a584366ee3f424387
parent7c668eb75b3e59819c9c3ddf00ed38cb89d3ca18
Allow completion frontends to fontify results just-in-time

bug#48841, bug#47711

This allows completion-pcm--hilit-commonality to be sped up
substantially.

Introduce a new variable completion-lazy-hilit that allows for
completion frontends to opt-in an time-saving optimization by some
completions styles, such as the 'flex' and 'pcm' styles.

The variable must be bound or set by the frontend to a unique value
around a completion attempt/session.  See completion-lazy-hilit
docstring for more info.

* lisp/icomplete.el (icomplete-minibuffer-setup): Set completion-lazy-hilit.
(icomplete--render-vertical): Call completion-lazy-hilit.
(icomplete-completions): Call completion-lazy-hilit.

* lisp/minibuffer.el (completion-lazy-hilit): New variable.
(completion-lazy-hilit)
(completion-lazy-hilit-fn): New variable.
(completion--flex-score-1): New helper.
(completion-pcm--hilit-commonality): Use completion-lazy-hilit.
lisp/icomplete.el
lisp/minibuffer.el