GNU bug report logs - #22407
Better support external completion tools

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Stefan Monnier <monnier@HIDDEN>; dated Tue, 19 Jan 2016 14:21:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 22407 <at> debbugs.gnu.org:


Received: (at 22407) by debbugs.gnu.org; 20 Jan 2016 14:25:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 20 09:25:27 2016
Received: from localhost ([127.0.0.1]:54525 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aLthP-0006Z1-MB
	for submit <at> debbugs.gnu.org; Wed, 20 Jan 2016 09:25:27 -0500
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:34759)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <monnier@HIDDEN>) id 1aLthM-0006Ys-RA
 for 22407 <at> debbugs.gnu.org; Wed, 20 Jan 2016 09:25:25 -0500
Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca
 [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id u0KEPMcd005576;
 Wed, 20 Jan 2016 09:25:22 -0500
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id 51062AE05B; Wed, 20 Jan 2016 09:25:22 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#22407: Better support external completion tools
Message-ID: <jwvfuxs49vp.fsf-monnier+emacsbugs@HIDDEN>
References: <jwvh9i9odmj.fsf@HIDDEN> <569EDF2B.4040907@HIDDEN>
 <jwvlh7l56le.fsf-monnier+emacsbugs@HIDDEN>
 <569F5812.8010507@HIDDEN>
Date: Wed, 20 Jan 2016 09:25:22 -0500
In-Reply-To: <569F5812.8010507@HIDDEN> (Dmitry Gutov's message of "Wed, 20
 Jan 2016 12:49:06 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV5556=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5556> : inlines <4202> : streams
 <1574017> : uri <2123670>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 22407
Cc: 22407 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

>> I was thinking of applying (within Emacs) the regexp/predicate to a list
>> of candidate returned by the external tool.  Not passing it directly to
>> the external tool
> That would make it harder to use external tools that operate on large
> datasets. And since essentially, with this approach we're not delegating
> filtering to the external tool, it seems like it should work with the
> current completion-styles mechanism. No need to allow overriding
> completion-all-completions.

I guess you're right: it would only work in those cases where the
current system is already usable.  After all, all-completions already
has the completion-regexp-list at hand, if it wants to use it.

So for now, all we can do is to hope that the external tool can "honor"
the completion-styles somehow, but without providing any specific help
for that.

>>> As an aside, I wonder if the current completion styles, at least, could each
>>> be automatically implemented on top of the input-to-regexp functions,
>>> without loss in efficiency.
>> "input-to-regexp"?  Sorry, doesn't ring a bell.
> "a function which takes a user-input string and return a regexp".
> Could we use that not just as "description", but as definition for existing
> styles. And maybe keep the current mechanism for the trickier ones.

The current code already uses "turn input into a regexp, then use this
regexp to filter the worthy candidates".

We should add a `regexp' completion-style.  I never got around to do it,
but it shouldn't be very hard and it would probably provide the kinds of
function you're looking for.  Note that for the general "I just have
a regexp" case, implementing a good "try-completion" is hard.

And yes, partial-completion has additional complexity on top of that to
exploit boundaries so you can type C-x C-f ~/e/e/e TAB and have it
complete to ~/etc/emacs/emacs.el, but for the common boundary-free case
(or for completion-styles which don't want to do anything clever with
boundaries) it's not that hard.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#22407; Package emacs. Full text available.

Message received at 22407 <at> debbugs.gnu.org:


Received: (at 22407) by debbugs.gnu.org; 20 Jan 2016 09:49:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 20 04:49:14 2016
Received: from localhost ([127.0.0.1]:54329 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aLpO6-0005nj-Bl
	for submit <at> debbugs.gnu.org; Wed, 20 Jan 2016 04:49:14 -0500
Received: from mail-lf0-f42.google.com ([209.85.215.42]:35789)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <raaahh@HIDDEN>) id 1aLpO5-0005nU-8E
 for 22407 <at> debbugs.gnu.org; Wed, 20 Jan 2016 04:49:13 -0500
Received: by mail-lf0-f42.google.com with SMTP id c192so2257602lfe.2
 for <22407 <at> debbugs.gnu.org>; Wed, 20 Jan 2016 01:49:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-type:content-transfer-encoding;
 bh=QP/2ZLnA0LZKZYYqVvirFTWWYsWih+h3e5DLoeHFDdE=;
 b=BdEWGjlPN60jHOM5OcWtAvYR87xkqNIoiHxDKJZkZLtDvRt05L3TRLreCE511t11l8
 YFCUQv7z3eueuYW5Ta4LsUKzOFbG0JnLX9baz7qpdK7zfL2N+FFOlsI1VcQu6PWHrckm
 fdAS2bOftpGJVDweAsI59isIZbx92prUqC7+QpRJLXkJQrvb8ad0qPMgsuSXJu8XwV8B
 CTppXHr4VQoqWgsxAbYZ1mvryHbFutTw2FJYHWv2wD3avo+vv1KsrIreYhJxaPsYzpIz
 8A/2xkSVeDAjFKLC4xCOUuJgsT6vJhCr2VnrTj0156KCQwUcUcHu0uDq+BJ2fAS6ots0
 6QgQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-type
 :content-transfer-encoding;
 bh=QP/2ZLnA0LZKZYYqVvirFTWWYsWih+h3e5DLoeHFDdE=;
 b=hTtyh6UNfWQ8G025QbndUXc/cQjn9jXJ24/V38pcvuaGyUeq5D7xxv2wCxxBEx8cDR
 1fCoHcSHOqLLguYATIdJmIw4blMl6dwTzS9sYfHeyoAV40klXaeeR4nCMQj4wv4W8M7G
 JMQRhnzgz4MN3U7umFVY70nPI8Qya2vRUiaQGybxyRw9EOH8K1Uz3rmNBoUhX1yCE9wC
 rdgcUX/CD5OG2jPW7u2RRZOI31Ctqz6Bf7K2lDN1FPsmpWqYVHohkaimKAGzuV4lfaC4
 Arg+V+IOYRzdifhbTRbLkMDfQ8bKAMQLSNHGhVehfP2AXSolIr7SnuDIa3KOBuXftIXT
 FJnQ==
X-Gm-Message-State: ALoCoQmiub2O+S0KgULMwCSxUT8ZY6qKa+PENWjQaCue1ESJbmnnf8R8aqIp8U+NdwkWJbLzN9nLCCAJeXPC58QGAP82n/Gaqg==
X-Received: by 10.25.212.11 with SMTP id l11mr12773478lfg.118.1453283347450;
 Wed, 20 Jan 2016 01:49:07 -0800 (PST)
Received: from [192.168.1.190] ([178.252.127.222])
 by smtp.googlemail.com with ESMTPSA id f74sm4644781lfi.17.2016.01.20.01.49.06
 (version=TLSv1/SSLv3 cipher=OTHER);
 Wed, 20 Jan 2016 01:49:06 -0800 (PST)
Subject: Re: bug#22407: Better support external completion tools
To: Stefan Monnier <monnier@HIDDEN>
References: <jwvh9i9odmj.fsf@HIDDEN> <569EDF2B.4040907@HIDDEN>
 <jwvlh7l56le.fsf-monnier+emacsbugs@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <569F5812.8010507@HIDDEN>
Date: Wed, 20 Jan 2016 12:49:06 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101
 Thunderbird/44.0
MIME-Version: 1.0
In-Reply-To: <jwvlh7l56le.fsf-monnier+emacsbugs@HIDDEN>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 22407
Cc: 22407 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 01/20/2016 05:31 AM, Stefan Monnier wrote:

> I was thinking of applying (within Emacs) the regexp/predicate to a list
> of candidate returned by the external tool.  Not passing it directly to
> the external tool

That would make it harder to use external tools that operate on large 
datasets. And since essentially, with this approach we're not delegating 
filtering to the external tool, it seems like it should work with the 
current completion-styles mechanism. No need to allow overriding 
completion-all-completions.

>> As an aside, I wonder if the current completion styles, at least, could each
>> be automatically implemented on top of the input-to-regexp functions,
>> without loss in efficiency.
>
> "input-to-regexp"?  Sorry, doesn't ring a bell.

"a function which takes a user-input string and return a regexp".

Could we use that not just as "description", but as definition for 
existing styles. And maybe keep the current mechanism for the trickier ones.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#22407; Package emacs. Full text available.

Message received at 22407 <at> debbugs.gnu.org:


Received: (at 22407) by debbugs.gnu.org; 20 Jan 2016 02:31:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 19 21:31:39 2016
Received: from localhost ([127.0.0.1]:54240 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aLiYc-0002jz-RK
	for submit <at> debbugs.gnu.org; Tue, 19 Jan 2016 21:31:39 -0500
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:44233)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <monnier@HIDDEN>) id 1aLiYZ-0002jp-Uc
 for 22407 <at> debbugs.gnu.org; Tue, 19 Jan 2016 21:31:37 -0500
Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca
 [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id u0K2VY25018392;
 Tue, 19 Jan 2016 21:31:34 -0500
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id D461FAE9D8; Tue, 19 Jan 2016 21:31:33 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#22407: Better support external completion tools
Message-ID: <jwvlh7l56le.fsf-monnier+emacsbugs@HIDDEN>
References: <jwvh9i9odmj.fsf@HIDDEN> <569EDF2B.4040907@HIDDEN>
Date: Tue, 19 Jan 2016 21:31:33 -0500
In-Reply-To: <569EDF2B.4040907@HIDDEN> (Dmitry Gutov's message of "Wed, 20
 Jan 2016 04:13:15 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.2
X-NAI-Spam-Rules: 2 Rules triggered
	ATR_WMN=0.2, RV5555=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5555> : inlines <4200> : streams
 <1573745> : uri <2123389>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 22407
Cc: 22407 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> I don't see how the predicate could be used at all. As for regexp, we should
> make a survey of the existing external completion tools, and see how many of
> them take a regexp for this purpose.

I was thinking of applying (within Emacs) the regexp/predicate to a list
of candidate returned by the external tool.  Not passing it directly to
the external tool

> As an aside, I wonder if the current completion styles, at least, could each
> be automatically implemented on top of the input-to-regexp functions,
> without loss in efficiency.

"input-to-regexp"?  Sorry, doesn't ring a bell.

>> Probably neither would work well enough, tho (e.g. if the
>> completion-table includes candidates that fix typos in the user-input
>> string).
> Neither will be perfect, that's for sure. But maybe we don't have to worry
> about that too much: IME, users are mostly interested in the distinction
> between prefix and fuzzy completion, with many preferring the latter.

Agreed.  Honoring completion-styles is not very important.

> Using #'identity as display-sort-function should work, though.

Exactly.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#22407; Package emacs. Full text available.

Message received at 22407 <at> debbugs.gnu.org:


Received: (at 22407) by debbugs.gnu.org; 20 Jan 2016 01:13:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 19 20:13:24 2016
Received: from localhost ([127.0.0.1]:54229 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aLhKu-0000jc-NG
	for submit <at> debbugs.gnu.org; Tue, 19 Jan 2016 20:13:24 -0500
Received: from mail-lb0-f176.google.com ([209.85.217.176]:35270)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <raaahh@HIDDEN>) id 1aLhKs-0000jN-QB
 for 22407 <at> debbugs.gnu.org; Tue, 19 Jan 2016 20:13:23 -0500
Received: by mail-lb0-f176.google.com with SMTP id bc4so372502491lbc.2
 for <22407 <at> debbugs.gnu.org>; Tue, 19 Jan 2016 17:13:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-type:content-transfer-encoding;
 bh=gjQLV9PDBG1KEZvty2EpJH0UlQwhcKiQJ84UFQqV5/s=;
 b=ZYuxvRtbmoEJRJeQ3HC4xtg5vy5ScleFBqgjGBBAr813Rqpf57nXwgJbu8dbCahJ3i
 M/FV+/vnVGuOAArbzr51eyhhYUoX9ogjVaGhQ9tKMs9GM6QofS/QJq1fiWYXCYIfm+YQ
 gqlVUuDVghtv09NjLqN7KZrd72Y/Ya+dnDxP9WQx0hfS5ZPPte7KaRx0Hp2f6+T2P0YF
 w/cfe2akD5ANrinnu3jpzHFXiN5Zf+ck+if9CUSdmwE15lOGJ8XJ58NKZ6E8pGOHILEg
 7jDwo11lRtwalAch+0iXUWVV6YzIQK520fT8WyiWDxxN4WExyFjbzvDNSKPoky/MXvpU
 9bFg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-type
 :content-transfer-encoding;
 bh=gjQLV9PDBG1KEZvty2EpJH0UlQwhcKiQJ84UFQqV5/s=;
 b=FOZ5jZ9LxMdhqyaMf+03RBHBVae3hwprzOdJcqH/TKRrrOPzcc0ppk0QjgJzzMBv1S
 /yukIUHYxvYXsVHBN7nWg2GXFF2ZfXj2KERih/DPcOBxCTkLxw3Ph1VnQiHF3/9jfKS1
 nd8Ab8IpsaPuYjqlMU/0vFJZgpxwMT3YbVVM7Q/OgNmPrFSXdICsQrpD/RUqHQQeFLz0
 1/MhdkQHjfm+YzhBnKFmQNuTsxWsolaXO2say/PUovxX96ZpsGdqZ/iAHlg/7dDsFH2z
 d92aGIBYyUgE/eXhAsrEG3WjJeV7M2xGsyrm+dZ3ZVGXUA6V5ayhrzuSAkMl2MANjeyo
 o0lg==
X-Gm-Message-State: ALoCoQn0SKMAzCf7k9yo7hxYAp564vkmp4JuP92oWd/yTzNtIPO7c/ZPh7OYbRJc7sBG7HCwEVAuy69Nv3zrwAYsXgjMEIphNQ==
X-Received: by 10.112.161.65 with SMTP id xq1mr12029583lbb.82.1453252396946;
 Tue, 19 Jan 2016 17:13:16 -0800 (PST)
Received: from [192.168.1.190] ([178.252.127.222])
 by smtp.googlemail.com with ESMTPSA id f202sm2108436lfg.12.2016.01.19.17.13.15
 (version=TLSv1/SSLv3 cipher=OTHER);
 Tue, 19 Jan 2016 17:13:15 -0800 (PST)
Subject: Re: bug#22407: Better support external completion tools
To: Stefan Monnier <monnier@HIDDEN>, 22407 <at> debbugs.gnu.org
References: <jwvh9i9odmj.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <569EDF2B.4040907@HIDDEN>
Date: Wed, 20 Jan 2016 04:13:15 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101
 Thunderbird/44.0
MIME-Version: 1.0
In-Reply-To: <jwvh9i9odmj.fsf@HIDDEN>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 22407
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

On 01/19/2016 05:19 PM, Stefan Monnier wrote:

> Note: checking (memq 'partial-completion completion-styles) is
> fundamentally broken since the user may be using its own
> `my-partial-completion' instead.

On the other hand, the external tool might simply have a set of matcher 
styles you can ask it to use. Then memq could at least be helpful.

> So maybe to avoid this problem and
> make it easier for those completion-tables to honor `completion-styles',
> we could extend `completion-styles-alist' so that each style can provide
> some "description" of the kinds of candidates it would accept.  Not sure
> what that "description" could look like, tho.  Maybe a function which
> takes a user-input string and return a regexp, or maybe a simple
> predicate taking a user input string and a candidate and returns whether
> to keep it or not.

I don't see how the predicate could be used at all. As for regexp, we 
should make a survey of the existing external completion tools, and see 
how many of them take a regexp for this purpose.

There's also the issue of Emacs/basic/extended regexp syntax.

As an aside, I wonder if the current completion styles, at least, could 
each be automatically implemented on top of the input-to-regexp 
functions, without loss in efficiency. Is the completion boundaries, 
used by partial-completion, the main problem?

> Probably neither would work well enough, tho
> (e.g. if the completion-table includes candidates that fix typos in the
> user-input string).

Neither will be perfect, that's for sure. But maybe we don't have to 
worry about that too much: IME, users are mostly interested in the 
distinction between prefix and fuzzy completion, with many preferring 
the latter.

The next question becomes how to sort (or not) the returned list: fuzzy 
matching returns lots of matches, so they're usually sorted at the same 
time. If completion-at-point re-sorts them alphabetically, that 
advantage will be lost. Using #'identity as display-sort-function should 
work, though.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#22407; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Jan 2016 14:20:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 19 09:20:12 2016
Received: from localhost ([127.0.0.1]:53529 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aLX8l-0000e2-QL
	for submit <at> debbugs.gnu.org; Tue, 19 Jan 2016 09:20:12 -0500
Received: from eggs.gnu.org ([208.118.235.92]:40658)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <monnier@HIDDEN>) id 1aLX8j-0000dn-BV
 for submit <at> debbugs.gnu.org; Tue, 19 Jan 2016 09:20:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1aLX8X-0007IF-AV
 for submit <at> debbugs.gnu.org; Tue, 19 Jan 2016 09:20:03 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50838)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1aLX8X-0007I7-8B
 for submit <at> debbugs.gnu.org; Tue, 19 Jan 2016 09:19:57 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59843)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1aLX8V-00010V-DJ
 for bug-gnu-emacs@HIDDEN; Tue, 19 Jan 2016 09:19:57 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1aLX8R-0007HJ-7I
 for bug-gnu-emacs@HIDDEN; Tue, 19 Jan 2016 09:19:55 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:41475)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1aLX8R-0007HA-1V
 for bug-gnu-emacs@HIDDEN; Tue, 19 Jan 2016 09:19:51 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0CNEAA731xV/++PWxdcgxABU16CULJTAZAMB4V5BIFAPBEBAQEBAQEBgQpBBYQ5EwFLDwQhARwNVYgOmy+0IIo4hTUBAQVqhBUFi0RshhmiOyOBRwwTIQMBG4FwIDGBDIE7AQEB
