GNU bug report logs - #79238
[PATCH] Treat a completion boundary change as completion

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; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 31.0.50, send any further explanations to 79238 <at> debbugs.gnu.org and Spencer Baugh <sbaugh@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 79238) by debbugs.gnu.org; 9 Oct 2025 17:52:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 09 13:52:16 2025
Received: from localhost ([127.0.0.1]:39303 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v6uoK-0001IS-5A
	for submit <at> debbugs.gnu.org; Thu, 09 Oct 2025 13:52:16 -0400
Received: from mout-p-202.mailbox.org ([80.241.56.172]:56542)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1v6uoE-0001I2-8S; Thu, 09 Oct 2025 13:52:11 -0400
Received: from smtp202.mailbox.org (smtp202.mailbox.org
 [IPv6:2001:67c:2050:b231:465::202])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4cjHWP1jwYz9t0M;
 Thu,  9 Oct 2025 19:52:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1760032321;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=tW0ydgjGC+zvtey/DFjyDJvDfRglgcok/XclETB8u4c=;
 b=MPbrq2ZPk4fwpdgLanOVk7vvxRorrJSvirmbA210NbPMtJErcXXeLQ3DunAsYb83ydwdkO
 TLTSWPWwsCqO0OO8GbsuKqGPtQeB8bIWbRla7CpeFgSCkHehYGk4mdjYaDfBpnNCbKPuL9
 yaYoYpPpaQ9FWOnyDqkO2zmfUu49v1aH9xm1dd1GVuUydNRjsoa8niXmrWCkXzc1QBXECy
 IUnK8G7NqKUkDkmxv8JsfdBbhP/BBKhQuicGQYjUCRdPZXF6flR4NwSv8ezhpxYc/+nX4H
 FLXPrlE7bx/r7CVFpPXUHY1udLBc96y9dWEHh4aOlSmCWu2uUHhg6AId9d59RA==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::202 as permitted sender)
 smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#79238: [PATCH] Treat a completion boundary change as
 completion
In-Reply-To: <jwvms60c77h.fsf-monnier+emacs@HIDDEN>
Organization: LINKOV.NET
References: <iercy8x7lnl.fsf@HIDDEN> <878qhkdsz2.fsf@HIDDEN>
 <jwvms60c77h.fsf-monnier+emacs@HIDDEN>
Date: Thu, 09 Oct 2025 20:50:51 +0300
Message-ID: <87tt087ymc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4cjHWP1jwYz9t0M
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79238
Cc: Spencer Baugh <sbaugh@HIDDEN>, 79238 <at> debbugs.gnu.org,
 Dmitry Gutov <dmitry@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.7 (-)

close 79238 31.0.50
thanks

>> Thanks, I tested your patch, and all tests are passed,
>> so I could push the patch if there are no objections.
>
> No objection on my side, LGTM.

So now pushed and closed.




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

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


Received: (at 79238) by debbugs.gnu.org; 9 Oct 2025 17:32:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 09 13:32:38 2025
Received: from localhost ([127.0.0.1]:39207 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v6uV7-00089r-Lh
	for submit <at> debbugs.gnu.org; Thu, 09 Oct 2025 13:32:38 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:35847)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1v6uV1-00088k-Pm
 for 79238 <at> debbugs.gnu.org; Thu, 09 Oct 2025 13:32:20 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7982A81A97;
 Thu,  9 Oct 2025 13:32:13 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1760031132;
 bh=P/Hcw5TTmyLsUxbl9ijNSWIQQpHbU0zjSXpD40Vj1oM=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=TctiE4aPFQ7gU6nKCB6rlW94wexgOscrPkLYD8XqysfiyIbtetDbsM+Oi1q51SC9s
 QP9Hmx26P3bmgOD6DuOVr3+kPnapCZ6/0hZB0MsPkGoia9pWvZHa+1qYAJnQLXpmQS
 X4a+VFTLyRCBwGX3UOFCDWAd5J/lO27u7Xilrzs3MO1/WEEPm/EMjIG8Qqdwbl7VD/
 0XjtvgNqMaTv0b92m9pPD4k2htqM8njJoneiwI9GwEwioNDeMmKR6765jaoxIgxJRf
 flIEqL+Vvpczik8H9X3gRDKim/uo8C0EI/H/XR8p3mWbZrkBCR4tI3kSjIp1AjrNAc
 QpaL5mJjD/3fw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 726AE80C22;
 Thu,  9 Oct 2025 13:32:12 -0400 (EDT)
