help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Completion: display of candidates


From: Stefan Monnier
Subject: Re: Completion: display of candidates
Date: Wed, 20 Feb 2019 11:54:08 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> The completion-table does not see "the user's input string".  It only
>> sees "a string" (chosen by the completion-style) and should return the
>> set of candidates which have that string as a prefix.
> Is it always a prefix, e.g., also with the substring or flex completion
> style?

Yes.  Completion styles like substring/flex/partial-completion make do
with this as the underlying primitive.

>> In some cases, the string it will see is "" and it should hence return
>> the complete list of candidates (after which the completion style will
>> perform its own filtering on it).
> What's the best thing to do if the number of candidates is too large to
> deliver them all?

Good question.  The answer is somewhere around "it depends".

> Right now, my function passed to completion-table-dynamic always returns
> the elements of the recentf-list + the results of a locate --basename
> search, however, the latter is only triggered if "the string" is longer
> than 2 characters.  Thus, the completion-table grows when going from
> search string "fo" to "foo" which is probably not expected by completion
> styles.

Yes, it's a problem which will make (typically) `substring` and `flex`
misbehave: they always call the completion-table with "" and then do
their own filtering so they'll only see the recentf-list elements ;-)

That's one of the fundamental problems we should fix in the design of
the completion-table API.


        Stefan



reply via email to

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