X-IPAS-Result: A0CNEAA731xV/++PWxdcgxABU16CULJTAZAMB4V5BIFAPBEBAQEBAQEBgQpBBYQ5EwFLDwQhARwNVYgOmy+0IIo4hTUBAQVqhBUFi0RshhmiOyOBRwwTIQMBG4FwIDGBDIE7AQEB
X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="190273357"
Received: from 23-91-143-239.cpe.pppoe.ca (HELO pastel.home) ([23.91.143.239])
 by ironport2-out.teksavvy.com with ESMTP; 19 Jan 2016 09:19:50 -0500
Received: by pastel.home (Postfix, from userid 20848)
 id 88F0C5FF67; Tue, 19 Jan 2016 09:19:48 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Better support external completion tools
Date: Tue, 19 Jan 2016 09:19:48 -0500
Message-ID: <jwvh9i9odmj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

Package: Emacs
Version: 25.1.50


The current minibuffer.el code is sometimes inconvenient to use for some
packages because the only hooks it provides is for the package to give
the output of `all-completions' and `try-completion' (basically), which
is too limiting when the completion is performed by outside tools which
may provide natively things like "substring" matching.

We should add new methods to the completion-tables (beside the
existing try, all, test, boundaries, and metadata) that allow the
completion table to provide its own version of completion-try-completion
and completion-all-completions.

