From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Completion: display of candidates Date: Wed, 20 Feb 2019 11:54:08 -0500 Message-ID: References: <877edx8rbh.fsf@gnu.org> <87mumtno2f.fsf@gnu.org> <877edwsxw1.fsf@gnu.org> <87lg2cgruy.fsf@gnu.org> <87imxe1pfs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="182864"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 20 18:11:06 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwVOf-000lJx-A0 for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Feb 2019 18:11:01 +0100 Original-Received: from localhost ([127.0.0.1]:43517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwVOe-0006FG-6N for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Feb 2019 12:11:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwV8T-0002EN-CP for help-gnu-emacs@gnu.org; Wed, 20 Feb 2019 11:54:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwV8S-0003j9-7j for help-gnu-emacs@gnu.org; Wed, 20 Feb 2019 11:54:17 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:60077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwV8S-0003fm-0R for help-gnu-emacs@gnu.org; Wed, 20 Feb 2019 11:54:16 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x1KGs8Bi006291; Wed, 20 Feb 2019 11:54:09 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id A643E64C11; Wed, 20 Feb 2019 11:54:08 -0500 (EST) In-Reply-To: <87imxe1pfs.fsf@gnu.org> (Tassilo Horn's message of "Wed, 20 Feb 2019 15:53:43 +0100") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6487=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6487> : inlines <7019> : streams <1813600> : uri <2799486> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119487 Archived-At: >> 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