unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Shuguang Sun <shuguang@gmail.com>
Cc: 29833@debbugs.gnu.org
Subject: bug#29833: icomplete re-build the completion table after each key press
Date: Mon, 21 Sep 2020 13:47:20 -0400	[thread overview]
Message-ID: <jwvft7b2fst.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CACspjXfWqLKDW9OxXs98HaGm1WXg8YqLXzwnX0KmMyi=-LgjRQ@mail.gmail.com> (Shuguang Sun's message of "Sun, 24 Dec 2017 16:58:28 +0800")

> The icomplete re-build the completion table
> 'completion-all-sorted-completions' after each key press.

This is considered normal.
The reason is that icomplete can't know in general how to take the
list of matching completions for "foob" or for "fo" (or for any other
string for that matter) and compute the corresponding list of
matching completions.

This is because it depends on lots of details.  E.g. when completing
files when going from "foo" to "foo/" the list of completions is
completely changed.  In other cases, "foo" matches something using
a particular completion-style but "foob" doesn't, so a different
completion-style will be used, ...

It is true that in many case the completions of "foob" are a subset of
the completions of "foo", so we could recompute them faster but
icomplete is not being told under which conditions this is true and it's
not being told *how* it could be recomputed (e.g. by looking for
candidates matching "foob" or by looking for candidates matching
"f.*o.*o.*b", ...).

So in order to be able to avoid recomputing the candidates "from
scratch", we'd need the rest of the completion code to give us more
info, but there is no such infrastructure.

What the current completion system expects instead is that if the time
needed to recompute the candidates can be large, the *completion table*
should use a cache.


        Stefan






  parent reply	other threads:[~2020-09-21 17:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-24  8:58 bug#29833: icomplete re-build the completion table after each key press Shuguang Sun
2017-12-25 14:40 ` Shuguang Sun
2018-01-06  7:27 ` Shuguang Sun
2020-09-21 14:27   ` Lars Ingebrigtsen
2020-09-21 17:47 ` Stefan Monnier [this message]
2021-07-23 12:51   ` Lars Ingebrigtsen

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=jwvft7b2fst.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=29833@debbugs.gnu.org \
    --cc=shuguang@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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