Clearly, that means that `completion-styles' wouldn't be automatically
honored, so it'd be up to those completion tables to do their best to
try and honor `completion-styles' (or not).

Note: checking (memq 'partial-completion completion-styles) is
fundamentally broken since the user may be using its own
`my-partial-completion' instead.  So maybe to avoid this problem and
make it easier for those completion-tables to honor `completion-styles',
we could extend `completion-styles-alist' so that each style can provide
some "description" of the kinds of candidates it would accept.  Not sure
what that "description" could look like, tho.  Maybe a function which
takes a user-input string and return a regexp, or maybe a simple
predicate taking a user input string and a candidate and returns whether
to keep it or not.  Probably neither would work well enough, tho
(e.g. if the completion-table includes candidates that fix typos in the
user-input string).


        Stefan



In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2016-01-14 built on pastel
Repository revision: b8d080b21a801fe70170b15b663888d19df4a32d
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.2 (jessie)

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG SOUND NOTIFY GNUTLS LIBXML2 FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11

Important settings:
  value of $LANG: fr_CH.UTF-8
  locale-coding-system: utf-8-unix

Major mode: InactiveMinibuffer

Minor modes in effect:
  c-electric-flag: t
  dired-omit-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  electric-pair-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  url-handler-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Finding changes in /home/monnier/src/emacs/work/lisp/nxml/nxml-mode.el...done
Hunk already applied
Saving file /home/monnier/src/emacs/work/lisp/nxml/nxml-mode.el...
Wrote /home/monnier/src/emacs/work/lisp/nxml/nxml-mode.el
Finding changes in /home/monnier/src/emacs/work/lisp/nxml/nxml-mode.el...done
Making completion list...
Quit

Making completion list...
Quit

Load-path shadows:
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-ref-man hides /home/monnier/src/emacs/elpa/packages/ada-ref-man/ada-ref-man
/home/monnier/src/emacs/elpa/packages/avy/.dir-locals hides /home/monnier/src/emacs/elpa/packages/company-statistics/.dir-locals
/home/monnier/src/emacs/elpa/packages/avy/.dir-locals hides /home/monnier/src/emacs/elpa/packages/company/.dir-locals
/home/monnier/src/emacs/elpa/packages/avy/.dir-locals hides /home/monnier/src/emacs/elpa/packages/gnugo/.dir-locals
/home/monnier/src/emacs/elpa/packages/avy/.dir-locals hides /home/monnier/src/emacs/elpa/packages/hydra/.dir-locals
/home/monnier/src/emacs/elpa/packages/avy/.dir-locals hides /home/monnier/src/emacs/elpa/packages/js2-mode/.dir-locals
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-prj hides /home/monnier/src/emacs/work/lisp/progmodes/ada-prj
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-stmt hides /home/monnier/src/emacs/work/lisp/progmodes/ada-stmt
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-mode hides /home/monnier/src/emacs/work/lisp/progmodes/ada-mode
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-xref hides /home/monnier/src/emacs/work/lisp/progmodes/ada-xref
/home/monnier/src/emacs/elpa/packages/avy/.dir-locals hides /home/monnier/src/emacs/work/lisp/gnus/.dir-locals
/home/monnier/src/emacs/elpa/packages/crisp/crisp hides /home/monnier/src/emacs/work/lisp/obsolete/crisp
/home/monnier/src/emacs/elpa/packages/landmark/landmark hides /home/monnier/src/emacs/work/lisp/obsolete/landmark
/home/monnier/src/emacs/work/lisp/emacs-lisp/cl-generic hides /home/monnier/src/emacs/elpa/packages/cl-generic/cl-generic

Features:
(sort mail-extr emacsbug css-mode skeleton sm-c-mode ffap two-column
smerge-mode whitespace smie log-edit message sendmail rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils mailheader pcvs-util vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc-dir let-alist derived inline epg subr-x
package-x dabbrev rect cc-mode cl-seq cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-langs cc-vars cc-defs python tramp-sh
tramp tramp-compat tramp-loaddefs trampver format-spec json dired-x
dired dired-loaddefs bug-reference add-log eieio-opt speedbar sb-image
ezimage dframe texnfo-upd texinfo sgml-mode nxml-uchnm rng-xsd
xsd-regexp rng-cmpct character-fold misearch multi-isearch shell
pcomplete grep compile vc vc-dispatcher map rng-nxml rng-valid rng-loc
rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
executable copyright xscheme warnings unsafep trace testcover shadow
scheme re-builder profiler inf-lisp ielm comint ansi-color ring
gmm-utils ert pp find-func ewoc debug elp edebug cl-indent cus-edit
cus-start cus-load wid-edit vc-git diff-mode filecache seq server
noutline outline easy-mmode flyspell ispell checkdoc thingatpt load-dir
elec-pair reveal autoinsert proof-site proof-autoloads cl pg-vars
savehist minibuf-eldef disp-table edmacro kmacro advice info finder-inf
package epg-config url-handlers url-parse auth-source eieio byte-opt
bytecomp byte-compile cl-extra cconv eieio-core cl-macs gv
eieio-loaddefs gnus-util time-date mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr password-cache url-vars
bbdb-autoloads vm-autoloads mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax font-core frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote inotify dynamic-setting
font-render-setting x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 571183 143835)
 (symbols 48 44226 0) (miscs 40 10879 3055) (strings 32 116260 12700)
 (string-bytes 1 3071372)
 (vectors 16 68223) (vector-slots 8 2435977 194326) (floats 8 797 593)
 (intervals 56 51774 1418)
 (buffers 976 122) (heap 1024 766281 15256))




Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#22407; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.