[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Improvement proposals for `completing-read'

From: Stefan Monnier
Subject: Re: Improvement proposals for `completing-read'
Date: Thu, 08 Apr 2021 13:30:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Yes, that would be the best possibility. There are many ways to provide that
> data: Via a text property, via an extra metadata function, etc. In the case
> of Swiper the extra data could simply be the line number. However a general
> solution should also automatically generate indices, since it is probably
> better to not require the completion table to provide the information in any
> case. I would like some graceful degradation.

There's also the issue that we want the system to work "by default"
(e.g. even if your UI doesn't take advantage of all the latest extra
metadata features).

So maybe rather than having a way to add extra data for disambiguation,
we should require the completion candidates to be unique (as is the case
currently), and then add an extra feature that can hide some part of
the text.

E.g. for a completion table of something like Swiper, every entry would
contain the line's text plus a suffix containing the line number.
And then the metadata would tell the UI how it can hide the suffix if it
doesn't need textual uniqueness.

>>> One thing to consider - maybe returning the highlights as some extra data is
>>> not actually faster than simply propertizing the strings?
>> The extra opaque data is cheap/free to compute.  It would not contain
>> "the highlights", but just the side information that might be needed to
>> compute the highlights: e.g. you can't do the highlighting correctly for
>> `partial-completion` without having access to the "pattern" against
>> which it was matched.
> I don't think this is true.

I don't see anything in your description that disagrees with what
I said, so it looks like we're in "violent agreement" ;-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]