unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: help-gnu-emacs@gnu.org
Subject: Re: Completion: display of candidates
Date: Wed, 20 Feb 2019 11:54:08 -0500	[thread overview]
Message-ID: <jwvk1hue79l.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87imxe1pfs.fsf@gnu.org> (Tassilo Horn's message of "Wed, 20 Feb 2019 15:53:43 +0100")

>> 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



      parent reply	other threads:[~2019-02-20 16:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18  7:54 Completion: display of candidates Tassilo Horn
2019-02-18 13:26 ` Stefan Monnier
2019-02-18 14:55   ` Tassilo Horn
2019-02-18 18:05     ` Stefan Monnier
2019-02-18 19:24       ` Tassilo Horn
2019-02-18 20:48         ` Stefan Monnier
2019-02-19  7:27           ` Tassilo Horn
2019-02-19 15:28             ` Stefan Monnier
     [not found]               ` <87imxe1pfs.fsf@gnu.org>
2019-02-20 16:54                 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvk1hue79l.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).