From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriel Newsgroups: gmane.emacs.bugs Subject: bug#49321: 28.0.50; [PATCH] Add option icomplete-matches-format Date: Sun, 04 Jul 2021 12:33:26 -0300 Message-ID: References: <87czry2mzu.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15009"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: 49321@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 04 17:37:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m04BD-0003mA-FN for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Jul 2021 17:37:11 +0200 Original-Received: from localhost ([::1]:39040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m04BC-0002Nz-An for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Jul 2021 11:37:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m04B4-0002Nc-4x for bug-gnu-emacs@gnu.org; Sun, 04 Jul 2021 11:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m04B3-00081u-Tz for bug-gnu-emacs@gnu.org; Sun, 04 Jul 2021 11:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m04B3-0001xb-Ly for bug-gnu-emacs@gnu.org; Sun, 04 Jul 2021 11:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gabriel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Jul 2021 15:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49321 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16254130067509 (code B ref -1); Sun, 04 Jul 2021 15:37:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jul 2021 15:36:46 +0000 Original-Received: from localhost ([127.0.0.1]:43041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m04An-0001x3-SF for submit@debbugs.gnu.org; Sun, 04 Jul 2021 11:36:46 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m04Al-0001wv-Er for submit@debbugs.gnu.org; Sun, 04 Jul 2021 11:36:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m04Al-0002NT-6x for bug-gnu-emacs@gnu.org; Sun, 04 Jul 2021 11:36:43 -0400 Original-Received: from mail-dm6nam08olkn2057.outbound.protection.outlook.com ([40.92.45.57]:33622 helo=NAM04-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m04Aj-0007ni-5d for bug-gnu-emacs@gnu.org; Sun, 04 Jul 2021 11:36:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ky9yTl/mU/Qe1HIY4gZYbMLbYmjKAApgdKlPSU6xqHd2ju2ognei9Betl1xzWPQerKQs4HpVII8zeKhZSI4Pu9tCsxjm9NKgrVVgtSgsZL1I7yfh7GIWTWBjc+m7yRLoCx8mzG+XBRX+U19wxnMGu5rbLrD7ki0ByZK8t/+8Xn04u9Rx2vgANMpS0FNxRlXBQLwS0a1vRKf6xJ8EEW8Yi0xIY8AsGO5KKoLsFhUuN2wfXPFCoKGEL5xMgJUmpwMBV6wwBwpiXlnnJAwveCg6+qcCwAHefN3tr191jHtcxINSd2UTVQYJqbNKpJlbRaZ3wSsUgM5rPjU4K3PLHRDlvg== 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-SenderADCheck; bh=6CEWNYMUU8RHtgrelWPuzcfTraVwDn4HiTDviE/+FNM=; b=YXDQNudrpF4XBsDDN6BL4S+Y7Pb2DxYWFLfZ8E6kdBwrTXjvBexi9n/D2QvapTN8t/Xzp57H8CW9adUyG+1QAA1wLCH11fUBna9s7sR4GafJLnIgPDcc0a/s6rm76t5yrjEvob8re1CM5xeH85wqSpuF+QHZ5n0xOmbMXQDUE17ksacoK03sECe0/BTPTASrwWkb8IQpGRzoLYvO2+lG7kW+htczuvQLSDSsh7xa8lqTEYigD+IqlgBY79crlY7vq0zGd2cTPFZZoI6x/IEi3Nh7vkOhkWeBjReYtAGAmF2mVoVO+ky0wXPXV82iCpOsalalukGuX/yUNSeD9w6rww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6CEWNYMUU8RHtgrelWPuzcfTraVwDn4HiTDviE/+FNM=; b=fv6qbJ6XDtmGA7erp0rOHmWqVZk45rHV3LYW+V92xG3kxcRZsPHSslaStezMjExLfdGzUz2UFgi5J/PLXuOlUeTYge6n1gRavqgUC29lTr8fpbcrpWdW/YoovZKoHs8CFom4Rt+NOtRIg2vMSZlfi6khy9dQ+ITnyyVu7fwDoeSQLd6IinH8BSQo7Fj/nBx4iGAsTkc2BebnzEQaRPxxH7AeLnru9e0sLsmBw7GEK3RnDLRFKbKuyUyC80A9gPPzey06OPlmJd9xf032Oa2sWhpeZZArBtWUq4TJJxIq0jEyO4wc59j4w8zxXC8CR7xVLTFPDi6c4+ydLJnjEGu4wQ== Original-Received: from BN8NAM04FT005.eop-NAM04.prod.protection.outlook.com (2a01:111:e400:7e85::4f) by BN8NAM04HT109.eop-NAM04.prod.protection.outlook.com (2a01:111:e400:7e85::302) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22; Sun, 4 Jul 2021 15:36:39 +0000 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com (2a01:111:e400:7e85::45) by BN8NAM04FT005.mail.protection.outlook.com (2a01:111:e400:7e85::408) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Sun, 4 Jul 2021 15:36:39 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:02475FDE1AC0134FD63631A704E8994E5199C1C78B49588E0ADC40CFAC937B1B; UpperCasedChecksum:32A4EC4B7E4BF3F75F5550CBE0DC4DE5D29296E929C35F1343FFE48F74935AD3; SizeAsReceived:8803; Count:45 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com ([fe80::5c64:1750:c3c7:c182]) by CH2PR01MB5879.prod.exchangelabs.com ([fe80::5c64:1750:c3c7:c182%2]) with mapi id 15.20.4287.033; Sun, 4 Jul 2021 15:36:38 +0000 In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Sun, 4 Jul 2021 16:00:10 +0100") X-TMN: [fU5z9EkZ9zkGH94EMWVmq48cfPsw1fdAjQq4btwUACCMXtEV0nwFMqSnvGKwJn03] X-ClientProxiedBy: CP2P215CA0044.LAMP215.PROD.OUTLOOK.COM (2603:10d6:102:2::30) To CH2PR01MB5879.prod.exchangelabs.com (2603:10b6:610:3c::12) X-Microsoft-Original-Message-ID: <87lf6m5c1l.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from desktop (2804:431:c7f2:3723:2e97:3346:1d59:b110) by CP2P215CA0044.LAMP215.PROD.OUTLOOK.COM (2603:10d6:102:2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.21 via Frontend Transport; Sun, 4 Jul 2021 15:36:37 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: da2f6e13-91f7-41d5-0ed3-08d93f018365 X-MS-TrafficTypeDiagnostic: BN8NAM04HT109: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jfnwh1Up+HXBc9MYsb5GNsIFGiV0e4tIAnX9H4KoALPMJRfVJ7OgTjeGNmUe2H9ZpclgevwDNaP+gooNg8O/7LBGtFrILnp2S87BHVVgpFkWq14egOSw7gt+mGAwlGrd+B/WksC1CXZ81DkT8TOMwhLfd7y/ok0Qvfo2JPv0jU57CRqcYAZLLvw1VquF+ICFrYHsysJAf+SmqvVXaWjXGejKXzpi608lnqlcK0nDbif5S0qSlLf3QezI+KVWl00oGONwBM/y4zKhgGrpneXSxfO9ZzS5mhPOEt/Md+ASrCiadzcXliqMoidzYD3bZjvjSZHdLUvCv01dZeox+785v+9k8qhxLpGolFhgwn4vGVA3M7tHFwpr8Z5ULj2vEX9fez80BrfBNKRV+TIKVdMHyaj7AhRb57thhfmr8wHun8CBnVq7iEpSuIX1I/4PSEY5 X-MS-Exchange-AntiSpam-MessageData: GC1ArqqOoF/yL1IQU076J7t/gNo/q7BYazPVXPSPPp29qZMwuLpS23ykqY+RakimuKHYEENio+wSRnKbCm3u9o7E5Hfsj7ayw0f8XewKKqodkQG//8gwlGR+fl+/S2EAj1OFoFcp2Dmwz80TAozbcqcGIG3RBeyVO8HBqC/qzUPe3+t2bzLxjDcGUi0HVwao6vRDyCPBUiXZ3In9in53gw== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: da2f6e13-91f7-41d5-0ed3-08d93f018365 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2021 15:36:38.7367 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM04FT005.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM04HT109 Received-SPF: pass client-ip=40.92.45.57; envelope-from=gabriel376@hotmail.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209411 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jo=C3=A3o T=C3=A1vora writes: > Thanks Lars, > > I think it'd be great to skip the `safe-length` and similar potentially > costly calls if the user decides he doesn't want this info (which > I suppose is icomplete-matches-format =3D nil) > > Jo=C3=A3o > Hi Joao, Thanks for your inputs, makes a lot of sense to shortcut this piece of code in case the user option is nil. Here is an updated version of the patch: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-option-icomplete-matches-format.patch >From d1e81cf0a31a2f5ac714c3cf6dc2cada527cb7a4 Mon Sep 17 00:00:00 2001 From: Gabriel do Nascimento Ribeiro Date: Sun, 4 Jul 2021 12:31:26 -0300 Subject: [PATCH 1/1] Add option icomplete-matches-format * lisp/icomplete.el (icomplete-matches-format): New user option. --- lisp/icomplete.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 576fced015..ce914c2f24 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -97,6 +97,12 @@ icomplete-with-completion-tables :type '(choice (const :tag "All" t) (repeat function))) +(defcustom icomplete-matches-format "%s/%s " + "Format of the current/total number of matches for the prompt prefix." + :version "28.1" + :type '(choice (const :tag "No prefix" nil) + (string :tag "Prefix format string" "%s/%s "))) + (defface icomplete-first-match '((t :weight bold)) "Face used by Icomplete for highlighting first match." :version "24.4") @@ -696,12 +702,11 @@ icomplete-exhibit (overlay-put icomplete-overlay 'before-string (and icomplete-scroll - (let ((past (length icomplete--scrolled-past))) - (format - "%s/%s " - (1+ past) - (+ past - (safe-length completion-all-sorted-completions)))))) + icomplete-matches-format + (let* ((past (length icomplete--scrolled-past)) + (current (1+ past)) + (total (+ past (safe-length completion-all-sorted-completions)))) + (format icomplete-matches-format current total)))) (overlay-put icomplete-overlay 'after-string text)))))))) (defun icomplete--affixate (md prospects) -- 2.32.0 --=-=-=--