GNU bug report logs - #79377
[PATCH] Return case common to all completions in try-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 79377 <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 79377 <at> debbugs.gnu.org:


Received: (at 79377) by debbugs.gnu.org; 16 Oct 2025 17:21:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 16 13:21:21 2025
Received: from localhost ([127.0.0.1]:37107 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v9RfA-0001yb-1n
	for submit <at> debbugs.gnu.org; Thu, 16 Oct 2025 13:21:21 -0400
Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:54122)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1v9Rf5-0001xB-D8; Thu, 16 Oct 2025 13:21:12 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2])
 (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-101.mailbox.org (Postfix) with ESMTPS id 4cnZVP51jJz9tR3;
 Thu, 16 Oct 2025 19:21:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1760635261;
 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=LpGdNwCOBZn/JjzlcIawfbPK+LYwVlQ3k93WY1324bw=;
 b=m+MTuwzE1oBv7hpWqfYmE4PfrQQrwZnTUxnbhjCCGQ3P5/87GAyy9dMR18Osgv4X44Dum4
 9kNKyMrxVC6Kcyz3TmLjvf7SZ6ARSC2lPC3N1fEDKVf7/EJpTcfHwOmbduovpzsr/2DklZ
 7OH3qvq1Q0XXWznM00q3qunpNX8oTLnv1LJiTgNeJ76G++DNCfxitebvVdlZdlwwg6JSn3
 n3fBmNrGUgdZrXp1cw40VH6neq6/hW96JT+dij00pYQVuFHJy8OKA99YhJxFygl5YEfmh+
 tXj4khjtqo8iXqHTwje++bQ3mLiFv4ai/9eAwXOtsAieRgJO30QuOGwrMp0azA==
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <86h5w0c9ug.fsf@HIDDEN>
Organization: LINKOV.NET
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN> <86sefq7nom.fsf@HIDDEN>
 <ier5xcmzpev.fsf@HIDDEN> <87jz0whxw5.fsf@HIDDEN>
 <ierv7kghwb6.fsf@HIDDEN> <86h5w0c9ug.fsf@HIDDEN>
Date: Thu, 16 Oct 2025 20:19:11 +0300
Message-ID: <878qhalq7k.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79377
Cc: Spencer Baugh <sbaugh@HIDDEN>, monnier@HIDDEN,
 rms@HIDDEN, 79377 <at> debbugs.gnu.org, 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 79377 31.0.50
thanks

>> Or more precisely: if there are matches, and the matches have a
>> *case-sensitive* common prefix, use that.  If not, keep the original
>> string.
>
> Sounds reasonable.

So now pushed the latest patch and closed.




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

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


Received: (at 79377) by debbugs.gnu.org; 15 Oct 2025 18:15:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 15 14:15:57 2025
Received: from localhost ([127.0.0.1]:56752 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v962W-0001BI-R3
	for submit <at> debbugs.gnu.org; Wed, 15 Oct 2025 14:15:57 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:50579)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1v962M-00019r-9j
 for 79377 <at> debbugs.gnu.org; Wed, 15 Oct 2025 14:15:49 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8D38E1000BC;
 Wed, 15 Oct 2025 14:15:40 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1760552139;
 bh=ValLDYBK3716/6z2jsYyKVL4aiDJLAy7ku7il6JQsM8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=jDEYZ+SCFIY8pjSYbgJVUVtmweofNM67VUc78L2TleKSDbHFzjSgO5ntQxXWJdFhK
 e/PbNRy3Qm0ELHQIxmYFWIJPwaYWtN/NplbMX3AygMy6Cl/scI03ZGIi6UMuNHnmWQ
 Ho1BA/L7CQGNgrCdfLYAIobDJiLjVcT9ZZegEtQzwLvIuL6ifCcz6sbe/xQSfzC8YL
 dZuuFl1FdVEWYww5L9iJr2a63VbvfMRSpFPCqZRV3zlNNk4NP8fM09t5Yd+X5d7xtI
 G4f4KMka6sIjdqalY+r2X+iHz12fo6cwkuTMFGeOaUCf8+qUNKlqcF8LZ9CXV0Oor5
 cLgMW71RDauJQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C748A100029;
 Wed, 15 Oct 2025 14:15:39 -0400 (EDT)
Received: from asado (unknown [181.28.45.30])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B0BB51203F3;
 Wed, 15 Oct 2025 14:15:36 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <87jz0whxw5.fsf@HIDDEN>
Message-ID: <jwv8qhc11mo.fsf-monnier+emacs@HIDDEN>
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN> <86sefq7nom.fsf@HIDDEN>
 <ier5xcmzpev.fsf@HIDDEN> <87jz0whxw5.fsf@HIDDEN>
Date: Wed, 15 Oct 2025 14:15:30 -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.117 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: 79377
Cc: Spencer Baugh <sbaugh@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 rms@HIDDEN, 79377 <at> debbugs.gnu.org, 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 (---)

Juri Linkov [2025-10-15 20:34:34] wrote:
> So what is the conclusion?  That when there are matches then let's use their
> common prefix?  But in case of no matches, let's keep the original string?

I think the high-level rule should be:

    Change the case of letters to bring the minibuffer closer to the set
    of matching candidates.

Remains to describe "closer", but I think it makes a lot of sense to
make this rule conservative in the sense that it's considered closer
only when each and every matching candidate is closer.

So returning "ab" when completing "Ab" against ("abc" "ABD"), like Eli
suggests, would break the rule because it brings it closer to "abc" but
further from "ABC".  In such a case I think it's best to stay put.


        Stefan





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

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


Received: (at 79377) by debbugs.gnu.org; 15 Oct 2025 18:14:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 15 14:14:08 2025
Received: from localhost ([127.0.0.1]:56739 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v960m-0000xT-AS
	for submit <at> debbugs.gnu.org; Wed, 15 Oct 2025 14:14:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59350)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1v960d-0000wW-AK
 for 79377 <at> debbugs.gnu.org; Wed, 15 Oct 2025 14:14:00 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1v960P-0008EA-Pa; Wed, 15 Oct 2025 14:13:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=vT9DvPWtmi3tnUmH80/L9Ge38Lv3ec+6Y/V9GyyKxFY=; b=Nv1sJEaAbpta
 PKQZFdI7IkhgabsUwxN9/3B04VIIIDfMFM7k2Gx1R2ituwhjl0nl6DhbmmsOgXJsx87jOrweXIXVh
 oXbqBkU91PMfa9ugiIkpgdVawOVimVdZfOQ4oq7oEAXP5BD+egM7eI+NbzxiipBGTeDcHvXyq5JLO
 G/N3EMSLNIQKbweR7Xn7TC4HEDMKpuhe3rfQwelc8tmLjuYuWYVRLXniwxZsNHPmn1nSzZfi6xoSf
 5VD8RQzHDdqPeHFnp4To0QBn/BDmCrGlG6VUyTVyZ9LKqQYe4/6v6QItndM2cEmBUagFgIoimrMCw
 ec4hTTShcBIr7Yto3qfxuA==;
Date: Wed, 15 Oct 2025 21:12:55 +0300
Message-Id: <86h5w0c9ug.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <ierv7kghwb6.fsf@HIDDEN> (message from Spencer Baugh on
 Wed, 15 Oct 2025 14:08:45 -0400)
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN> <86sefq7nom.fsf@HIDDEN>
 <ier5xcmzpev.fsf@HIDDEN> <87jz0whxw5.fsf@HIDDEN>
 <ierv7kghwb6.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, monnier@HIDDEN, rms@HIDDEN,
 79377 <at> debbugs.gnu.org, juri@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 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: dmitry@HIDDEN,  Eli Zaretskii <eliz@HIDDEN>,  rms@HIDDEN,
>    79377 <at> debbugs.gnu.org,  monnier@HIDDEN
> Date: Wed, 15 Oct 2025 14:08:45 -0400
> 
> Or more precisely: if there are matches, and the matches have a
> *case-sensitive* common prefix, use that.  If not, keep the original
> string.

Sounds reasonable.




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

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


Received: (at 79377) by debbugs.gnu.org; 15 Oct 2025 18:09:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 15 14:09:06 2025
Received: from localhost ([127.0.0.1]:56715 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v95vt-0000i1-80
	for submit <at> debbugs.gnu.org; Wed, 15 Oct 2025 14:09:06 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:54757)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1v95vf-0000hL-HV
 for 79377 <at> debbugs.gnu.org; Wed, 15 Oct 2025 14:08:56 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <87jz0whxw5.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 15 Oct 2025 20:34:34 +0300")
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN> <86sefq7nom.fsf@HIDDEN>
 <ier5xcmzpev.fsf@HIDDEN> <87jz0whxw5.fsf@HIDDEN>
Date: Wed, 15 Oct 2025 14:08:45 -0400
Message-ID: <ierv7kghwb6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1760551725;
 bh=flBw2gV4YMGHz5kGK40Ty1IhvkIF00DE4C291CE9VUw=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=F3V9/b8vxEqLoAc/NP7OFD7MY+JczyTpVeS9CCIq7EPsZGBrI796F2hxKQiQ1un4s
 IX/1OLgVGR7dN/VHNIx75bo6V8kXGcaXVdz9uCbN5u1bEVuqUwWwVYl9Bv+KHU1Z24
 vuFV80U0zbAP/Q9UlGnCz98jz1enVKvYIphCxB+4mSxSxvnXpi4LJos8GyZ3TokUPB
 3N7Nda1S1Hfjr2MYJbb2lqixySvAC3r16XiTTAD4xlAgdvRgoAf8jrUkVx0NCKT0m4
 mF9wVW16QtdBbvKAIdF2N1piKWpeAq/GssJ+rVx5ImuriyuTiawPUmb5qVE1O2IjaX
 mtRf6+G9gU/nA==
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, rms@HIDDEN,
 79377 <at> debbugs.gnu.org, 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: -3.3 (---)

Juri Linkov <juri@HIDDEN> writes:

>> However, I think it's also reasonable to just not change the user's text
>> in this case, because we don't have an unambiguously better thing to
>> change the text to.  That is how completion works in general:
>> try-completion only expands the minibuffer text if the user has typed an
>> unambiguously matching string for some subset of completions.
>>
>> Also, there's a fairly deep issue with returning "ab".  Returning "ab"
>> would be throwing away information, which might make the set of matching
>> completions change, which is undesirable.
>>
>> Concretely, imagine completion-styles has two elements:
>>
>> 1. ignore-case-nil (which sets completion-ignore-case=nil)
>> 2. ignore-case-t (which sets completion-ignore-case=t)
>>
>> We first run ignore-case-nil with "Ab" against '("abc" "ABD"), it
>> will return that there are no completions.
>>
>> So then we fall through to running ignore-case-t, which returns that
>> "Ab" completes to both "abc" and "ABD".
>>
>> If ignore-case-t-try-completion returned "ab" in this case, then we'd
>> replace the minibuffer text with "ab".
>>
>> But then, the next time the user triggers completion, ignore-case-nil
>> will return that there is a unique completion: "abc".
>>
>> So the observed behavior from a user with this completion-styles
>> configuration would be that if they type "Ab" and hit TAB twice, it will
>> complete to "abc" and not give them a chance to complete it to "ABC".
>> That is bad.
>
> So what is the conclusion?  That when there are matches then let's use their
> common prefix?  But in case of no matches, let's keep the original string?

Yes.

Or more precisely: if there are matches, and the matches have a
*case-sensitive* common prefix, use that.  If not, keep the original
string.




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

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


Received: (at 79377) by debbugs.gnu.org; 15 Oct 2025 17:35:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 15 13:35:39 2025
Received: from localhost ([127.0.0.1]:56494 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v95PT-0006wO-SD
	for submit <at> debbugs.gnu.org; Wed, 15 Oct 2025 13:35:39 -0400
Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:56076)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1v95PN-0006w2-Ks
 for 79377 <at> debbugs.gnu.org; Wed, 15 Oct 2025 13:35:30 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2])
 (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-201.mailbox.org (Postfix) with ESMTPS id 4cmysN6mdXz9tWv;
 Wed, 15 Oct 2025 19:35:20 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1760549721;
 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=RnqgHkkcGJUm2CU7HQddbF2/raLtOQRKYrH+7u68/uA=;
 b=MGZU6BQkC7huPdK0gxulugf3XQjEtouZ61/hsRWMy4pw9myF+x+98clFVZ9Gh+3TEEO5fY
 WtRB12dxUAtiuMGKNLVL4TC8u1zL3/ac4dOz2EDH7Xwcndh4Jjwlp4wrBrV1t2R/kcgbXB
 q/8gJjBjn8K1ymojBYlJklxVLEHN6kvo4w7zMSpzExykZMo+F/mhZlC5OwYYJ8z+zahi0I
 rCuXkrFCkV9yBjh0j0ajd9b6mztBfi/4RJuzLTe0LZCQ1udWps6sj4rtGG3Zf5qXPGlmV3
 J0I/wNaJpHWY2Py9f78UB2Ny+kua0i7znEBXjJCDVCtQQyi5GAPzi6VjQhSaZA==
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <ier5xcmzpev.fsf@HIDDEN>
Organization: LINKOV.NET
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN> <86sefq7nom.fsf@HIDDEN>
 <ier5xcmzpev.fsf@HIDDEN>
Date: Wed, 15 Oct 2025 20:34:34 +0300
Message-ID: <87jz0whxw5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, rms@HIDDEN,
 79377 <at> debbugs.gnu.org, 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 (-)

> However, I think it's also reasonable to just not change the user's text
> in this case, because we don't have an unambiguously better thing to
> change the text to.  That is how completion works in general:
> try-completion only expands the minibuffer text if the user has typed an
> unambiguously matching string for some subset of completions.
>
> Also, there's a fairly deep issue with returning "ab".  Returning "ab"
> would be throwing away information, which might make the set of matching
> completions change, which is undesirable.
>
> Concretely, imagine completion-styles has two elements:
>
> 1. ignore-case-nil (which sets completion-ignore-case=nil)
> 2. ignore-case-t (which sets completion-ignore-case=t)
>
> We first run ignore-case-nil with "Ab" against '("abc" "ABD"), it
> will return that there are no completions.
>
> So then we fall through to running ignore-case-t, which returns that
> "Ab" completes to both "abc" and "ABD".
>
> If ignore-case-t-try-completion returned "ab" in this case, then we'd
> replace the minibuffer text with "ab".
>
> But then, the next time the user triggers completion, ignore-case-nil
> will return that there is a unique completion: "abc".
>
> So the observed behavior from a user with this completion-styles
> configuration would be that if they type "Ab" and hit TAB twice, it will
> complete to "abc" and not give them a chance to complete it to "ABC".
> That is bad.

So what is the conclusion?  That when there are matches then let's use their
common prefix?  But in case of no matches, let's keep the original string?




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

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


Received: (at 79377) by debbugs.gnu.org; 10 Oct 2025 16:34:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 10 12:34:57 2025
Received: from localhost ([127.0.0.1]:42597 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v7G4y-00075O-Ot
	for submit <at> debbugs.gnu.org; Fri, 10 Oct 2025 12:34:57 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:34955)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1v7G4l-00074p-6W
 for 79377 <at> debbugs.gnu.org; Fri, 10 Oct 2025 12:34:45 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <86sefq7nom.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 10 Oct
 2025 18:59:21 +0300")
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN> <86sefq7nom.fsf@HIDDEN>
Date: Fri, 10 Oct 2025 12:34:32 -0400
Message-ID: <ier5xcmzpev.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1760114072;
 bh=qog8+GeVid77aEpCx+2ukfrMmMiLfkQBk6YzADTlPzY=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=nRl8M89Yt9HMqCzU30J+GUV/rcQC/d/bPAbc/AcBOBfr++ZGEl6ti4CA/Iusr7gvi
 Ole+AHjcQPNhJ8HL6YfyfveiO4Y6vSkIySOl/jkWaWFCAbQBq+cvAyW3k8+D+L2/Nk
 +AxDlkrMzNX8U90MGZQMdJsUAGV9f2xdiBC856kUFd/FlRccqoagoKHVuOqoOWQO82
 jM1CR/A632K9h2dx9A36yrVHb2RVWr/ion59MkYM8UPCkxp4LJN3DyvT01xaVHRGoe
 F/NCSuUzUss22EmvGaZ2b88hbVLuFPilRnr10TUXFNBXMqIRkkG2hl21DRKwmEswOJ
 9InF077o1Du5A==
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, juri@HIDDEN, rms@HIDDEN, 79377 <at> debbugs.gnu.org,
 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: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Spencer Baugh <sbaugh@HIDDEN>
>> Cc: Juri Linkov <juri@HIDDEN>,  dmitry@HIDDEN,
>>    monnier@HIDDEN,  79377 <at> debbugs.gnu.org,  rms@HIDDEN
>> Date: Fri, 10 Oct 2025 11:16:39 -0400
>> 
>> > With the input "ab", the new result is better.  What happens after the
>> > patch in the following cases?
>> >
>> >   (let ((completion-ignore-case t))
>> >     (completion-pcm-try-completion "Ab" '("ABC" "ABD") nil 1))
>> 
>> This returns ("AB" . 2)
>
> This is reasonable.

Right.  Because "AB" will still match all the possible completions: it's
a strict improvement on the previous minibuffer text, so we can
reasonably expect the user to be OK with changing the minibuffer text to
it.

And returning "AB" in cases like this is the existing behavior of
completion-pcm-try-completion, in more complex cases.

>> >   (let ((completion-ignore-case t))
>> >     (completion-pcm-try-completion "Ab" '("abc" "ABD") nil 1))
>> 
>> This returns ("Ab" . 2)
>
> But this is NOT, IMO.  I'd expect "ab" instead.  If we want to return
> "Ab" here because user types it, we should also return "Ab" in the
> first example, and for the same reasons.  Otherwise, this is
> inconsistent and unexpected.

I agree that "ab" is somewhat reasonable.  The implementation of
try-completion would be much simpler if it just returned "ab" here.

However, I think it's also reasonable to just not change the user's text
in this case, because we don't have an unambiguously better thing to
change the text to.  That is how completion works in general:
try-completion only expands the minibuffer text if the user has typed an
unambiguously matching string for some subset of completions.

Also, there's a fairly deep issue with returning "ab".  Returning "ab"
would be throwing away information, which might make the set of matching
completions change, which is undesirable.

Concretely, imagine completion-styles has two elements:

1. ignore-case-nil (which sets completion-ignore-case=nil)
2. ignore-case-t (which sets completion-ignore-case=t)

We first run ignore-case-nil with "Ab" against '("abc" "ABD"), it
will return that there are no completions.

So then we fall through to running ignore-case-t, which returns that
"Ab" completes to both "abc" and "ABD".

If ignore-case-t-try-completion returned "ab" in this case, then we'd
replace the minibuffer text with "ab".

But then, the next time the user triggers completion, ignore-case-nil
will return that there is a unique completion: "abc".

So the observed behavior from a user with this completion-styles
configuration would be that if they type "Ab" and hit TAB twice, it will
complete to "abc" and not give them a chance to complete it to "ABC".
That is bad.




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

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


Received: (at 79377) by debbugs.gnu.org; 10 Oct 2025 16:00:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 10 12:00:04 2025
Received: from localhost ([127.0.0.1]:42493 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v7FXE-0005We-78
	for submit <at> debbugs.gnu.org; Fri, 10 Oct 2025 12:00:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47982)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1v7FX2-0005WI-TO
 for 79377 <at> debbugs.gnu.org; Fri, 10 Oct 2025 11:59:52 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1v7FWq-0005Gv-Ed; Fri, 10 Oct 2025 11:59:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=kC5OQyQj2jLsOrtKuQ3tjYF7M4Pzazql0lnifTH9FIA=; b=W4G70P6Dd6e4
 UpZaF1SKoj/kIqG1K3kZ5zrzK10JGNMFJkOi+fTKVMNICxKSDJykYKGdZiUpAh1zYSmLBGTVD54Ea
 OEmCUwkMDPb11zrS+BpW+9CHfJ81SUoYjqAxrLtT5HpYX9ayscS+VLKI+A1kI7bPx0kPsFzmEUun8
 yxtsZU0Ha3+hcmVmEANwERG1W7+Kax3B5sFkBqI0b4lZpqocW26jkD9aGzU87t+WsSfglu26ZR3RR
 M4bOeWNzMSl/YS5fBPzzTmgVhr9iTXNY5dUHXEuhCGAyqPWPI3QkeBgGtTxu8il0bXem2btM4HU0y
 Zq+Jd9U+EtlVdWWbqu5vkg==;
Date: Fri, 10 Oct 2025 18:59:21 +0300
Message-Id: <86sefq7nom.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <ier8qhizt0o.fsf@HIDDEN> (message from Spencer Baugh on
 Fri, 10 Oct 2025 11:16:39 -0400)
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
 <ier8qhizt0o.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, rms@HIDDEN, monnier@HIDDEN,
 79377 <at> debbugs.gnu.org, juri@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 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: Juri Linkov <juri@HIDDEN>,  dmitry@HIDDEN,
>    monnier@HIDDEN,  79377 <at> debbugs.gnu.org,  rms@HIDDEN
> Date: Fri, 10 Oct 2025 11:16:39 -0400
> 
> > With the input "ab", the new result is better.  What happens after the
> > patch in the following cases?
> >
> >   (let ((completion-ignore-case t))
> >     (completion-pcm-try-completion "Ab" '("ABC" "ABD") nil 1))
> 
> This returns ("AB" . 2)

This is reasonable.

> >   (let ((completion-ignore-case t))
> >     (completion-pcm-try-completion "Ab" '("abc" "ABD") nil 1))
> 
> This returns ("Ab" . 2)

But this is NOT, IMO.  I'd expect "ab" instead.  If we want to return
"Ab" here because user types it, we should also return "Ab" in the
first example, and for the same reasons.  Otherwise, this is
inconsistent and unexpected.




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

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


Received: (at 79377) by debbugs.gnu.org; 10 Oct 2025 15:16:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 10 11:16:57 2025
Received: from localhost ([127.0.0.1]:42426 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v7ErY-0003RZ-Tv
	for submit <at> debbugs.gnu.org; Fri, 10 Oct 2025 11:16:57 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:40129)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1v7ErN-0003RD-Bj
 for 79377 <at> debbugs.gnu.org; Fri, 10 Oct 2025 11:16:50 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <86qzvb8f1b.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 10 Oct
 2025 09:08:32 +0300")
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN> <86qzvb8f1b.fsf@HIDDEN>
Date: Fri, 10 Oct 2025 11:16:39 -0400
Message-ID: <ier8qhizt0o.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
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=1760109399;
 bh=sfHJtZq7eLCqLo5Q/hMYbAycPdlNJg6uDaoRhTRMtB4=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=Vy2ikrp+vbBLS+Vzg3UDxOHNcrCVzOdYmqmsmVotDfc7IyGN3AWisSy9EL4UtSr+Q
 i3YZNMAU/H0KDxw+cUQH+BahQV9qFN7x0bbzJQuS11L/RY2bBgAjils+ZQG3HqtGOp
 MDQmu3rXtdtmh5HjsbGRv1+ZFGamVsKAzneNVuU6TRGXDtcuDmol7DJIu9KIY/TLJW
 JQTcT9kjL00NkGM8P9zaWr60BrhwnnzjKAy4JmgYAF8AHO3Y7tmmdQIVmE3rc2B5Mg
 3V+2Fk7fiOMIVfjD1QX2NwTDRErFRmu1S/te4wfYqx/dol4LVnwq6eK4b/GeHbZpx/
 mrMPXW98CL4JQ==
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, rms@HIDDEN, monnier@HIDDEN,
 79377 <at> debbugs.gnu.org, Juri Linkov <juri@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 (---)

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

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Juri Linkov <juri@HIDDEN>
>> Cc: Stefan Monnier <monnier@HIDDEN>,  sbaugh@HIDDEN,
>>   rms@HIDDEN,  79377 <at> debbugs.gnu.org,  dmitry@HIDDEN
>> Date: Thu, 09 Oct 2025 19:12:19 +0300
>> it's expected to return either the prefix "ab",
>> and the common part of the completion strings "AB".
>> 
>> With Spencer's patch it returns the reasonable value ("AB" . 2).
>
> With the input "ab", the new result is better.  What happens after the
> patch in the following cases?
>
>   (let ((completion-ignore-case t))
>     (completion-pcm-try-completion "Ab" '("ABC" "ABD") nil 1))

This returns ("AB" . 2)

>   (let ((completion-ignore-case t))
>     (completion-pcm-try-completion "Ab" '("abc" "ABD") nil 1))

This returns ("Ab" . 2)

I've added these to the patch as test cases.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Return-case-common-to-all-completions-in-try-complet.patch

From e0db2951e0bb5868d85212af6a639d61c275e004 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Wed, 3 Sep 2025 08:48:05 -0400
Subject: [PATCH] Return case common to all completions in try-completion

When completion-ignore-case is non-nil, if all completions share
a common prefix ignoring case, try-completion has always
returned that.  Now, if all completions also share a common
prefix including case, try-completion includes that common
prefix in its return value.

* lisp/minibuffer.el (completion-pcm--merge-completions): Always
use return value from try-completion, which may change case.
* src/minibuf.c (Ftry_completion): Return the common prefix
which changes case.
* test/lisp/minibuffer-tests.el (completion-pcm-bug4219)
(completion-substring-test-5): New tests.
---
 lisp/minibuffer.el            |  2 +-
 src/minibuf.c                 |  6 ------
 test/lisp/minibuffer-tests.el | 38 ++++++++++++++++++++++++++++++++++-
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ee2707d2e09..0792a8b83bd 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4753,7 +4753,7 @@ completion-pcm--merge-completions
                   ;; `prefix' only wants to include the fixed part before the
                   ;; wildcard, not the result of growing that fixed part.
                   (when (seq-some (lambda (elem) (eq elem 'prefix)) wildcards)
-                    (setq prefix fixed))
+                    (setq prefix (substring prefix 0 (length fixed))))
                   (push prefix res)
                   ;; Push all the wildcards in this stretch, to preserve `point' and
                   ;; `star' wildcards before ELEM.
diff --git a/src/minibuf.c b/src/minibuf.c
index 6d96160a851..53bc905af6f 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1820,12 +1820,6 @@ DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
 
   if (NILP (bestmatch))
     return Qnil;		/* No completions found.  */
-  /* If we are ignoring case, and there is no exact match,
-     and no additional text was supplied,
-     don't change the case of what the user typed.  */
-  if (completion_ignore_case && bestmatchsize == SCHARS (string)
-      && SCHARS (bestmatch) > bestmatchsize)
-    return string;
 
   /* Return t if the supplied string is an exact match (counting case);
      it does not require any change to be made.  */
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 6954643976a..3ed77186639 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -345,7 +345,34 @@ completion-pcm-bug4219
   (should (equal
            (let ((completion-ignore-case t))
              (completion-pcm-try-completion "a" '("ABC" "ABD") nil 1))
-           '("AB" . 2))))
+           '("AB" . 2)))
+  ;; Even when the text isn't growing.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm-try-completion "ab" '("ABC" "ABD") nil 2))
+           '("AB" . 2)))
+  ;; Or when point is in the middle of the region changing case.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm-try-completion "ab" '("ABC" "ABD") nil 1))
+           '("AB" . 2)))
+  ;; Even when the existing minibuffer contents has mixed case.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm-try-completion "Ab" '("ABC" "ABD") nil 1))
+           '("AB" . 2)))
+  ;; But not if the completions don't actually all have the same case.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm-try-completion "Ab" '("abc" "ABD") nil 1))
+           '("Ab" . 2)))
+  ;; We don't change case if it doesn't match all of the completions, though.
+  (should (equal
+           (let ((completion-ignore-case t)) (try-completion "a" '("ax" "Ay")))
+           "a"))
+  (should (equal
+           (let ((completion-ignore-case t)) (try-completion "a" '("Ay" "ax")))
+           "a")))
 
 (ert-deftest completion-substring-test-1 ()
   ;; One third of a match!
@@ -409,6 +436,15 @@ completion-substring-test-5
   (should (equal
            (completion-pcm--merge-try '("a" prefix "b") '("axb" "ayb") "" "")
            '("ab" . 2)))
+  ;; Letter-casing from the completions on the common prefix is still applied.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm--merge-try '("a" prefix "b") '("Axb" "Ayb") "" ""))
+           '("Ab" . 2)))
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm--merge-try '("a" prefix "b") '("AAxb" "AAyb") "" ""))
+           '("Ab" . 2)))
   ;; substring completion should successfully complete the entire string
   (should (equal
            (completion-substring-try-completion "b" '("ab" "ab") nil 0)
-- 
2.43.7


--=-=-=--




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

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


Received: (at 79377) by debbugs.gnu.org; 10 Oct 2025 06:09:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 10 02:09:07 2025
Received: from localhost ([127.0.0.1]:40796 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v76JO-0006m4-Jh
	for submit <at> debbugs.gnu.org; Fri, 10 Oct 2025 02:09:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58788)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1v76JK-0006lK-PW
 for 79377 <at> debbugs.gnu.org; Fri, 10 Oct 2025 02:09:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1v76J2-00069E-Ol; Fri, 10 Oct 2025 02:08:54 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Osrrxq87Is+dTzp7pStjnYNUGd/+2Ke6akS2jjVGMRE=; b=rsZCR5+Iayu4
 /1xXn3ssRVG73gooei8yUgv4txuidXFvvo3sihzooCDJ45gRAkc9GGKZglgumX1KZFTMTVyM7roTS
 NpjmIxr3/y0i27F2/QDCEWdTz3RMTv/BUmfsEBniVUzmcY9t6U/vyH8gzgHUS0waHaDWK5vwlbZGW
 7lQgUL6fkEbUZa6Ns4OVN2t/XrxzOH1qJfGsteRZe6Dp6/uKPO6it6UMQ+SSIXUuw6oXXwtoV4VDM
 CGM77whur7eIdwuXzaFa/c/76YwMVTYqLycQgxoBuH/hTabmZ+aRrbuY7vdLr1r6MoMlHsUYfp/St
 0bYymsro4Io3SadQWLc07A==;
Date: Fri, 10 Oct 2025 09:08:32 +0300
Message-Id: <86qzvb8f1b.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87jz14dtmc.fsf@HIDDEN> (message from Juri Linkov on
 Thu, 09 Oct 2025 19:12:19 +0300)
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
 <87jz14dtmc.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, sbaugh@HIDDEN, monnier@HIDDEN,
 79377 <at> debbugs.gnu.org, rms@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 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Stefan Monnier <monnier@HIDDEN>,  sbaugh@HIDDEN,
>   rms@HIDDEN,  79377 <at> debbugs.gnu.org,  dmitry@HIDDEN
> Date: Thu, 09 Oct 2025 19:12:19 +0300
> 
> >> Because everywhere else we try hard to obey the latter case present in
> >> the completions rather than keep the latter case typed by the user
> >> (presumably under the assumption that the users are happy to type
> >> "sloppily, without case" and let the completion intuit the intended
> >> case from existing completion candidates).
> >
> > I always thought we did that only if the user did not type mixed-case
> > string.
> 
> The user typing a mixed-case string is one thing,
> but returning a mixed-case string is another.

I thought that we took mixed-case input as an indication of user's
intent to preserve case, and in that case returning the string in the
letter-case typed by user seems to make sense.

> Currently this test
> 
>   (let ((completion-ignore-case t))
>     (completion-pcm-try-completion "ab" '("ABC" "ABD") nil 1))
> 
> returns the mixed-case ("Ab" . 2) that makes no sense:

I agree, but this is not the case I was talking about.  I was taking
about "Ab" or "AB" instead of "ab".

> it's expected to return either the prefix "ab",
> and the common part of the completion strings "AB".
> 
> With Spencer's patch it returns the reasonable value ("AB" . 2).

With the input "ab", the new result is better.  What happens after the
patch in the following cases?

  (let ((completion-ignore-case t))
    (completion-pcm-try-completion "Ab" '("ABC" "ABD") nil 1))

  (let ((completion-ignore-case t))
    (completion-pcm-try-completion "Ab" '("abc" "ABD") nil 1))




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

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


Received: (at 79377) by debbugs.gnu.org; 9 Oct 2025 16:22:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 09 12:22:27 2025
Received: from localhost ([127.0.0.1]:39047 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v6tPO-00044l-SU
	for submit <at> debbugs.gnu.org; Thu, 09 Oct 2025 12:22:27 -0400
Received: from mout-p-202.mailbox.org ([80.241.56.172]:40788)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1v6tPH-000446-HZ
 for 79377 <at> debbugs.gnu.org; Thu, 09 Oct 2025 12:22:20 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2])
 (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 4cjFWj0Nkjz9t5k;
 Thu,  9 Oct 2025 18:22:09 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1760026929;
 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=EA5F24xoYnfVxbb2cGXLOWkDxmubNRXN3Kvxi9EUR1Y=;
 b=uJbASmPA8JDVuCrgMdDvUt522DMJAYVvOkbMzHdlb8VWN99GFZ5w3BjLJwjLrGAI6/Ou+Q
 KNEs9gcsYeTc2Kon2XmLIphfaWAYX+oc5jahyvPW8e5p3GStgvYl/IpFMefkBHk2ajL5ea
 /OdRqmPG8gXyURXgKm70yk9ZqS6VqHb9ZlRE3Axp8ctSdn9pc+E1JtVao8MmaqnPFDycMD
 2r+h7Dqi0+qzCG+39cKE6gjUahSHgg+oVjQAIRSMLb9orXe9AU+5UpWlWafKovER7OMoad
 eo6Mht4dSgR5WWfa+/lLlClBW62p71EMHlz++P2ZRcUWRRuPlX1XMR9L8VkFSw==
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <86bjmoh6f5.fsf@HIDDEN>
Organization: LINKOV.NET
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
Date: Thu, 09 Oct 2025 19:12:19 +0300
Message-ID: <87jz14dtmc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79377
Cc: dmitry@HIDDEN, sbaugh@HIDDEN,
 Stefan Monnier <monnier@HIDDEN>, 79377 <at> debbugs.gnu.org, rms@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 (-)

>> Because everywhere else we try hard to obey the latter case present in
>> the completions rather than keep the latter case typed by the user
>> (presumably under the assumption that the users are happy to type
>> "sloppily, without case" and let the completion intuit the intended
>> case from existing completion candidates).
>
> I always thought we did that only if the user did not type mixed-case
> string.

The user typing a mixed-case string is one thing,
but returning a mixed-case string is another.

Currently this test

  (let ((completion-ignore-case t))
    (completion-pcm-try-completion "ab" '("ABC" "ABD") nil 1))

returns the mixed-case ("Ab" . 2) that makes no sense:
it's expected to return either the prefix "ab",
and the common part of the completion strings "AB".

With Spencer's patch it returns the reasonable value ("AB" . 2).




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

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


Received: (at 79377) by debbugs.gnu.org; 3 Oct 2025 21:33:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 03 17:33:24 2025
Received: from localhost ([127.0.0.1]:46281 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v4nP1-00031Y-4o
	for submit <at> debbugs.gnu.org; Fri, 03 Oct 2025 17:33:23 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31804)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1v4nOx-00030d-8H
 for 79377 <at> debbugs.gnu.org; Fri, 03 Oct 2025 17:33:20 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6A03F442293;
 Fri,  3 Oct 2025 17:33:12 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1759527191;
 bh=eEXaXu+zGsmnFiF9q+KaQDyLrgJINGxD9acZgMrlBG0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=OyCLWHpVogkQATh/MH63GOEXQSpHJymP15hmMIDihWsd+0dDnOslHHfBcbOb0bB+g
 Qsfn4xfSmucu5QrC2fM/kfw9D/MDHC6+3+1pQtCne2BbmZG517pqa6yTYOfk/21EsA
 Kpz/VOlBVQ74pQof+WlkEcz/ku8k0rOIlWewCs+yHTETMLLXOmsIzHnBRECPt8bO/2
 BwBCDH1s5u+nWkUOAKw4MUOyW4iUfugCTk6c6HvlsjQjSuXrr0k5isJD7nbk9rmBsZ
 S7paQYvxpkoWYaPOYvOAPDpFgySGl8lltBscmQxMO7Y8+x/OukRZKuQV1Qe6+4XD8n
 u/kUo/uAmj9nA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 64F22442297;
 Fri,  3 Oct 2025 17:33:11 -0400 (EDT)
Received: from pastel (104-195-206-22.cpe.teksavvy.com [104.195.206.22])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 16BC61205D2;
 Fri,  3 Oct 2025 17:33:11 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <86bjmoh6f5.fsf@HIDDEN>
Message-ID: <jwvsefzu0yq.fsf-monnier+emacs@HIDDEN>
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> <86bjmoh6f5.fsf@HIDDEN>
Date: Fri, 03 Oct 2025 17:33:09 -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.311 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: 79377
Cc: sbaugh@HIDDEN, rms@HIDDEN, 79377 <at> debbugs.gnu.org, 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 (---)

>> Because everywhere else we try hard to obey the latter case present in
>> the completions rather than keep the latter case typed by the user
>> (presumably under the assumption that the users are happy to type
>> "sloppily, without case" and let the completion intuit the intended
>> case from existing completion candidates).
> I always thought we did that only if the user did not type mixed-case
> string.

AFAIK this DWIMish behavior is used only for Isearch, not for completion
(probably in part because completion may bring in capitalized chars, so
we'd need to keep track separately of the minibuffer's content and of
the characters actually typed by the user).


        Stefan





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

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


Received: (at 79377) by debbugs.gnu.org; 3 Oct 2025 06:00:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 03 02:00:03 2025
Received: from localhost ([127.0.0.1]:43099 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v4Ypm-000886-3a
	for submit <at> debbugs.gnu.org; Fri, 03 Oct 2025 02:00:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42906)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1v4Ypg-00087S-3R
 for 79377 <at> debbugs.gnu.org; Fri, 03 Oct 2025 01:59:59 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1v4YpV-0003dt-6V; Fri, 03 Oct 2025 01:59:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=//mwH/AjeuqJwvJYERfYHQ9sV1cq53zVjfvKFVc7HM0=; b=RNH4cPrIC4na
 HUJty8HfjNvgAbZOiG8T4rG0Y/qWYumYRxLWlBMnEjUCWnL1YqpSSO+njzrRtIjwKBltPZI+S38t9
 ucvRQM3q6EPgbyHa1fpKOtTIyNRB1fpKnN+VFjqkQ48p7RGFpRZv7sE2wlb7Mzqr4c8Wi8mREEKiY
 WD3IyA3aYO+5hcXpoJWLxCqe4IbsAudVlbwDEK4mEueZsjBC9I6jHd5TyXfAwjk83belip/c+D8dH
 VoWBmuTYMuECFPIUw4r+XmAUxxKEIuymmbERsbIBla+j9lGL8TrBQejcExrYlxTomF3yEVg5u1tJ7
 FRh8wRlaSaQV1pTAUiEw1g==;
Date: Fri, 03 Oct 2025 08:59:26 +0300
Message-Id: <86bjmoh6f5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwv8qht42ou.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Thu, 02 Oct 2025 13:49:22 -0400)
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: sbaugh@HIDDEN, rms@HIDDEN, 79377 <at> debbugs.gnu.org, 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 (---)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: Richard Stallman <rms@HIDDEN>,  sbaugh@HIDDEN,
>   dmitry@HIDDEN,  79377 <at> debbugs.gnu.org
> Date: Thu, 02 Oct 2025 13:49:22 -0400
> 
> >> Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <at> debbugs.gnu.org
> >> Date: Tue, 30 Sep 2025 17:11:48 -0400
> >> From:  Stefan Monnier via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> >> 
> >> Eli, Richard, any objection?
> >> I'm in favor of the change, but it seems to looks like someone thought
> >> 34 years ago that the current behavior was preferable.
> >
> > Which Richard did you mean to ask?  If RMS, you didn't CC him.
> >
> > I have too much gray hair with such changes.  Why do we need this
> > change, and why are you in favor?
> 
> Because everywhere else we try hard to obey the latter case present in
> the completions rather than keep the latter case typed by the user
> (presumably under the assumption that the users are happy to type
> "sloppily, without case" and let the completion intuit the intended
> case from existing completion candidates).

I always thought we did that only if the user did not type mixed-case
string.




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

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


Received: (at 79377) by debbugs.gnu.org; 2 Oct 2025 20:22:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 02 16:22:21 2025
Received: from localhost ([127.0.0.1]:41763 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v4Poe-00010F-A5
	for submit <at> debbugs.gnu.org; Thu, 02 Oct 2025 16:22:21 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:52118)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1v4PoR-0000yc-Sv
 for 79377 <at> debbugs.gnu.org; Thu, 02 Oct 2025 16:22:09 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6210F8168B;
 Thu,  2 Oct 2025 16:21:57 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1759436516;
 bh=qrm2cfz2it05Jshh3e3HmdYIRNBh1OD1GPmfyE+VBMY=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=nI/HsSE2IcCHOwKb9KCSirLko4jwqzkfxL7fPtlQJ2wXq7wyUMm6xdMDJ+TgCD+bQ
 cNiIWg75V9te+q8a00BU8XzNGQMTisTHQ8ctsNU16cGzQeySuLEWyoyp+DsFk9diuw
 NAKy/52Rd9E5LLrhKpNiwoT3BZkE2rnBc4wiCBLMhA0KIHDLUczqsTYuUfYqy1Aiax
 9CGONCJ6qbTMv96ubsBN59aOVtQUSj+rthK/XxgMJB/KGB2AIoAq2rQLO05daBWtbd
 dJdDXOYR+ZRpTWgXFHS+4Hxci4EZtqKq5kiPiRaBIBby8IGeMW7rpnAxHDrO6ZgjLO
 FPa7Ftdg3RoDQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6D8B780329;
 Thu,  2 Oct 2025 16:21:56 -0400 (EDT)
Received: from asado (unknown [23.233.149.155])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4438A120648;
 Thu,  2 Oct 2025 16:21:56 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <jwv8qht42ou.fsf-monnier+emacs@HIDDEN>
Message-ID: <jwvseg112gu.fsf-monnier+emacs@HIDDEN>
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
 <jwv8qht42ou.fsf-monnier+emacs@HIDDEN>
Date: Thu, 02 Oct 2025 16:21:55 -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.156 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: 0.0 (/)
X-Debbugs-Envelope-To: 79377
Cc: sbaugh@HIDDEN, Richard Stallman <rms@HIDDEN>,
 79377 <at> debbugs.gnu.org, 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 (---)

> Because everywhere else we try hard to obey the latter case present in
                                                  ^^^^^^
                                                  letter

> the completions rather than keep the latter case typed by the user
                                       ^^^^^^
                                       letter

Duh!


        Stefan


PS: When I was young I couldn't understand how anyone could misspell
    "its" as "it's" or "theirs" as "there's".  Now that my brain has
    turned to mush I wonder how I ever managed to avoid doing that.





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

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


Received: (at 79377) by debbugs.gnu.org; 2 Oct 2025 17:49:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 02 13:49:48 2025
Received: from localhost ([127.0.0.1]:41317 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v4NR2-00075v-TN
	for submit <at> debbugs.gnu.org; Thu, 02 Oct 2025 13:49:48 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31957)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1v4NQo-00075A-0E
 for 79377 <at> debbugs.gnu.org; Thu, 02 Oct 2025 13:49:32 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D23EE4421BD;
 Thu,  2 Oct 2025 13:49:23 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1759427362;
 bh=9TWEL3d7aKxcuIqiE+MqVehPLHG53VOwTxMFK2SFugA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=gYTfjmb5BEvHpSjH3mPPen7btnxH9FLEu77Lp97YUDLg2aLEUCxA01EzS/jHs+kWr
 iyh/gW8Yruzcibd/J5h3hGqAwQ7RPsEdk9cam4CafwllisnRjkHqcHk9D8qmf++4Ny
 L0Py4bxtwXnJRnSusCzP4vIKVMW8et63oDEF2IAfk8B0IV/+8zDmnnlqRI2nUhlUgh
 UaN+6RcgnOVKDkELXZlzHeD4N3ZaHWUv0fKvjN3oaM22qAQdTNMTvGzHOgtWkYbnlU
 sdgphN39QUmxPr37dORun2hKCehZS9SIcHwt7FjdP3TlsR8uXj6U51+8Q8RxqpZ5U6
 O65cDpdXgOkeA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CBDBB4421AF;
 Thu,  2 Oct 2025 13:49:22 -0400 (EDT)
Received: from asado (unknown [23.233.149.155])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A5BBB12026A;
 Thu,  2 Oct 2025 13:49:22 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <86qzvn2ju4.fsf@HIDDEN>
Message-ID: <jwv8qht42ou.fsf-monnier+emacs@HIDDEN>
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN> <86qzvn2ju4.fsf@HIDDEN>
Date: Thu, 02 Oct 2025 13:49:22 -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.121 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: 79377
Cc: sbaugh@HIDDEN, Richard Stallman <rms@HIDDEN>,
 79377 <at> debbugs.gnu.org, 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 (---)

>> Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <at> debbugs.gnu.org
>> Date: Tue, 30 Sep 2025 17:11:48 -0400
>> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> 
>> Eli, Richard, any objection?
>> I'm in favor of the change, but it seems to looks like someone thought
>> 34 years ago that the current behavior was preferable.
>
> Which Richard did you mean to ask?  If RMS, you didn't CC him.
>
> I have too much gray hair with such changes.  Why do we need this
> change, and why are you in favor?

Because everywhere else we try hard to obey the latter case present in
the completions rather than keep the latter case typed by the user
(presumably under the assumption that the users are happy to type
"sloppily, without case" and let the completion intuit the intended
case from existing completion candidates).


        Stefan





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

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


Received: (at 79377) by debbugs.gnu.org; 1 Oct 2025 06:54:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 01 02:54:51 2025
Received: from localhost ([127.0.0.1]:34089 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v3qjf-0001Yd-3g
	for submit <at> debbugs.gnu.org; Wed, 01 Oct 2025 02:54:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42048)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1v3qjT-0001Xf-F4
 for 79377 <at> debbugs.gnu.org; Wed, 01 Oct 2025 02:54:40 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1v3qjH-0006P6-22; Wed, 01 Oct 2025 02:54:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=51Sy05wmlWlhcKamK2NLdcvITxcvacwtDTP752K+cyk=; b=W+7Hg8NrbLfR
 RXpiq+w5GjngOJiWW1u9U6/DRXkRM/O+BSNTvIj86c7nYQw6hykdZlEBA1GG/WmlzP11jJlGr+lCB
 Q4Doz+Z728iRwntDgjfqqZnD+T9EuhmeaIJm7k4ne+oAlHfDYgwLKobBULdlgEFfOEb+GgRB8L/rg
 4ZkTWFvCIk1myLwMNLFZmrjUqbdRP2auV4XAy2s8uRSdntfAQ7aSPXPvp3oWRKV5KO/8crFd2LnmQ
 Dufs6sKZftH4P4fWvkPuy/CZo9fZ/C6EfyMFTW4Gu/uslrKI3O/s6scaHVS7OwUY92PcstJu8YZTL
 kTtsVjRh1t/2NX8Hq07DVg==;
Date: Wed, 01 Oct 2025 09:54:11 +0300
Message-Id: <86qzvn2ju4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, Richard Stallman <rms@HIDDEN>
In-Reply-To: <jwvcy77642a.fsf-monnier+emacs@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
 <jwvcy77642a.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: sbaugh@HIDDEN, 79377 <at> debbugs.gnu.org, 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 (---)

> Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <at> debbugs.gnu.org
> Date: Tue, 30 Sep 2025 17:11:48 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> Eli, Richard, any objection?
> I'm in favor of the change, but it seems to looks like someone thought
> 34 years ago that the current behavior was preferable.

Which Richard did you mean to ask?  If RMS, you didn't CC him.

I have too much gray hair with such changes.  Why do we need this
change, and why are you in favor?




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

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


Received: (at 79377) by debbugs.gnu.org; 30 Sep 2025 21:12:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 30 17:12:59 2025
Received: from localhost ([127.0.0.1]:60661 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v3hed-0007V3-1J
	for submit <at> debbugs.gnu.org; Tue, 30 Sep 2025 17:12:59 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62336)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1v3heS-0007Uh-8e
 for 79377 <at> debbugs.gnu.org; Tue, 30 Sep 2025 17:12:50 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CD52C441FAB;
 Tue, 30 Sep 2025 17:12:40 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1759266759;
 bh=Hd9HJTw0+rTKef7z/RfH+GYzhbiM6Q+xSuVfsrFRnAw=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=phdf35Sv0+KDUywZs+MNmU17gkJcAqfK2u4bFgaObB0g3xPZjBFkiQ67pQoJDR+wm
 VsIJvOnYaN4PJqm9ZoGLdtbNZtpBAAKn0LOH74gaKmyto1YFDnfWMsoUadimh02K/K
 UovTVrV8dmBiAYnx7Q3MyEySzyMnVLq0Hyafhs/zd9hVNI96OkU+oIkbu65NtQcKr1
 U18zdhr0+KtPT5X6LgdHGkPrhS2hJwUDCED4fU31+G0/M00L3hiubmaWNMMM1b777Y
 li02ZfkYbQUnseUzRW78qjeJ2ZlBqA2/aw5CJnW8fYLcIiduA/a38H99taOx6naDsO
 t0H/yp/qSG8AA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4222D442019;
 Tue, 30 Sep 2025 17:12:39 -0400 (EDT)
Received: from asado (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BDEF712025D;
 Tue, 30 Sep 2025 17:12:18 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <ier4isj6cwx.fsf@HIDDEN>
Message-ID: <jwvcy77642a.fsf-monnier+emacs@HIDDEN>
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN> <ier4isj6cwx.fsf@HIDDEN>
Date: Tue, 30 Sep 2025 17:11:48 -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.150 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: 79377
Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <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 (---)

Eli, Richard, any objection?
I'm in favor of the change, but it seems to looks like someone thought
34 years ago that the current behavior was preferable.


        Stefan


Spencer Baugh [2025-09-30 13:57:50] wrote:

> Spencer Baugh <sbaugh@HIDDEN> writes:
>> Stefan Monnier <monnier@HIDDEN> writes:
>>>> Ultimately, these bugs are nicely fixed by an improvement to
>>>> Ftry_completion; the removed conditional (and its associated comment) in
>>>> Ftry_completion didn't actually improve behavior, but instead made case
>>>> behavior worse.  I believe the bad behavior which this conditional was
>>>> originally attempting to stop was removed at some point by other
>>>> enhancements to Ftry_completion's completion-ignore-case behavior, so
>>>> the conditional isn't necessary anymore.
>>>
>>> Hmm... the way I read the code (and its comment), this conditional does
>>> very purposefully what you don't want.  I don't know why that was
>>> considered desirable, so I tend to agree with you here, but I don't
>>> know what you think was the "bad behavior which this conditional was
>>> originally attempting to stop".
>>
>> Ah, you're right.  I just read through the history of this function and
>> I can't see anything like that.  So... yeah, I guess the "bad behavior
>> which this conditional was originally attempting to stop" is exactly the
>> behavior I want.  Well, 34 years after it was originally written, I do
>> think deleting this conditional is better :)
>
> Any further thoughts?  I think this should be good to install, if anyone
> would do that for me.  (I don't have commit access)





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

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


Received: (at 79377) by debbugs.gnu.org; 30 Sep 2025 17:58:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 30 13:58:08 2025
Received: from localhost ([127.0.0.1]:60156 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v3ec3-00068F-Bg
	for submit <at> debbugs.gnu.org; Tue, 30 Sep 2025 13:58:07 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:50011)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1v3ebu-00067d-OB
 for 79377 <at> debbugs.gnu.org; Tue, 30 Sep 2025 13:58:00 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <ierv7lzjxce.fsf@HIDDEN> (Spencer Baugh's message of
 "Wed, 03 Sep 2025 12:48:49 -0400")
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
 <ierv7lzjxce.fsf@HIDDEN>
Date: Tue, 30 Sep 2025 13:57:50 -0400
Message-ID: <ier4isj6cwx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1759255070;
 bh=Hv7Fx6TkOHlnERURKRdUqys14H9uOjvzDQFXDh8tm/s=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=Qr8iPE5BxYATe63hI+MfloVQdrv3sIjnxQlxPz2F4OkMHVilMjP40lb1cWKQLn7W4
 bxGQPHxiyH3mYkj8EuyJ2fLX3fPZvA+15UW2B66SQp2r+XuB58QdjYrxQRmxYDLtdp
 ouFpA68DbmbP7yzwXKloGawWvkrVRfdfX+G7P0Yb+c1QMFVMUC354fC5dR3dNHGCve
 hy1HPKyIvefTqXHTRMOHL2HaBt9To00M1ltp4AOTalTkrlHbSOd6Zd9pxBK6MWDlAe
 PBlauBi3qKkg5ST8zfRL/e7i6ZBwByy5ZGiniElNVZoPoIzFMxW4teln0hCy0LWeSG
 a/8zMu30mblpw==
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <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 (---)

Spencer Baugh <sbaugh@HIDDEN> writes:
> Stefan Monnier <monnier@HIDDEN> writes:
>>> Ultimately, these bugs are nicely fixed by an improvement to
>>> Ftry_completion; the removed conditional (and its associated comment) in
>>> Ftry_completion didn't actually improve behavior, but instead made case
>>> behavior worse.  I believe the bad behavior which this conditional was
>>> originally attempting to stop was removed at some point by other
>>> enhancements to Ftry_completion's completion-ignore-case behavior, so
>>> the conditional isn't necessary anymore.
>>
>> Hmm... the way I read the code (and its comment), this conditional does
>> very purposefully what you don't want.  I don't know why that was
>> considered desirable, so I tend to agree with you here, but I don't
>> know what you think was the "bad behavior which this conditional was
>> originally attempting to stop".
>
> Ah, you're right.  I just read through the history of this function and
> I can't see anything like that.  So... yeah, I guess the "bad behavior
> which this conditional was originally attempting to stop" is exactly the
> behavior I want.  Well, 34 years after it was originally written, I do
> think deleting this conditional is better :)

Any further thoughts?  I think this should be good to install, if anyone
would do that for me.  (I don't have commit access)




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

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


Received: (at 79377) by debbugs.gnu.org; 3 Sep 2025 16:48:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 03 12:48:58 2025
Received: from localhost ([127.0.0.1]:41293 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1utqfJ-0003vN-K2
	for submit <at> debbugs.gnu.org; Wed, 03 Sep 2025 12:48:57 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:57149)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1utqfH-0003uu-9X
 for 79377 <at> debbugs.gnu.org; Wed, 03 Sep 2025 12:48:56 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <jwvcy87wt76.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 03 Sep 2025 09:44:45 -0400")
References: <iera53blm5p.fsf@HIDDEN>
 <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
Date: Wed, 03 Sep 2025 12:48:49 -0400
Message-ID: <ierv7lzjxce.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1756918129;
 bh=whgBZt7KjI2gcz+z4rA8YYIUq6bf+ry1ng9CKGJjoZ4=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=0jUefKyQd7vnhonu5ND93k++7qy6xPGl5QuN8aqrMRraIViqWRT3fQDoo+P0ziPN1
 oBx3qncb1d1BxXn1lsGvJAp5V5JUoMmD7dyX+2vH8uAYE7ConVuDkfnqkvpMWVV9tg
 kvR+wwxJxsTYeCW99V1pqtPciJfeehAqSXscWpxROxBjjnltvMUJ8Q9sAx/nDT4EQS
 COjTwKM99xmUMxUjBKiOcauyRrejbnkmYrndp+Houyo9Y/evS1HgvZ7ZaPqmE/XPIK
 N7nFhdYsanmk6TFI7QjE7rOzyBIFuyZ3bYcJRocmar2+OTTLD6Ovi8lJi01Lprndt1
 cXm+Hb2fTrpYQ==
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79377
Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <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 (---)

Stefan Monnier <monnier@HIDDEN> writes:
>> Ultimately, these bugs are nicely fixed by an improvement to
>> Ftry_completion; the removed conditional (and its associated comment) in
>> Ftry_completion didn't actually improve behavior, but instead made case
>> behavior worse.  I believe the bad behavior which this conditional was
>> originally attempting to stop was removed at some point by other
>> enhancements to Ftry_completion's completion-ignore-case behavior, so
>> the conditional isn't necessary anymore.
>
> Hmm... the way I read the code (and its comment), this conditional does
> very purposefully what you don't want.  I don't know why that was
> considered desirable, so I tend to agree with you here, but I don't
> know what you think was the "bad behavior which this conditional was
> originally attempting to stop".

Ah, you're right.  I just read through the history of this function and
I can't see anything like that.  So... yeah, I guess the "bad behavior
which this conditional was originally attempting to stop" is exactly the
behavior I want.  Well, 34 years after it was originally written, I do
think deleting this conditional is better :)




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

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


Received: (at 79377) by debbugs.gnu.org; 3 Sep 2025 13:45:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 03 09:45:00 2025
Received: from localhost ([127.0.0.1]:39449 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1utnnH-0002W3-Pt
	for submit <at> debbugs.gnu.org; Wed, 03 Sep 2025 09:45:00 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51506)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1utnnC-0002Vk-3j
 for 79377 <at> debbugs.gnu.org; Wed, 03 Sep 2025 09:44:58 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DF58280A13;
 Wed,  3 Sep 2025 09:44:47 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1756907086;
 bh=0KvQKnUnw3ZW6jCGAYKDhqKzNRvDw252xPcg5JmOsD8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=mnl1JG6bjobBdHAvJErZjZepGlapBETUiQeK5mxMLBBlFwG3gxynLpe2pNrsi2Bd2
 pMk39RGwb+CjA94FgtSuXSkYdkCS+tmAKt+0yNZ9x2q1JgJQWjqA+EPkZk8LrT3jl5
 71tOw/p0cZnvvITJTAZT92JRwHVhfI+wLcNm5RqjLb+ykMnHme+er6CMlm/7+UjkF0
 PJC5Wqy64YIzrRZdeYofk2DpdUHwA/wOF6L3yUCdQHnx6h44uWEF6rtSSyh1V6XCzx
 nkUgfwj+bb3nQzkTny68nYAkyWYrj65iob8g4BX3ziQi8SVpCt5f1BSiYbyaVNtC62
 RY7vFLDXW0Q4A==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 936C9806D1;
 Wed,  3 Sep 2025 09:44:46 -0400 (EDT)
Received: from pastel (69-165-161-194.dsl.teksavvy.com [69.165.161.194])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 688F1120342;
 Wed,  3 Sep 2025 09:44:46 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79377: [PATCH] Return case common to all completions in
 try-completion
In-Reply-To: <iera53blm5p.fsf@HIDDEN>
Message-ID: <jwvcy87wt76.fsf-monnier+emacs@HIDDEN>
References: <iera53blm5p.fsf@HIDDEN>
Date: Wed, 03 Sep 2025 09:44:45 -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.299 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: 79377
Cc: Dmitry Gutov <dmitry@HIDDEN>, 79377 <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 (---)

> Ultimately, these bugs are nicely fixed by an improvement to
> Ftry_completion; the removed conditional (and its associated comment) in
> Ftry_completion didn't actually improve behavior, but instead made case
> behavior worse.  I believe the bad behavior which this conditional was
> originally attempting to stop was removed at some point by other
> enhancements to Ftry_completion's completion-ignore-case behavior, so
> the conditional isn't necessary anymore.

Hmm... the way I read the code (and its comment), this conditional does
very purposefully what you don't want.  I don't know why that was
considered desirable, so I tend to agree with you here, but I don't
know what you think was the "bad behavior which this conditional was
originally attempting to stop".


        Stefan





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

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


Received: (at submit) by debbugs.gnu.org; 3 Sep 2025 13:07:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 03 09:07:46 2025
Received: from localhost ([127.0.0.1]:39353 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1utnDG-0000Tx-0S
	for submit <at> debbugs.gnu.org; Wed, 03 Sep 2025 09:07:46 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58668)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1utnDB-0000Td-5J
 for submit <at> debbugs.gnu.org; Wed, 03 Sep 2025 09:07:43 -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 1utnD4-0003DP-V0
 for bug-gnu-emacs@HIDDEN; Wed, 03 Sep 2025 09:07:35 -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 1utnD2-0001Uf-64
 for bug-gnu-emacs@HIDDEN; Wed, 03 Sep 2025 09:07:34 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Return case common to all completions in try-completion
X-Debbugs-Cc: Stefan Monnier <monnier@HIDDEN>, Dmitry Gutov
 <dmitry@HIDDEN>
Date: Wed, 03 Sep 2025 09:07:30 -0400
Message-ID: <iera53blm5p.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=1756904850;
 bh=9E6HWzByr6p/CFIVnlNGCtrxgyo9p4TTldeHUIh3j78=;
 h=From:To:Subject:Date;
 b=gVjSemE2FeLObgBaHxlAvVceZlHqtn6Crn0jkiWqTzMuF00fyKaLXv0g7/6pfwP07
 y4beTRavpHyre5rh4owhrKm5kEiWMX5qca/G4YpssuQ1znMzzI5uGHIJD3Pzd8lG/e
 xxMSMKjflf00/503JmfV/OcIeleA6nvSf9M/y+v4AC0x1Gnv8vGyTnU8mVlfHQ2fcl
 YBIDKnlk9rhyIgUOYnhKv3srAsR/C5H21D7zN3hFLlo+RBiKeCr0yBv8QKkbeTi046
 3mf5dSxCDIoY+57t/0L9Mbzgm53L06luD1SoOgxiv7N4zGaP21hc/7BzkP87h6IlkS
 2OyjnjGqelVRQ==
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


There are a few bugs with completion-pcm-try-completion not returning
text whose case matches the completions, even when the case is identical
between all the completions.  I added some tests covering them.

Ultimately, these bugs are nicely fixed by an improvement to
Ftry_completion; the removed conditional (and its associated comment) in
Ftry_completion didn't actually improve behavior, but instead made case
behavior worse.  I believe the bad behavior which this conditional was
originally attempting to stop was removed at some point by other
enhancements to Ftry_completion's completion-ignore-case behavior, so
the conditional isn't necessary anymore.

In GNU Emacs 30.1.90 (build 43, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2025-09-03 built on
 igm-qws-u22796a
Repository revision: 8a831d9c110ea4dd349444de8f99d7cee10c5273
Repository branch: emacs-30
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-Return-case-common-to-all-completions-in-try-complet.patch

From 1064a06c656bd10db29c2749ce7b87b1100a78b1 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Wed, 3 Sep 2025 08:48:05 -0400
Subject: [PATCH] Return case common to all completions in try-completion

When completion-ignore-case is non-nil, if all completions share
a common prefix ignoring case, try-completion has always
returned that.  Now, if all completions also share a common
prefix including case, try-completion includes that common
prefix in its return value.

* lisp/minibuffer.el (completion-pcm--merge-completions): Always
use return value from try-completion, which may change case.
* src/minibuf.c (Ftry_completion): Return the common prefix
which changes case.
* test/lisp/minibuffer-tests.el (completion-pcm-bug4219)
(completion-substring-test-5): New tests.
---
 lisp/minibuffer.el            |  2 +-
 src/minibuf.c                 |  6 ------
 test/lisp/minibuffer-tests.el | 28 +++++++++++++++++++++++++++-
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index f3bca47f271..036e347ae22 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4705,7 +4705,7 @@ completion-pcm--merge-completions
                   ;; `prefix' only wants to include the fixed part before the
                   ;; wildcard, not the result of growing that fixed part.
                   (when (seq-some (lambda (elem) (eq elem 'prefix)) wildcards)
-                    (setq prefix fixed))
+                    (setq prefix (substring prefix 0 (length fixed))))
                   (push prefix res)
                   ;; Push all the wildcards in this stretch, to preserve `point' and
                   ;; `star' wildcards before ELEM.
diff --git a/src/minibuf.c b/src/minibuf.c
index 6d96160a851..53bc905af6f 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1820,12 +1820,6 @@ DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
 
   if (NILP (bestmatch))
     return Qnil;		/* No completions found.  */
-  /* If we are ignoring case, and there is no exact match,
-     and no additional text was supplied,
-     don't change the case of what the user typed.  */
-  if (completion_ignore_case && bestmatchsize == SCHARS (string)
-      && SCHARS (bestmatch) > bestmatchsize)
-    return string;
 
   /* Return t if the supplied string is an exact match (counting case);
      it does not require any change to be made.  */
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index de1a98c8189..a0c6a2fb8d5 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -345,7 +345,24 @@ completion-pcm-bug4219
   (should (equal
            (let ((completion-ignore-case t))
              (completion-pcm-try-completion "a" '("ABC" "ABD") nil 1))
-           '("AB" . 2))))
+           '("AB" . 2)))
+  ;; Even when the text isn't growing.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm-try-completion "ab" '("ABC" "ABD") nil 2))
+           '("AB" . 2)))
+  ;; Or when point is in the middle of the region changing case.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm-try-completion "ab" '("ABC" "ABD") nil 1))
+           '("AB" . 2)))
+  ;; We don't change case if it doesn't match all of the completions, though.
+  (should (equal
+           (let ((completion-ignore-case t)) (try-completion "a" '("ax" "Ay")))
+           "a"))
+  (should (equal
+           (let ((completion-ignore-case t)) (try-completion "a" '("Ay" "ax")))
+           "a")))
 
 (ert-deftest completion-substring-test-1 ()
   ;; One third of a match!
@@ -409,6 +426,15 @@ completion-substring-test-5
   (should (equal
            (completion-pcm--merge-try '("a" prefix "b") '("axb" "ayb") "" "")
            '("ab" . 2)))
+  ;; Letter-casing from the completions on the common prefix is still applied.
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm--merge-try '("a" prefix "b") '("Axb" "Ayb") "" ""))
+           '("Ab" . 2)))
+  (should (equal
+           (let ((completion-ignore-case t))
+             (completion-pcm--merge-try '("a" prefix "b") '("AAxb" "AAyb") "" ""))
+           '("Ab" . 2)))
   ;; substring completion should successfully complete the entire string
   (should (equal
            (completion-substring-try-completion "b" '("ab" "ab") nil 0)
-- 
2.43.7


--=-=-=--




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

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