Subject: Re: bug#48841: bug#47711: bug#48841: bug#47711: [PATCH VERSION 2] Add new `completion-filter-completions` API and deferred highlighting

From: João Távora <[email-masked]>
Date: Wed, 1 Nov 2023 18:47:25 +0000

On Tue, Oct 31, 2023 at 8:52 PM Dmitry Gutov <[email-masked]> wrote:

> It seems like the only code that would be concerned with it are
> completion styles that also do sorting, or completion tables that would
> do similar things to this "with quoting" business. But I'm not aware of
> any other examples of the latter aside from what is inside Emacs itself.

If orderless (which I've never tried), does some kind of scoring of
completions, it probably also needs the same complications of flex.

> >> Anyway, have you looked into what it would take to solve it?
> >
> > No, naively, I just think it's a similar situation of display and business
> > logic being mixed up.  Presumably the quoted stuff is just for insertion
> > (and display?), and the unquoted stuff is what patterns/scoring should
> > operate on.
>
> Apparently it's good for insertion, but according to that comment inside
> the function, the unquoted stuff might actually be better for display.

No idea what the unquoted stuff is for, so I haven't really tested it.

> I'm not 100% clear which of the versions is better for
> scoring/highlighting, but apparently the unquoted one.
>
> > But, IMO, there's no need to tackle it right now.
> >
> > If the thing holding you back from the lazy-hilit-2023-v4.patch is the
> > completion-score propertization, I can move it to the sorting step
> > in a future v5 and add spread the completion--unquoted thing a little
> > bit more.
>
> I think that's the main blocker, yes.

Alright, here goes v5 then, with this change.  Note I've implemented
this unquoted thing which kicks in in C-x f but I haven't actually
seen  any strings that have different "quoted" "non-quoted" versions.

The performance of the three main patches as measured in yet
another machine:

;; C-h v
;;
;; Daniel+Dmitry: 0.696340454545
;; lazy hilit v4: 0.692849642852
;; lazy hilit v5: 0.683088541667
;;
;; completing-read
;;
;; Daniel+Dmitry: 0.590994909091
;; lazy hilit v4: 0.586523307692
;; lazy hilit v5: 0.586165466667

Nothing unexpected.

So if you're satisfied with the general design now, maybe
we should start looking at finer details, docstrings, style,
etc.

João