GNU bug report logs - #70217
[PATCH] Add substring-partial-completion style

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; Reported by: Spencer Baugh <sbaugh@HIDDEN>; Keywords: patch; dated Fri, 5 Apr 2024 12:43:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at submit) by debbugs.gnu.org; 6 Apr 2024 08:11:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 06 04:11:02 2024
Received: from localhost ([127.0.0.1]:38144 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rt18f-00009K-S0
	for submit <at> debbugs.gnu.org; Sat, 06 Apr 2024 04:11:02 -0400
Received: from lists.gnu.org ([2001:470:142::17]:55276)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1rt18d-000091-UK
 for submit <at> debbugs.gnu.org; Sat, 06 Apr 2024 04:11:00 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1rt18Q-0001FU-GR
 for bug-gnu-emacs@HIDDEN; Sat, 06 Apr 2024 04:10:46 -0400
Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1rt18O-0003sj-Ux
 for bug-gnu-emacs@HIDDEN; Sat, 06 Apr 2024 04:10:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1712391043;
 bh=uZBIshUwTb+RAPvmTTvw5Qr171TsK8lC490Rhbkcwv8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=lcrmJ3urC+lesUKr8s3YtOidRTNqR16Ry/FHY0GYlSpvr7TctCyJZ/pkGnBxMYhnb
 7SlXT5s25H0+GU6PFYdUHweKVvwhAHLUeegah38uliZrETeLnLjCNFQ26sok1l6TRH
 RZ5k+lGKWZ17+M/OLRMFN6qN+vO4FKZRvpU1uwfMHjgAvnl32xat0tc4WHL3qL9pNw
 7UZ6u+xFbZyBGQbqvGTOYUEXrgQ6gZVS76nsL3I4U+AdOteFRfI0QmDKKi9ez0m6IT
 ABC60aeMal7kq6USBcYm7MFoq1eWtRdG8GwQ59bl+FsNUlEmgLyVACzPULEUzF8Qur
 oXtRbJgow5I2Q==
From: Eshel Yaron <me@HIDDEN>
To: Drew Adams via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#70217: [PATCH] Add substring-partial-completion style
In-Reply-To: <SJ0PR10MB5488B00744F472A5B1D1BD6CF3032@HIDDEN>
 (Drew Adams via's message of "Fri, 5 Apr 2024 19:46:07 +0000")
References: <ier5xwwugl0.fsf@HIDDEN>
 <jwvplv3acwc.fsf-monnier+emacs@HIDDEN>
 <SJ0PR10MB5488B00744F472A5B1D1BD6CF3032@HIDDEN>
X-Hashcash: 1:20:240406:sbaugh@HIDDEN::ApzzDtxNUB9/Nc5g:imP
X-Hashcash: 1:20:240406:70217 <at> debbugs.gnu.org::lZiUpLydKLT5kpuA:0vFQ
X-Hashcash: 1:20:240406:drew.adams@HIDDEN::xjBXomly+fjjkEYp:3jZw
X-Hashcash: 1:20:240406:bug-gnu-emacs@HIDDEN::C9xhOslMjlORIyAy:4lBm
X-Hashcash: 1:20:240406:monnier@HIDDEN::MYPGAWo0e4B6breI:5LcG
Date: Sat, 06 Apr 2024 10:10:40 +0200
Message-ID: <m1o7amap33.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@HIDDEN;
 helo=eshelyaron.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Spencer Baugh <sbaugh@HIDDEN>,
 "70217 <at> debbugs.gnu.org" <70217 <at> debbugs.gnu.org>,
 Stefan Monnier <monnier@HIDDEN>, Drew Adams <drew.adams@HIDDEN>
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.1 (/)

Drew Adams writes:

>> > It's preferable for this to be a separate style from partial-completion
>> > rather than a customization for partial-completion, because completing
>> > with a leading glob is inefficient: it doesn't allow the completion
>> > table to do any filtering at all.  So, for example, one might want the
>> > regular partial-completion style to run first, and if it doesn't find
>> > anything then the substring-partial-completion style can run.
>>
>> FWIW, I think the "language of completion styles"
>> would benefit from being a bit richer.
>
> FWIW, I agree.  Richer in different ways/dimensions.
>
>> I.e. instead of a completion style (i.e. an entry
>> in `completion-styles`) being limited to a symbol,
>> we could extend it so a style can take arguments.

One thing to keep in mind is that such parameterized completion styles
would make user interaction with completion styles more complicated.
It's much easier to indicate the effective completion style to the user,
and to allow them to pick and choose their completion styles on the fly,
when these completion styles are mere symbols.  (Currently Emacs doesn't
provide such UI for completion styles, but I proposed something along
these lines in branch feature/minibuffer-completion-enhancements.)

>>
>> E.g. the `substring` style could take an argument
>> which when set to the symbol `pcm` would cause it
>> to behave like your "substring-partial-completion":
>> (setq completion-styles '(basic (substring pcm) emacs22))
>>
>> Alternatively, it could be an argument to `partial-completion`, e.g.:
>> (setq completion-styles '(basic (partial-completion notanchored) emacs22))

[...]

> ...you have no way of knowing which style was
> actually used to produce a given set of candidates.
> For users, the link (cognitive and otherwise) is
> lost between a style and its completions for a
> given input pattern.

+1

I agree it's quite important to indicate which completion style produced
what you're seeing, at the very least such indication makes it clear
where you should look if you don't like the completions you got.


Best,

Eshel




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

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


Received: (at 70217) by debbugs.gnu.org; 6 Apr 2024 08:10:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 06 04:10:52 2024
Received: from localhost ([127.0.0.1]:38141 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rt18W-00008p-FM
	for submit <at> debbugs.gnu.org; Sat, 06 Apr 2024 04:10:52 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:46074 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1rt18U-00008h-9c
 for 70217 <at> debbugs.gnu.org; Sat, 06 Apr 2024 04:10:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1712391043;
 bh=uZBIshUwTb+RAPvmTTvw5Qr171TsK8lC490Rhbkcwv8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=lcrmJ3urC+lesUKr8s3YtOidRTNqR16Ry/FHY0GYlSpvr7TctCyJZ/pkGnBxMYhnb
 7SlXT5s25H0+GU6PFYdUHweKVvwhAHLUeegah38uliZrETeLnLjCNFQ26sok1l6TRH
 RZ5k+lGKWZ17+M/OLRMFN6qN+vO4FKZRvpU1uwfMHjgAvnl32xat0tc4WHL3qL9pNw
 7UZ6u+xFbZyBGQbqvGTOYUEXrgQ6gZVS76nsL3I4U+AdOteFRfI0QmDKKi9ez0m6IT
 ABC60aeMal7kq6USBcYm7MFoq1eWtRdG8GwQ59bl+FsNUlEmgLyVACzPULEUzF8Qur
 oXtRbJgow5I2Q==
From: Eshel Yaron <me@HIDDEN>
To: Drew Adams via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#70217: [PATCH] Add substring-partial-completion style
In-Reply-To: <SJ0PR10MB5488B00744F472A5B1D1BD6CF3032@HIDDEN>
 (Drew Adams via's message of "Fri, 5 Apr 2024 19:46:07 +0000")
References: <ier5xwwugl0.fsf@HIDDEN>
 <jwvplv3acwc.fsf-monnier+emacs@HIDDEN>
 <SJ0PR10MB5488B00744F472A5B1D1BD6CF3032@HIDDEN>
X-Hashcash: 1:20:240406:sbaugh@HIDDEN::ApzzDtxNUB9/Nc5g:imP
X-Hashcash: 1:20:240406:70217 <at> debbugs.gnu.org::lZiUpLydKLT5kpuA:0vFQ
X-Hashcash: 1:20:240406:drew.adams@HIDDEN::xjBXomly+fjjkEYp:3jZw
X-Hashcash: 1:20:240406:bug-gnu-emacs@HIDDEN::C9xhOslMjlORIyAy:4lBm
X-Hashcash: 1:20:240406:monnier@HIDDEN::MYPGAWo0e4B6breI:5LcG
Date: Sat, 06 Apr 2024 10:10:40 +0200
Message-ID: <m1o7amap33.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 70217
Cc: Spencer Baugh <sbaugh@HIDDEN>,
 "70217 <at> debbugs.gnu.org" <70217 <at> debbugs.gnu.org>,
 Stefan Monnier <monnier@HIDDEN>, Drew Adams <drew.adams@HIDDEN>
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.0 (-)

Drew Adams writes:

>> > It's preferable for this to be a separate style from partial-completion
>> > rather than a customization for partial-completion, because completing
>> > with a leading glob is inefficient: it doesn't allow the completion
>> > table to do any filtering at all.  So, for example, one might want the
>> > regular partial-completion style to run first, and if it doesn't find
>> > anything then the substring-partial-completion style can run.
>>
>> FWIW, I think the "language of completion styles"
>> would benefit from being a bit richer.
>
> FWIW, I agree.  Richer in different ways/dimensions.
>
>> I.e. instead of a completion style (i.e. an entry
>> in `completion-styles`) being limited to a symbol,
>> we could extend it so a style can take arguments.

One thing to keep in mind is that such parameterized completion styles
would make user interaction with completion styles more complicated.
It's much easier to indicate the effective completion style to the user,
and to allow them to pick and choose their completion styles on the fly,
when these completion styles are mere symbols.  (Currently Emacs doesn't
provide such UI for completion styles, but I proposed something along
these lines in branch feature/minibuffer-completion-enhancements.)

>>
>> E.g. the `substring` style could take an argument
>> which when set to the symbol `pcm` would cause it
>> to behave like your "substring-partial-completion":
>> (setq completion-styles '(basic (substring pcm) emacs22))
>>
>> Alternatively, it could be an argument to `partial-completion`, e.g.:
>> (setq completion-styles '(basic (partial-completion notanchored) emacs22))

[...]

> ...you have no way of knowing which style was
> actually used to produce a given set of candidates.
> For users, the link (cognitive and otherwise) is
> lost between a style and its completions for a
> given input pattern.

+1

I agree it's quite important to indicate which completion style produced
what you're seeing, at the very least such indication makes it clear
where you should look if you don't like the completions you got.


Best,

Eshel




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

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


Received: (at 70217) by debbugs.gnu.org; 5 Apr 2024 19:46:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 05 15:46:24 2024
Received: from localhost ([127.0.0.1]:37528 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rspW4-0002S4-6t
	for submit <at> debbugs.gnu.org; Fri, 05 Apr 2024 15:46:24 -0400
Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:27540)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1rspVz-0002RQ-3g
 for 70217 <at> debbugs.gnu.org; Fri, 05 Apr 2024 15:46:23 -0400
Received: from pps.filterd (m0246627.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 435Jg93K003200; Fri, 5 Apr 2024 19:46:12 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2023-11-20;
 bh=yKLSl+7GUGIF93zV5I5Y0zByuOtF3u7KVz31XLq2HvQ=;
 b=c4zxq+wIhZYHQ+Lhjl5Ybfd4GXEHhCdCUrawzZ6Hg0d6dkEGOfQdJNHL9yQ9xDuQ3uLr
 wQg1FUt3rBfFQ9u0f8PUGfPNlDwa9ubPB70DNKCnNah97jwivZ83EBH9CmBdL/Tmq8Zm
 O8Y4fYry+MZZwHtTZ32ebOKpPC/vtZuoTtZNtM5foRvTi/tRMUkNMSNlzwtyRgm0G6B9
 CxIRXWRExLK44klpoJqcK0w6LXsJ1iclG/tU2aEdNlGYFS3Widmma/Q+megq4WBsEvzb
 esbDihdjeQg3LHBJ2YV4jCcEOt0DoYP9FtBwueA2VEciJ+idAS2wPI8dwPL1UOXJfo4n UQ== 
Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com
 (phxpaimrmta02.appoci.oracle.com [147.154.114.232])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3x9evyv92v-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 05 Apr 2024 19:46:11 +0000
Received: from pps.filterd
 (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
 by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19)
 with ESMTP id 435HpNQT009372; Fri, 5 Apr 2024 19:46:10 GMT
Received: from nam11-co1-obe.outbound.protection.outlook.com
 (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168])
 by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id
 3x9emngwf4-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 05 Apr 2024 19:46:09 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=nIlbe7loojfZ9YSqPscZVhSymvu7Kw08bH4TbIkpzXBGnYCcdCITCZCVkm2kfInJDNgA+na3NlBoRrGrn+D3QB/pJjefoQtrzSsyGR4oWAY2RTHiADZhWr61E5ggVP42VGQJbzg0ks+WoDoQJNN4huDiEOpontJHq4Pgwc0kQv079lrskUaqXSMMALNUV+RozYdjrxZi1cz98GDKgExwq1deUTs3t0497uHoAj0teT0jP7F08/rdGxFDAPyfLwZwM96uu3vwxwLc3ymsa6GzBurbewmcfAMiiX2VcSBlo0pc6djXknr6dus/i/NaBnzXCcdKssVeAmW+sdIhSSFYrA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=yKLSl+7GUGIF93zV5I5Y0zByuOtF3u7KVz31XLq2HvQ=;
 b=AfQSZ1bBBYebV9DyVDnEw35fKOjzhu7ku8rV3g4IFuNFNyo1QgKMLSXx24VA9eTZFkTOjWVq/Pzp0sBc9Obtf3Wns/fxjt0DiecmEPUzjBhHNTjALXogzUWuqhIzOhtzriZxPmh0Pkk426uQbeDy4w4K1rY22x2nlgJJnmUVqcKQ7uOKqOwofo/ObksIwHDzdgQ70wSJDOOIOqlsPHQPXdbScb/D1Uc7Mzouv6T8DgkNFpSz2Z0mWSXk71WbzweMMVRrVzIsHdGZ0IIYKBirwLtDsKUZmZ0JeQHi9bz6Rbn9OSf9Nik+tP4lhuL96Yu1ktaPSz30V6WkvlFj5AU5Ag==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=yKLSl+7GUGIF93zV5I5Y0zByuOtF3u7KVz31XLq2HvQ=;
 b=lEYD0Q3yJuZDnAqSDitOVuFZPP76QZ9vEpQjhDqNKw+qTRl/yDSnEayK67ZAFLfHWHs23apwRSySzNCkzbkdzX2R6VrcPpjERaTOemA/oGWYu2Zuf8soZGV+spyegTfwvON8P0IYN4EceQ3HSrWqAueHnZT6aSeibwg8GFU/9iw=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by IA1PR10MB7540.namprd10.prod.outlook.com (2603:10b6:208:445::22)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.26; Fri, 5 Apr
 2024 19:46:07 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::d9bc:c5bb:7fc4:cf9f]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::d9bc:c5bb:7fc4:cf9f%6]) with mapi id 15.20.7409.042; Fri, 5 Apr 2024
 19:46:07 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, Spencer Baugh
 <sbaugh@HIDDEN>
Subject: RE: [External] : bug#70217: [PATCH] Add substring-partial-completion
 style
Thread-Topic: [External] : bug#70217: [PATCH] Add substring-partial-completion
 style
Thread-Index: AQHah4iYpniH+TW1VkO8KQCcYr9oT7FaCikA
Date: Fri, 5 Apr 2024 19:46:07 +0000
Message-ID: <SJ0PR10MB5488B00744F472A5B1D1BD6CF3032@HIDDEN>
References: <ier5xwwugl0.fsf@HIDDEN>
 <jwvplv3acwc.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvplv3acwc.fsf-monnier+emacs@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|IA1PR10MB7540:EE_
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: ivt3JxhMfoumSUR7XaZaG1I95QC4E4zrVSS2ziplHZDGNI0zhJaZ9ub5Ikb99qN90/giHjcLFL3G3ADCn2uFnJxTyFlydVzyaIqaBZCSM4HoB8qAei6LdzjLz9LcBF8AHhscKz2FZDuXvoqyecGjlkzONGZ8Bf+AP9Bb1b6AiDjrF4rIQkwBIJw4Kc09d4jJA0M6A231Sci1h2Z/QddNZ/J0u7AEsTUa1HggizOd6lz6ANVP58fmhwf/80CHsTsQwOf24Y2Dd7SWdkHfUqqcfmhCR/qKCDihHY8OfUOvb5uZwmmFudkEOihRNaPvvbwThvGboAISyKFKFK5gFealW0wVRAdPLZ9pU8l8HFDOJcUegDBYQ4+Gq9jPAhwcrmgO/+XEVdRD34YgyZWhmNg8zlX2NJhWO/CSBK9gt8aVjUwGH92kU3iyaiR41f5TKiCSqNY1htHG7OnRpeHIDbGnMR/LVuacPND8eWN9mE6Jx6m4ZrqZmgYFyfCMNg4bddequvP+NcfL3wIKPsilDNdtss+nOHe/8jOI9jDGxjH1MiHpuS5xJJpkIzvLSNr8CPoc/d91UsfK6osLGeW0KIKeC4ywMZjQu/VLj2lasli6wN8=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RqqRqFN6cJxxTsElKIpIjo1MeEC41XtF+FuCwYwEsSBXUWlFyzGnCzkUK+Dp?=
 =?us-ascii?Q?zniCV8zoqc9kJCZYKS7YukTAHdWLvs3azR/fctte0LPsf4Gr5HKMhW/ZDJzF?=
 =?us-ascii?Q?Pjh9b1++0PGObinLg71gjYhdrL8rpecXGFP2fHDG7ZHYcqVhGB+6LiL4WRfM?=
 =?us-ascii?Q?MecV/cb0Z6iuzBIhU5TgynCdTsc/dWmnGQAJwU05O3vS+aECgvVLD25hSNKt?=
 =?us-ascii?Q?+dz2v9cGcIrW5+imtsip6KQtiloYg5LeOehKj8CdXb+udtuMF2JGuzQV/3QN?=
 =?us-ascii?Q?aS9P2EqnS+zbhxdztjZo3l6uupNJLGXUOud/R89NM+qnn+FPeVfRxek1Yue5?=
 =?us-ascii?Q?iIdLQik1CJbWKyK7ORp+iGehud9FxDJ8JNHJhYTLhJOxXY0wekt3krYf8eaR?=
 =?us-ascii?Q?09RhmSvuaYwEBrcUsCcx3wR80BokcyPfu5QXXy0j75x5oLT50R71UYGK5MIS?=
 =?us-ascii?Q?RmuzaZnM/f50N0VCIKG1dDZ18nqs8p9yRwK/qcdJ97jdyOsImw4aZTOqg4KM?=
 =?us-ascii?Q?9sqS53i9CDL8VllPhubzbSyJC2P6MrYyq7s8MnlX164n7nKuxdlvovQWsgFj?=
 =?us-ascii?Q?tBHB3mJLR60DGnaBlbfbdJ1Qlb07PWjpqP4KSF3vjIWviHmp1uCFNYEHZOvH?=
 =?us-ascii?Q?bhqRkLRMNOLu8K4W21FhLzmmOF1bbU6oJdbMsTL32794Itcvj8Z1adlOucLf?=
 =?us-ascii?Q?fr4wSCohtRgVh0+UaPid/TjgI149xELXZC5BX8uhy7R/ZMHFe0kLbXP8hyya?=
 =?us-ascii?Q?oT7nUcUQGrIZ5MEMf1WQ5tNHUS0DXlUxqqp4A+4TKid6HfRuYKa1YSR0htMU?=
 =?us-ascii?Q?cRV46tlMbJCzcgO29cFRxmTVa/IIDLWg7ZXo8owe6qGiTJxoBkbiMn1DUPaO?=
 =?us-ascii?Q?tPr+UoM1o2TAAjuG0q0IvA63S7de+Q1JE38kxBTWRQ8BBLbiPMjv+BxJuzKZ?=
 =?us-ascii?Q?LyuEyHiJfEzbRl5K9whqmqe+Q/PqKEFqIixEmUCFxvsDi25AXwOlgrlFltRN?=
 =?us-ascii?Q?h/+iJCDy29ZsYtAYpZThQTDG+VcBRy2hMzXqZYhj/oWtGcZ7psI04M6F/Awf?=
 =?us-ascii?Q?pmEyfq7PjoUQR51bmlNbVy0vzVgeh/fp71rFLp3erq57k1jgQKs1jK5umhwc?=
 =?us-ascii?Q?ymU+H3XsRMSV8MViCGjs5a8oYUAqj9tcjRJA44ZDt4jxs5U/3FCZL+jy0ohS?=
 =?us-ascii?Q?d9Vaw7su+vd/izT8lxH5Us23anApWI6b3vODQc0eFQzC5DLZndQEadbGBpX4?=
 =?us-ascii?Q?n21sDjg4ezAseIyIo1TD3P2uOyVgYAZod+gflGirA/EuffTDgZaPyrDD/KQt?=
 =?us-ascii?Q?8NK0XPLho7Zd/vsdfLvxuoI0+bsBsaQ/T/r4kwmKOiZxcX8DCHM3QU6+C90j?=
 =?us-ascii?Q?gLG55fM2Q/6ukNuR6FpDKqqSmMbWVqYa8MWfPZML49dXJlsLDPm5BGklGG2o?=
 =?us-ascii?Q?hmbJOXtfqT5Zk2o0XbTMDYOmEXLG2aNuJh76xcCVPdxQFA1XjOP4PLVaRgyl?=
 =?us-ascii?Q?5xb0f823OaiGA+4fq5IPpkrmLDUNcgOpm5uVXCkH3stoCVaLvQ90fwzRUCJ9?=
 =?us-ascii?Q?I4hdLuGaMz90ju6D5Vzgl4LW+2tUAcLoq2XjK1wL?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SawFjOGUJTwYcv4199ul5rE1TZRjI1qUso++I3cDCqCXDNpH7jkztheh7UxsxL7gSLLP9zJAgGy7FYBhEg139FPpkOKm4HB70plhNMn8ZpIWJyktrkGI7qH6haIVJUZSJGGmLq/fo7BwwCq1qHgDf4jrxJSZDZwaYflyQUD6KQ9Y4yNr3AoJrGP+08JI3wbnwN/F4PbAC4i+uKZaHB/Fmcvo//ScSnfyiEXBfB/L+Zg+tZlolSF9Dfl6O6t1B1NeEFYPhpWRhADt1ZpL5gUtk+qIrQszRoeS9sn5mvnQA2IuCD2sgjjbmWGOIYmHsFwnJahHAfI5/GGgrdauBYchA0k0O7iIZrsEtpjbx9WWlEpTrM+baLEIRJHsF2WI916GpUxYPFmRwzlZM16ZyEn04E2m68SW3+FChKVlinwK5qTHW/C2B6vKRlNj5Ljl9cK29xzDVi2UxUFhxaJ6z3rmI8nHumjmB5TgSryCchD+EVv1b694VhnBIqE/XHObW3Eue1ZCPSpqlTJP6pAhrEVQMrMIagd2HjmSsJqam792pDxs+Gkm5lEnk6ObuevU47FnTw7TFWH7rjXRSK1QR/zS/4QzZousEElRhhdk4E9WsOQ=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d87b7e8b-ffd9-4888-519b-08dc55a90970
X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Apr 2024 19:46:07.5624 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 7ZAcdEqt+uPlvjEsNrZVks7bKVlr6bL6LdTdjOcDYZaG68FKUa6KBQj2x3upkqK6v5Gxr7O7TiuzGNXlN5Gqsw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7540
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26
 definitions=2024-04-05_23,2024-04-05_02,2023-05-22_02
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0
 malwarescore=0
 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0
 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2404010000 definitions=main-2404050140
X-Proofpoint-GUID: i29Er5LjQheERJJR0oQ_1NdEmCAD7lxO
X-Proofpoint-ORIG-GUID: i29Er5LjQheERJJR0oQ_1NdEmCAD7lxO
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 70217
Cc: "70217 <at> debbugs.gnu.org" <70217 <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.0 (-)

> > It's preferable for this to be a separate style from partial-completion
> > rather than a customization for partial-completion, because completing
> > with a leading glob is inefficient: it doesn't allow the completion
> > table to do any filtering at all.  So, for example, one might want the
> > regular partial-completion style to run first, and if it doesn't find
> > anything then the substring-partial-completion style can run.
>=20
> FWIW, I think the "language of completion styles"
> would benefit from being a bit richer.

FWIW, I agree.  Richer in different ways/dimensions.

> I.e. instead of a completion style (i.e. an entry
> in `completion-styles`) being limited to a symbol,
> we could extend it so a style can take arguments.
>=20
> E.g. the `substring` style could take an argument
> which when set to the symbol `pcm` would cause it
> to behave like your "substring-partial-completion":
> (setq completion-styles '(basic (substring pcm) emacs22))
>=20
> Alternatively, it could be an argument to `partial-completion`, e.g.:
> (setq completion-styles '(basic (partial-completion notanchored) emacs22)=
)

I'm not sure that's the best way/place to provide
for that, but yes, it's one possible direction for
enrichment.
___

FWIW, I think `completion-styles' is too rudimentary
in additional ways.  (I've mentioned this before.)

1. There's only one set of completion styles that's
ever in effect.  Each style is tried, in turn, until
one of them successfully completes your input.

They can only be used together - all or none; they
can never serve as alternatives that you can choose
interactively (runtime).

2. All completions you see come from the same style.

You have no control over which style will actually
be used for any given input, other than ordering
the styles ahead of time.

And you have no way of knowing which style was
actually used to produce a given set of candidates.
For users, the link (cognitive and otherwise) is
lost between a style and its completions for a
given input pattern.

The relation between your input pattern and the
matches is thus sometimes not so clear. There's
no way to know, e.g., that initial matching failed
and partial matching succeeded.

3. Instead of a single list of styles, Emacs should
support a set (list) of such lists, which you can
choose from at runtime.  You can try completing
using one styles list and, if that doesn't succeed,
switch to another.=20

Since any such set can be a singleton, allowing
multiple sets also means you can use just a single
style.

4. Users should be able to define, for a specific
_command_, the possible styles sets to choose
from, and do so interactively.
___

I'd say Emacs should think about providing more=20
flexibility for what kinds of completing (and
sequences of such kinds, per `completing-styles')
are available and how users and code can move
among them or conditionalize them per context.
___

As an illustration, Icicles has long had such=20
possibilities (even before `completion-styles').

https://www.emacswiki.org/emacs/Icicles_-_Completion_Methods_and_Styles




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

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


Received: (at 70217) by debbugs.gnu.org; 5 Apr 2024 18:38:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 05 14:38:19 2024
Received: from localhost ([127.0.0.1]:37496 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsoSB-0005vi-3I
	for submit <at> debbugs.gnu.org; Fri, 05 Apr 2024 14:38:19 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:13436)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rsoS6-0005us-AC
 for 70217 <at> debbugs.gnu.org; Fri, 05 Apr 2024 14:38:17 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5C33D80B3D;
 Fri,  5 Apr 2024 14:38:02 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1712342277;
 bh=l3/qBxKijpym+K8jEBjmBi2UkvurGMWtngb5p2A9ZCY=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=g+XQJFO/QmXQ9AOE4I4yYRJnAQ3+4rEegg0tWcRUzifRdBx+UlPB3j80t1lTyCCJm
 CdBzjq3YD/byRZFb9zMllqGpVAV2FQs9I9Ojx9MwEOFVJyQezdLXZ60HDO9imgknNG
 aVTjKFEee/EBopzj1HSCwGRtk6TxMXB90XefexR/94RabPsOpuIz+/AHXZSVxh2eTA
 7PzbI0ral4m7EIjYuzKeGHpMPVusPWXA6KGkq/QzpCjkc63iLnCMrkkk5MJuVjChf/
 Iuk881+8LTs+DpLWTC0ETrPPFp1HoSKz0jXJuh7F70DeKUHGI41qlZ/E7ubcoSGunZ
 XV3YF8aU3Alag==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2F7BE802B3;
 Fri,  5 Apr 2024 14:37:57 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1E31312024D;
 Fri,  5 Apr 2024 14:37:57 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: [PATCH] Add substring-partial-completion style
In-Reply-To: <ier5xwwugl0.fsf@HIDDEN> (Spencer Baugh's message of
 "Fri, 05 Apr 2024 08:41:47 -0400")
Message-ID: <jwvplv3acwc.fsf-monnier+emacs@HIDDEN>
References: <ier5xwwugl0.fsf@HIDDEN>
Date: Fri, 05 Apr 2024 14:35:24 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.163 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70217
Cc: 70217 <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: -3.3 (---)

> It's preferable for this to be a separate style from partial-completion
> rather than a customization for partial-completion, because completing
> with a leading glob is inefficient: it doesn't allow the completion
> table to do any filtering at all.  So, for example, one might want the
> regular partial-completion style to run first, and if it doesn't find
> anything then the substring-partial-completion style can run.

FWIW, I think the "language of completion styles" would benefit from
being a bit richer.  I.e. instead of a completion style (i.e. an entry
in `completion-styles`) being limited to a symbol, we could
extend it so a style can take arguments.

E.g. the `substring` style could take an argument which when set to the
symbol `pcm` would cause it to behave like your "substring-partial-completion":

    (setq completion-styles '(basic (substring pcm) emacs22))

Alternatively, it could be an argument to `partial-completion`, e.g.:

    (setq completion-styles '(basic (partial-completion notanchored) emacs22))


- Stefan





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

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


Received: (at submit) by debbugs.gnu.org; 5 Apr 2024 12:42:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 05 08:42:09 2024
Received: from localhost ([127.0.0.1]:35392 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsitV-0006HJ-8u
	for submit <at> debbugs.gnu.org; Fri, 05 Apr 2024 08:42:09 -0400
Received: from lists.gnu.org ([2001:470:142::17]:45890)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1rsitQ-0006Fb-3X
 for submit <at> debbugs.gnu.org; Fri, 05 Apr 2024 08:42:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1rsitC-0006rC-ML
 for bug-gnu-emacs@HIDDEN; Fri, 05 Apr 2024 08:41:50 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1rsitA-0003Vx-Pv
 for bug-gnu-emacs@HIDDEN; Fri, 05 Apr 2024 08:41:50 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Add substring-partial-completion style
Date: Fri, 05 Apr 2024 08:41:47 -0400
Message-ID: <ier5xwwugl0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1712320907;
 bh=p/h8GDp3kFS1D8jqE73cIWEgLCEmnXtp5BkKo3koYzQ=;
 h=From:To:Cc:Subject:Date;
 b=zC8H5U9UpW7znQXZZvMpmO+RsU2ze1I0W01bKqbqsWhnEC7rFlLY01yQRtS4RK3//
 1vqQlniOgisggo0H41iyPfC5M+J2piYidHyiDxm/8snuzc/rhUTk5ZV8ohSUc+FmJ8
 CafENDNlpAVI2tanlAJKD0aLQURpEj85+fQIKTitiBqI0muVJgwFGUI1GH6mD+8Fb0
 2rXFP2YPN+uk5DSRIAlvHDtBE6U1P5sjBx/ZyTrbK55uQjarTMoBJuXhtckjvOcClX
 l6wWOnLdq+VgkxqOjNQGq5diuph12uyPoVm5yUN8W+hfYSmru3bc1l5eqV0xo68dx6
 LxGGltvc39pdQ==
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: monnier@HIDDEN
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.1 (/)

--=-=-=
Content-Type: text/plain

Tags: patch


The substring completion style completes "foo-bar" as "*foo-bar*".
The partial-completion completion style completes "foo-bar" as
"foo*bar*".

It is currently not possible to get completion as "*foo*bar*",
e.g. combining the two.

This patch adds a completion style that combines the two.  (It's a bit
rough right now, just a quick implementation, will clean it up with
feedback)

It's preferable for this to be a separate style from partial-completion
rather than a customization for partial-completion, because completing
with a leading glob is inefficient: it doesn't allow the completion
table to do any filtering at all.  So, for example, one might want the
regular partial-completion style to run first, and if it doesn't find
anything then the substring-partial-completion style can run.

Further claim: I think the substring completion style should be replaced
with the substring-partial-completion style in most places.  But that
may be a bit more controversial.

In GNU Emacs 29.2.50 (build 6, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2024-03-25 built on
 igm-qws-u22796a
Repository revision: 5d867aca5ea016c07fe9e8b60f55345f83012333
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.9 (Green Obsidian)

Configured using:
 'configure -C --with-x-toolkit=lucid --with-native-compilation
 --with-gif=ifavailable'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Add-substring-partial-completion-style.patch

From 6446dfddb240e206ae24d0a3124325121fd1ffe5 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Fri, 5 Apr 2024 08:34:59 -0400
Subject: [PATCH] Add substring-partial-completion style

---
 lisp/minibuffer.el | 46 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a1df6f4c5ab..76de97e0ad9 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1061,6 +1061,14 @@ completion-styles-alist
 I.e. when completing \"foo_bar\" (where _ is the position of point),
 it will consider all completions candidates matching the glob
 pattern \"*foo*bar*\".")
+    (substring-partial-completion
+     completion-substring-pcm-try-completion completion-substring-pcm-all-completions
+     "A combination of the partial-completion and substring styles.
+This is like the partial-completion style, but it will also
+expand at the start of a completion string.
+I.e. when completing \"l-co_h\" (where _ is the position of point),
+it will consider all completions candidates matching the glob
+pattern \"*l*-co*h*\".")
     (flex
      completion-flex-try-completion completion-flex-all-completions
      "Completion of an in-order subset of characters.
@@ -3727,10 +3735,13 @@ completion-pcm--pattern-trivial-p
 	     (setq trivial nil)))
 	 trivial)))
 
-(defun completion-pcm--string->pattern (string &optional point)
+(defun completion-pcm--string->pattern (string &optional point startglob)
   "Split STRING into a pattern.
 A pattern is a list where each element is either a string
-or a symbol, see `completion-pcm--merge-completions'."
+or a symbol, see `completion-pcm--merge-completions'.
+
+If STARTGLOB is non-nil, the pattern will start with the symbol
+`prefix' if it would otherwise start with a string."
   (if (and point (< point (length string)))
       (let ((prefix (substring string 0 point))
             (suffix (substring string point)))
@@ -3777,7 +3788,10 @@ completion-pcm--string->pattern
       (when (> (length string) p0)
         (if pending (push pending pattern))
         (push (substring string p0) pattern))
-      (nreverse pattern))))
+      (setq pattern (nreverse pattern))
+      (if (not (stringp (car pattern)))
+          pattern
+        (cons 'prefix pattern)))))
 
 (defun completion-pcm--optimize-pattern (p)
   ;; Remove empty strings in a separate phase since otherwise a ""
@@ -3976,11 +3990,12 @@ completion-pcm--hilit-commonality
    (t completions)))
 
 (defun completion-pcm--find-all-completions (string table pred point
-                                                    &optional filter)
+                                                    &optional filter startglob)
   "Find all completions for STRING at POINT in TABLE, satisfying PRED.
 POINT is a position inside STRING.
 FILTER is a function applied to the return value, that can be used, e.g. to
-filter out additional entries (because TABLE might not obey PRED)."
+filter out additional entries (because TABLE might not obey PRED).
+STARTGLOB controls whether there's a leading glob in the pattern."
   (unless filter (setq filter 'identity))
   (let* ((beforepoint (substring string 0 point))
          (afterpoint (substring string point))
@@ -3991,7 +4006,7 @@ completion-pcm--find-all-completions
     (setq string (substring string (car bounds) (+ point (cdr bounds))))
     (let* ((relpoint (- point (car bounds)))
            (pattern (completion-pcm--optimize-pattern
-                     (completion-pcm--string->pattern string relpoint)))
+                     (completion-pcm--string->pattern string relpoint startglob)))
            (all (condition-case-unless-debug err
                     (funcall filter
                              (completion-pcm--all-completions
@@ -4255,6 +4270,25 @@ completion-pcm-try-completion
                     'completion-pcm--filename-try-filter))))
     (completion-pcm--merge-try pattern all prefix suffix)))
 
+;; Substring-pcm completion
+;; A trivial copy of pcm completion, passing startglob=t
+
+(defun completion-substring-pcm-all-completions (string table pred point)
+  (pcase-let ((`(,pattern ,all ,prefix ,_suffix)
+               (completion-pcm--find-all-completions string table pred point nil t)))
+    (when all
+      (nconc (completion-pcm--hilit-commonality pattern all)
+             (length prefix)))))
+
+(defun completion-substring-pcm-try-completion (string table pred point)
+  (pcase-let ((`(,pattern ,all ,prefix ,suffix)
+               (completion-pcm--find-all-completions
+                string table pred point
+                (if minibuffer-completing-file-name
+                    'completion-pcm--filename-try-filter)
+                t)))
+    (completion-pcm--merge-try pattern all prefix suffix)))
+
 ;;; Substring completion
 ;; Mostly derived from the code of `basic' completion.
 
-- 
2.39.3


--=-=-=--




Acknowledgement sent to Spencer Baugh <sbaugh@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#70217; 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: Sat, 6 Apr 2024 08:15:02 UTC

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