Received: from asado (unknown [200.123.191.29])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 005B41205D2;
 Thu,  9 Oct 2025 13:32:10 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#79238: [PATCH] Treat a completion boundary change as
 completion
In-Reply-To: <878qhkdsz2.fsf@HIDDEN>
Message-ID: <jwvms60c77h.fsf-monnier+emacs@HIDDEN>
References: <iercy8x7lnl.fsf@HIDDEN> <878qhkdsz2.fsf@HIDDEN>
Date: Thu, 09 Oct 2025 13:32:06 -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.135 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: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  > Thanks, I tested your patch, and all tests are passed, >
 so I could push the patch if there are no objections. No objection on my
 side, LGTM. Stefan 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [132.204.25.50 listed in sa-trusted.bondedsender.org]
 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [132.204.25.50 listed in bl.score.senderscore.com]
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [132.204.25.50 listed in list.dnswl.org]
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [200.123.191.29 listed in zen.spamhaus.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
X-Debbugs-Envelope-To: 79238
Cc: Spencer Baugh <sbaugh@HIDDEN>, 79238 <at> debbugs.gnu.org,
 Dmitry Gutov <dmitry@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: -3.3 (---)

> Thanks, I tested your patch, and all tests are passed,
> so I could push the patch if there are no objections.

No objection on my side, LGTM.


        Stefan





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

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


Received: (at 79238) by debbugs.gnu.org; 9 Oct 2025 16:22:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 09 12:22:59 2025
Received: from localhost ([127.0.0.1]:39049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v6tPu-00047C-Cp
	for submit <at> debbugs.gnu.org; Thu, 09 Oct 2025 12:22:58 -0400
Received: from mout-p-103.mailbox.org ([80.241.56.161]:52922)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1v6tPK-00044C-4s
 for 79238 <at> debbugs.gnu.org; Thu, 09 Oct 2025 12:22:22 -0400
Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4cjFWn1DsXz9ths;
 Thu,  9 Oct 2025 18:22:13 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1760026933;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=lsw0x12T5pH2BC7epYQFv/i/eZFlRClci7XSwqn1cu0=;
 b=g0DU/oDu8kwZZp4sf4TCLVwfSJqcM8utuRK13yN4aGtG5TytFu8YrBqpMnra1NipWpBI/a
 eaxe1MWjp8Bjlcb2NXdd4gBNEI4oXCxh0pRE4WioktZK0xzN8j6y2GnsanTXFyE41SAML7
 1V/YSoJqf1OnYXuO7kg+nwIIOWECk/Mm41NgKjYg3Df74YLvY8dToQeG74djv4vsCkxYJJ
 xmC2ireJDrJWwG/h0L33Yf+zSWWBpC8tbMUeG3SCZtspKDGl4/lgDCR+6s7eslKtUL2gAR
 /4lER+QH12t+09KOKb5hHi7xdMccbAtKLngdn88mV4XPBdkbDQTKBW3tLY0EfA==
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79238: [PATCH] Treat a completion boundary change as
 completion
In-Reply-To: <iercy8x7lnl.fsf@HIDDEN>
Organization: LINKOV.NET
References: <iercy8x7lnl.fsf@HIDDEN>
Date: Thu, 09 Oct 2025 19:16:17 +0300
Message-ID: <878qhkdsz2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79238
Cc: Dmitry Gutov <dmitry@HIDDEN>, 79238 <at> debbugs.gnu.org,
 Stefan Monnier <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: -1.7 (-)

> In completion--do-completion, check if completion-try-completion
> moved point out of the old completion boundaries.  If that
> happened, then we did non-trivial completion even if the string
> is otherwise unchanged.
>
> For example,
> ~/src/emacs/trunk/lisp|/progmodes/project.el
> hitting TAB moves us to:
> ~/src/emacs/trunk/lisp/|progmodes/project.el
> then hitting TAB again moves us to
> ~/src/emacs/trunk/lisp/progmodes/|project.el
>
> Both of these completions are successful, but we previously ran
> code for completion failure (the t branch of the cond in
> completion--do-completion) in the second case.  In particular,
> we would always run minibuffer-completion-help, ignoring the
> specific value of completion-auto-help which controls whether or
> not to run minibuffer-completion-help.  Now we correctly run
> code for successful completion for both cases.
>
> We also always have checked that we're in the same boundaries
> before doing completion cycling; that check is now more
> accurate.

Thanks, I tested your patch, and all tests are passed,
so I could push the patch if there are no objections.




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

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


Received: (at submit) by debbugs.gnu.org; 14 Aug 2025 19:23:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 14 15:23:30 2025
Received: from localhost ([127.0.0.1]:34625 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1umdXt-0003HU-JW
	for submit <at> debbugs.gnu.org; Thu, 14 Aug 2025 15:23:30 -0400
Received: from lists.gnu.org ([2001:470:142::17]:47698)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1umdXo-0003H6-O6
 for submit <at> debbugs.gnu.org; Thu, 14 Aug 2025 15:23:27 -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 1umdXi-0008OO-Dr
 for bug-gnu-emacs@HIDDEN; Thu, 14 Aug 2025 15:23:18 -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 1umdXd-0000oY-Cj
 for bug-gnu-emacs@HIDDEN; Thu, 14 Aug 2025 15:23:17 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Treat a completion boundary change as completion
X-Debbugs-CC: Juri Linkov <juri@HIDDEN>, Dmitry Gutov
 <dmitry@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Date: Thu, 14 Aug 2025 15:23:10 -0400
Message-ID: <iercy8x7lnl.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=1755199391;
 bh=8XrBJ3rYYKUdg3WAixoe9RL+V6S7NUJ6B89a+jN1ZpY=;
 h=From:To:Subject:Date;
 b=cCAgzecSTOIX7uV84b3ytKx1XYtL7C40uQYdlmfOKRYULw+fX1hERZJZp3h4KBsHp
 izoFeY4wjb87Z4r0FuqC2qASXdG3kg+LF5czCzlhELuefTo3Oyep8Zfr9J8fKbVqaT
 1Q7KQk5P9ReNX6+dtgkXELBMK7H2TwUV5WeJ3rDTSaIyGV5RuLwYtyv2TvOz6hdWzg
 9+5+0lCDGvRpAzaBxa4CBG9c7cZRPg1eRzMGJlyhwpsgutQDzTQgp0L5V3Ew3nzWzY
 Vk1xNwSY/fhni2nA2rn4+ltNybIVjVuTuj7mSaFbBSLekB9JFcNlnpjdWmnKlpu87j
 /+dBs3WlPiB8Q==
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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
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


In completion--do-completion, check if completion-try-completion
moved point out of the old completion boundaries.  If that
happened, then we did non-trivial completion even if the string
is otherwise unchanged.

For example,
~/src/emacs/trunk/lisp|/progmodes/project.el
hitting TAB moves us to:
~/src/emacs/trunk/lisp/|progmodes/project.el
then hitting TAB again moves us to
~/src/emacs/trunk/lisp/progmodes/|project.el

Both of these completions are successful, but we previously ran
code for completion failure (the t branch of the cond in
completion--do-completion) in the second case.  In particular,
we would always run minibuffer-completion-help, ignoring the
specific value of completion-auto-help which controls whether or
not to run minibuffer-completion-help.  Now we correctly run
code for successful completion for both cases.

We also always have checked that we're in the same boundaries
before doing completion cycling; that check is now more
accurate.

In GNU Emacs 30.1.90 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2025-08-14 built on
 igm-qws-u22796a
Repository revision: c7ee7707212c0b7c2892d2d9da039375f624799c
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg --without-compress-install --with-tree-sitter
 --with-native-compilation=aot
 PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Treat-a-completion-boundary-change-as-completion.patch

From 79c0a93a8a03a7a8d8bcda4c5441731a2b02eccf Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Thu, 14 Aug 2025 15:15:29 -0400
Subject: [PATCH] Treat a completion boundary change as completion

In completion--do-completion, check if completion-try-completion
moved point out of the old completion boundaries.  If that
happened, then we did non-trivial completion even if the string
is otherwise unchanged.

For example,
~/src/emacs/trunk/lisp|/progmodes/project.el
hitting TAB moves us to:
~/src/emacs/trunk/lisp/|progmodes/project.el
then hitting TAB again moves us to
~/src/emacs/trunk/lisp/progmodes/|project.el

Both of these completions are successful, but we previously ran
code for completion failure (the t branch of the cond in
completion--do-completion) in the second case.  In particular,
we would always run minibuffer-completion-help, ignoring the
specific value of completion-auto-help which controls whether or
not to run minibuffer-completion-help.  Now we correctly run
code for successful completion for both cases.

We also always have checked that we're in the same boundaries
before doing completion cycling; that check is now more
accurate.

* lisp/minibuffer.el (completion--in-boundaries-p): Add.
(completion--do-completion): Check completion--in-boundaries-p.
---
 lisp/minibuffer.el | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 956b7e6235d..689cda7edab 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1519,6 +1519,15 @@ completion--message
   (if completion-show-inline-help
       (minibuffer-message msg)))
 
+(defun completion--in-boundaries-p (string collection pred suffix pos)
+  "Return non-nil if POS is in the current completion boundaries.
+
+Calls `completion-boundaries' with STRING, COLLECTION, PRED, SUFFIX."
+  (let* ((boundaries (completion-boundaries string collection pred suffix))
+         (start (car boundaries))
+         (end (+ (length string) (cdr boundaries))))
+    (>= start pos end)))
+
 (defun completion--do-completion (beg end &optional
                                       try-completion-function expect-exact)
   "Do the completion and return a summary of what happened.
@@ -1540,13 +1549,14 @@ completion--do-completion
 EXPECT-EXACT, if non-nil, means that there is no need to tell the user
 when the buffer's text is already an exact match."
   (let* ((string (buffer-substring beg end))
+         (pos (- (point) beg))
          (md (completion--field-metadata beg))
          (comp (funcall (or try-completion-function
                             #'completion-try-completion)
                         string
                         minibuffer-completion-table
                         minibuffer-completion-predicate
-                        (- (point) beg)
+                        pos
                         md)))
     (cond
      ((null comp)
@@ -1568,7 +1578,16 @@ completion--do-completion
       (let* ((comp-pos (cdr comp))
              (completion (car comp))
              (completed (not (string-equal-ignore-case completion string)))
-             (unchanged (string-equal completion string)))
+             (unchanged (string-equal completion string))
+             (only-changed-boundaries
+              (and (not completed)
+                   (/= comp-pos pos)
+                   (not (completion--in-boundaries-p
+                         (substring string 0 pos)
+                         minibuffer-completion-table
+                         minibuffer-completion-predicate
+                         (substring string pos)
+                         comp-pos)))))
         (if unchanged
 	    (goto-char end)
           ;; Insert in minibuffer the chars we got.
@@ -1597,15 +1616,8 @@ completion--do-completion
                   ;; try-completion and all-completions, for things
                   ;; like completion-ignored-extensions.
                   (when (and threshold
-                             ;; Check that the completion didn't make
-                             ;; us jump to a different boundary.
-                             (or (not completed)
-                                 (< (car (completion-boundaries
-                                          (substring completion 0 comp-pos)
-                                          minibuffer-completion-table
-                                          minibuffer-completion-predicate
-                                         ""))
-                                   comp-pos)))
+                             (not completed)
+                             (not only-changed-boundaries))
                    (completion-all-sorted-completions beg end))))
             (completion--flush-all-sorted-completions)
             (cond
@@ -1619,7 +1631,7 @@ completion--do-completion
               (setq completed t exact t)
               (completion--cache-all-sorted-completions beg end comps)
               (minibuffer-force-complete beg end))
-             (completed
+             ((or completed only-changed-boundaries)
               (cond
                ((pcase completion-auto-help
                   ('visible (get-buffer-window "*Completions*" 0))
@@ -1643,8 +1655,8 @@ completion--do-completion
              ;; means we've already given a "Complete, but not unique" message
              ;; and the user's hit TAB again, so now we give him help.
              (t
-              (if (and (eq this-command last-command) completion-auto-help)
-                  (minibuffer-completion-help beg end))
+              (when (and (eq this-command last-command) completion-auto-help)
+                (minibuffer-completion-help beg end))
               (completion--done completion 'exact
                                 (unless (or expect-exact
                                             (and completion-auto-select
-- 
2.39.3


--=-=-=--




Acknowledgement sent to Spencer Baugh <sbaugh@HIDDEN>:
New bug report received and forwarded. Copy sent to juri@HIDDEN, dmitry@HIDDEN, monnier@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to juri@HIDDEN, dmitry@HIDDEN, monnier@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#79238; 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: Thu, 9 Oct 2025 18:00:02 UTC

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