GNU bug report logs - #78926
30.1; find-file-read-only require-match inconsistency

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

Package: emacs; Severity: wishlist; Reported by: Thierry Volpiatto <thievol@HIDDEN>; dated Mon, 30 Jun 2025 10:38:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 78926) by debbugs.gnu.org; 2 Jul 2025 11:12:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 02 07:12:24 2025
Received: from localhost ([127.0.0.1]:35886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWvO4-0003ef-3M
	for submit <at> debbugs.gnu.org; Wed, 02 Jul 2025 07:12:24 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57242)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>)
 id 1uWvNz-0003dZ-DS; Wed, 02 Jul 2025 07:12:20 -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 1uWvNr-0000AB-SV; Wed, 02 Jul 2025 07:12:12 -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=e9Z2MCF1RN69Ibapf6DG/Y+Pzi/OO945jsd0ob4cXbA=; b=Bdpu8nXBYtRA
 zsOQVH7s76C84+B8ufrjoGEZxf22CCsT8l9Vf5U9N9P6BiSUigcVjRDb1tw5WdF4R/IiXyLaTCu+c
 3kK7Sqqs6kYs8+ignGD8fgz+uH3gAEU46FcXu8cQsmQ6KpP53RQ44nt+XjVUIDoKjG/Y/Vys4C0cA
 Hadqghllhr/vRsmelPWAYRXupmPmtdveF38Kpz9aAiIoa/yoFW+VefI4etQeBGEQcObkE5f/56BXF
 aqIwiVsuw4Vx8nKM4o+J99wuu7ZdIHYmlHmGYnkxrqfMAsVWDgHz5H8PHyfAQ6cEXqO+jd/IIdZZt
 2hrF/RsO1Lw/6nMRogSGcg==;
Date: Wed, 02 Jul 2025 14:12:08 +0300
Message-Id: <86v7oa26ev.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Thierry Volpiatto <thievol@HIDDEN>
In-Reply-To: <87cyajsto8.fsf@HIDDEN> (message from Thierry Volpiatto on
 Tue, 01 Jul 2025 17:32:55 +0000)
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN> <86bjq42f7w.fsf@HIDDEN>
 <87sejgro6i.fsf@HIDDEN> <867c0s2bwb.fsf@HIDDEN>
 <87h5zwrkx4.fsf@HIDDEN> <861pqz3omb.fsf@HIDDEN>
 <87cyajsto8.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: 78926 <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 (---)

severity 78926 wishlist
thanks

> From: Thierry Volpiatto <thievol@HIDDEN>
> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
> Date: Tue, 01 Jul 2025 17:32:55 +0000
> 
> Start emacs -Q, say you have a directory ~/tmp/ containing foo.txt and
> bar.txt.
> 
> 1) C-x C-r ~/tmp/test.txt RET
> => find-file--read-only: ~/tmp/foo.txt does not exist
> 
> 2) C-x C-r ~/tmp/*.txt RET
> => Two buffer are opened foo.txt and bar.txt.
> 
> That's fine for 1) but I would prefer a [no match] preventing exiting the
> minibuffer.

find-file and friends are specially programmed not to do that, because
otherwise creating new files, a very frequent operation, would be too
annoying.  So I think this is a reasonable behavior.

> For 2) I had expected a [confirm] before maybe blocking emacs by opening
> too many buffers.

We have find-file-wildcards to control this.  AFAIU, you would like to
extend that variable to accept an integer value, which means visit
only up to that number of files, otherwise ask for confirmation.
Patches welcome.

> Now (setq confirm-nonexistent-file-or-buffer 'confirm)
> 
> And repeat 1) and 2).
> As you can see in both case we have a minibuffer-message [confirm].
> 
> In 1) I think it is confusing, I had expected instead a [no match].

Not sure why.  "No match" comes from completion, whereas "confirm"
comes from the coder that is controlled by the variable you
customized.  Not sure why you prefer "no match", since it's much more
general and therefore potentially confusing, especially for non-native
English speakers.

> In 2) [confirm] is nice because it may prevent opening hundred of buffer
> and blocking emacs.

I'd argue that it might be a bug.  Why ask for confirmation in this
case?

> So what I think would be the best is having [no match] in 1) and
> [confirm] in 2), however with the tools we have under hand you can't
> implement this, this is why find-file-read-only allow to have [confirm]
> in 2) but must use some code exiting with error in 1), you can't
> implement both, it is one or the other.
> 
> By patching completion--complete-and-exit (see the two patches I sent)
> you can allow the REQUIRE-MATCH arg of completing read using a function
> that can exit with three option: nil, non-nil or confirm whereas with
> the current code you can exit with nil or non-nil only.
> 
> And then you can make find-file-read-only prevent exiting with a non
> existing file in 1), And confirm a wildcard in 2).
> 
> Is this more clear?

Yes, thanks.

> Note:
> As you can see this is an enhancement there is no bug, the current
> behavior is not so nice but it is ok, we can live with it.

Agree.

> Thanks for reading and sorry for beeing unclear, it is not easy to
> explain non trivial things in english.

No need to be sorry, and thanks.




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 17:33:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 13:33:12 2025
Received: from localhost ([127.0.0.1]:58382 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWer1-00045c-Ly
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 13:33:12 -0400
Received: from mout02.posteo.de ([185.67.36.66]:52841)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1uWeqx-00043j-EP
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 13:33:08 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id D5C0F240101
 for <78926 <at> debbugs.gnu.org>; Tue,  1 Jul 2025 19:33:00 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net;
 s=1984.ea087b; t=1751391180;
 bh=EJzIUhneK65QjAvv14l2gcgeQZFpZD7yMNIFF6fgjZQ=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Autocrypt:OpenPGP:From;
 b=iEukX7IRULJ/be57FYr54PNgr9yvsvjuGbCXKCj+6X0AY3Niol9BrrPSc2UKDrjHc
 GmcS6Z2qtOJXLjpebvMP91OBM1YNhn9Nosf+pXGQ5kT+Eb3V020U6XNtEOtIdQlzgA
 eboXEvl5YfDJQlyAFPLXZRRiYkYyiP+m645C0DAfpWMv1Ynq8yS0FowHv/33wUmu8D
 zz3FW6pQmXULg93cfgWpe5ZujNaoqIMLZWbDBiLeavML9KqaWd9260/X5Z+DsREK8b
 hWoRVgFYBaqUflGFgb5kODvVBB1xZ2lEkoFHq0Ajy5yLbez0GAZ/c/q8x4CjWDkaQf
 mIwtNVF5QpppyBXyiJvoUijjrNxeodtO5SJyVDmazbbyhXMmQcP1T7+CQcOhVrPjwy
 z48w8XCTzMPdyiL2Jep4YeW38Z+9NNBKL5R3NzK6N3ByFrf/0VeiEsBwMJ/QEdOUPl
 MlPDHiQMr+igYEiLip99Ub+Ttp1uZbG8GE+SvsHRkVmuI6an2GK
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4bWqqb2rp1z6tyH;
 Tue,  1 Jul 2025 19:32:59 +0200 (CEST)
From: Thierry Volpiatto <thievol@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
In-Reply-To: <861pqz3omb.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 01 Jul
 2025 18:41:16 +0300")
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN> <86bjq42f7w.fsf@HIDDEN>
 <87sejgro6i.fsf@HIDDEN> <867c0s2bwb.fsf@HIDDEN>
 <87h5zwrkx4.fsf@HIDDEN> <861pqz3omb.fsf@HIDDEN>
Date: Tue, 01 Jul 2025 17:32:55 +0000
Message-ID: <87cyajsto8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Autocrypt: addr=thievol@HID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DZmpobKbxZ1JAqZM8lnmcZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: Thierry Volpiatto <thievol@HIDDEN>, 78926 <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 Zaretskii <eliz@HIDDEN> writes:

>> From: Thierry Volpiatto <thievol@HIDDEN>
>> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
>> Date: Tue, 01 Jul 2025 15:27:19 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> > Sorry, I don't understand why I need to patch Emacs in order to see
>> > some behavior it has by default.
>> 
>> To better understand my poor explanations :-)
>> 
>> But emacs doesn't have this behavior by default.
>
> Now I'm completely confused.  Let me step back and start over.

Sorry for the confusion.

> You started this discussion by describing some behavior of
> find-file-read-only that you thought was a bug, correct?

Not really a bug, but something unexpected I would say.

> If so, this discussion should lead to investigating why Emacs behaves
> like it does, and then to a decision whether and how to fix this
> behavior.
>
> Do you agree?

Yes.

> Or did I misunderstand your report and your rationale for starting
> this discussion?

Yes you misunderstood because I was not clear.

> If I understood you correctly, then I must see the problematic
> behavior in order to reason about it, let alone try to find out its
> reasons.  And I so far failed to see what you describe.  So I'm stuck
> trying to reproduce the problematic behavior you described, and would
> like to find a way of reproducing it before I could contribute
> something useful to this discussion.

Ok.

Start emacs -Q, say you have a directory ~/tmp/ containing foo.txt and
bar.txt.

1) C-x C-r ~/tmp/test.txt RET
=> find-file--read-only: ~/tmp/foo.txt does not exist

2) C-x C-r ~/tmp/*.txt RET
=> Two buffer are opened foo.txt and bar.txt.

That's fine for 1) but I would prefer a [no match] preventing exiting the
minibuffer.
For 2) I had expected a [confirm] before maybe blocking emacs by opening
too many buffers.

Now (setq confirm-nonexistent-file-or-buffer 'confirm)

And repeat 1) and 2).
As you can see in both case we have a minibuffer-message [confirm].

In 1) I think it is confusing, I had expected instead a [no match].

In 2) [confirm] is nice because it may prevent opening hundred of buffer
and blocking emacs.

So what I think would be the best is having [no match] in 1) and
[confirm] in 2), however with the tools we have under hand you can't
implement this, this is why find-file-read-only allow to have [confirm]
in 2) but must use some code exiting with error in 1), you can't
implement both, it is one or the other.

By patching completion--complete-and-exit (see the two patches I sent)
you can allow the REQUIRE-MATCH arg of completing read using a function
that can exit with three option: nil, non-nil or confirm whereas with
the current code you can exit with nil or non-nil only.

And then you can make find-file-read-only prevent exiting with a non
existing file in 1), And confirm a wildcard in 2).

Is this more clear?

Note:
As you can see this is an enhancement there is no bug, the current
behavior is not so nice but it is ok, we can live with it.

Thanks for reading and sorry for beeing unclear, it is not easy to
explain non trivial things in english.

-- 
Thierry




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 15:41:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 11:41:29 2025
Received: from localhost ([127.0.0.1]:57858 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWd6u-0002vA-3U
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:41:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38312)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uWd6q-0002te-H9
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:41:25 -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 1uWd6k-0008PF-N3; Tue, 01 Jul 2025 11:41:18 -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=l3UrFGgtGF5opy5Unxf7KnPsXNF8J8+Fn/J5ZhTW3+U=; b=W6shKB81mpzW
 zOoS2JetituDdIDSbY5+l2YGyyswi7iNgbWKRt2vf+MyiZIQorian9MDR0MhPSFvrM5YnZQcT3Q4E
 2VpdKuGCbIx0JzeBcLF7Vo39wxIWETTnR+4pzJyHCUlYV2+5eZdowJUn0FpAQRVA+HVDDXOhkiFAp
 SoSrZ0okWfR6n50iLhugvYjbUCKEOdknJZiUhLBgRKZp3aa9GkeJca/zex4wj9xMEgV3Zm6vpHydP
 NVOuWO4zwBHhzUKQvWH5zMlSOpeZl1223kCsFHkfZJ53DF1y+2YJgga2HTYIHXG3gnhlKPGlWArF7
 MQoHL/bhgR5p5J5a83pBgA==;
Date: Tue, 01 Jul 2025 18:41:16 +0300
Message-Id: <861pqz3omb.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Thierry Volpiatto <thievol@HIDDEN>
In-Reply-To: <87h5zwrkx4.fsf@HIDDEN> (message from Thierry Volpiatto on
 Tue, 01 Jul 2025 15:27:19 +0000)
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN> <86bjq42f7w.fsf@HIDDEN>
 <87sejgro6i.fsf@HIDDEN> <867c0s2bwb.fsf@HIDDEN>
 <87h5zwrkx4.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: 78926 <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 (---)

> From: Thierry Volpiatto <thievol@HIDDEN>
> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
> Date: Tue, 01 Jul 2025 15:27:19 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Sorry, I don't understand why I need to patch Emacs in order to see
> > some behavior it has by default.
> 
> To better understand my poor explanations :-)
> 
> But emacs doesn't have this behavior by default.

Now I'm completely confused.  Let me step back and start over.

You started this discussion by describing some behavior of
find-file-read-only that you thought was a bug, correct?  If so, this
discussion should lead to investigating why Emacs behaves like it
does, and then to a decision whether and how to fix this behavior.

Do you agree?  Or did I misunderstand your report and your rationale
for starting this discussion?

If I understood you correctly, then I must see the problematic
behavior in order to reason about it, let alone try to find out its
reasons.  And I so far failed to see what you describe.  So I'm stuck
trying to reproduce the problematic behavior you described, and would
like to find a way of reproducing it before I could contribute
something useful to this discussion.

Sorry for being so dense.




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 15:27:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 11:27:35 2025
Received: from localhost ([127.0.0.1]:57781 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWctS-0000dO-QM
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:27:35 -0400
Received: from mout02.posteo.de ([185.67.36.66]:48035)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1uWctP-0000c7-Ky
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:27:32 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 16406240103
 for <78926 <at> debbugs.gnu.org>; Tue,  1 Jul 2025 17:27:23 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net;
 s=1984.ea087b; t=1751383644;
 bh=GxwN6kcjo70pkmx2Tfjq01Ty2b4IPY+iWZUzjwYr47c=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Autocrypt:OpenPGP:From;
 b=WIjd2OT5yZCGaRx7SMig51EcG8FtolrgSNZh1Ixv1OZoRHQgzwF5aUQjGCvFlny9F
 Hus/9G2AXtGaIdE5VoeNWNTDVNr5QzkydI7kGU08homhbaWHDpqHG/gmILvlnAv+P0
 3yzFfMNsemwJLTrv4NfkiSx1nTHkXL861w6yaR/qBLCkVTQDowm7/zVRYCis3MEKuR
 +eEMaqsjv9MK7x7/M2Cu1CX34Xozt9ttF44jzJrdZe01vvPYDrtstrZgTLZkWxhf/+
 djaqnSqUDVjqH3s7ajOpTco2id0yFu7Kksj7Muq7a2PHCDCSkEGHVugSe1QdSpC9Z1
 xQ9sfJ+xmwb5yko9iMwFtFH13kgrIjTa0oZll5UYmNbOEsFLdrmUZ2PUpUgvpR/LVi
 2EVoZzrDRp+vTAuJxODl6E+cB7GP5HoZP6KlxU0eWKxZwHPu9XMaK5NMBtm+O9G3vY
 RFHk1SNn8G1saLmIBsDhCXmJQGf3so/NKSDfWJ/yDwbss/3SMyX
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4bWn2f4SVHz6tvZ;
 Tue,  1 Jul 2025 17:27:22 +0200 (CEST)
From: Thierry Volpiatto <thievol@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
In-Reply-To: <867c0s2bwb.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 01 Jul
 2025 18:01:24 +0300")
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN> <86bjq42f7w.fsf@HIDDEN>
 <87sejgro6i.fsf@HIDDEN> <867c0s2bwb.fsf@HIDDEN>
Date: Tue, 01 Jul 2025 15:27:19 +0000
Message-ID: <87h5zwrkx4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Autocrypt: addr=thievol@HIDDEN; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA
 edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p
 kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb
 tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ
 GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC
 WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha
 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA
 Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
 FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h
 Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx
 hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFCd7NKv0nlHKQaAtdXm5bYnSHsnL7cx8z7lukA/
 EsJocE+GD7QXnsrdlicvdobI0TEN4l73221a72oCvHfYLCVsB6YsNJ5ZGkA1zSjzln5u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+PFQOJHPGMxc+fe4Ty2FdjIOVf3P1Hov9
 K6yBI7Af66qqcL3aKJ4jJidRYN8sMaKOqEu4rcSpTxp8/3Ddbs9HezUgXeUzOLJMcEYFlvCyC8ZS
 l/QDZmpobKbxZ1JAqZM8lnmcZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: Thierry Volpiatto <thievol@HIDDEN>, 78926 <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 Zaretskii <eliz@HIDDEN> writes:

>> From: Thierry Volpiatto <thievol@HIDDEN>
>> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
>> Date: Tue, 01 Jul 2025 14:16:53 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> >> >   emacs -Q
>> >> >   M-x set-variable RET confirm-nonexistent-file-or-buffer RET nil RET
>> >> >   M-x find-file-read-only RET foobar RET
>> >> 
>> >> > and Emacs signaled an error saying that the file does not exist.
>> >> 
>> >> I meant with the default value of confirm-nonexistent-file-or-buffer.
>> >
>> > I see the same with the default value as well.
>> >
>> >> It's surprizing that after pressing RET I have a minibuffer-message
>> >> saying [confirm] and then when I hit RET again I have the error you
>> >> mentioned.
>> >
>> > I don't see any [confirm] when invoking find-file-read-only.  When I
>> > press RET, I see an error message:
>> >
>> >   /some/file/name does not exist
>> >
>> > So I guess something is still missing, which is why I asked for
>> > detailed instructions.  I suspect we still do something differently.
>> 
>> The require-match used there is 'confirm-after-completion so perhaps you
>> have to try to complete on something before RET? 
>
> I didn't try to complete at all.  I just typed a name of a
> non-existent file and pressed RET.


>> With Helm such require-match is always transformed in 'confirm.
>
> So you are not doing this in "emacs -Q", but after activating Helm?

Did both.

>> Please try with the patch applied and without to see the difference and
>> perhaps what I mean.
>
> Sorry, I don't understand why I need to patch Emacs in order to see
> some behavior it has by default.

To better understand my poor explanations :-)

But emacs doesn't have this behavior by default.

-- 
Thierry




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 15:14:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 11:14:10 2025
Received: from localhost ([127.0.0.1]:57724 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWcgT-0006qF-47
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:14:10 -0400
Received: from mout01.posteo.de ([185.67.36.65]:56101)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1uWcgO-0006o9-Da
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:14:06 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 8C9C2240027
 for <78926 <at> debbugs.gnu.org>; Tue,  1 Jul 2025 17:13:56 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net;
 s=1984.ea087b; t=1751382836;
 bh=QB6/BE1o85nCxBGffbYDCWbnQYX/TOOhDg4c8AnzBdw=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Autocrypt:OpenPGP:From;
 b=Pn4l31POgyc0gkw/lFSqbSpeCh5KAgFOGtXn5J39+eYr2krEDGAOrrguoo8HrtACn
 3cxkdZQLHJM90c981je5Y/vRoZBGe30MMsH1XmNVSeQwC7Mvjy3SA0RpN10v8P3/is
 M9O6oRV/YNoJksDeslaLuCCGD0AAOSFXkuZ5xH/SxskpZfKKQO8BIcAOpBmqkN658C
 i4idrJQznqKk61A9B4Dk9LEY2iCac0sZLAd/2bYUd11j39srieOfSrdd46qbeuYERt
 wlS8v26UE21anN4xISJi8EjgWEEFLu08QOl6cd+RP3UMVnnbt1AgI7Y3TAtkoyV/SY
 fyTd03bdYEEvB0i2880f/oiS0YeOWQdy0Pk7Mp/8gcAZcID51KYKwKxlDad8+U1PkM
 l3MUPN2fO43voIFOR+kFDtD25rotZXV59ubQDKpGvMAoCJH+yVKBr6mmzvVmF9pU1A
 fIDvY7tAQFPzgvPqZRR/oz4LG36Dz4CLoBB1K+dSrevohvqh1yV
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4bWml44Fdfz9rxK;
 Tue,  1 Jul 2025 17:13:52 +0200 (CEST)
From: Thierry Volpiatto <thievol@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
In-Reply-To: <86o6u42mj2.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 01 Jul
 2025 14:11:45 +0300")
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
Date: Tue, 01 Jul 2025 15:13:48 +0000
Message-ID: <87ldp8rljn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Autocrypt: addr=thievol@HIDDEN; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA
 edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p
 kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb
 tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ
 GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC
 WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha
 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA
 Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
 FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h
 Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjR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To6QMAIcvUSiFwCIggxkmYy3ZY0QAMLmIPga8DNPM
 XbfSOBDb2KLGBd+FAA8p2GExpul4r6kOYnGogtojByHmVgrd30/3ZURTM8Vj51wwD05viMZccQHl
 Wd9J/qZIvhBJlJWYnwVxh+2Kg4/hkx7SGc7JJS5GS37+PFQOJHPGMxc+fe4Ty2FdjIOVf3P1Hov9
 K6yBI7Af66qqcL3aKJ4jJidRYN8sMaKOqEu4rcSpTxp8/3Ddbs9HezUgXeUzOLJMcEYFlvCyC8ZS
 l/QDZmpobKbxZ1JAqZM8lnmcZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: Thierry Volpiatto <thievol@HIDDEN>, 78926 <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 (---)

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


I modified `completion--complete-and-exit` so that the REQUIRE-MATCH
argument used with a function as value allows this function to exit with
'confirm in addition of nil/non-nil.

I then modified find-file-read-only so that it takes advantage of this:
- If you enter a wilcard you are now asked for confirm.
- If you enter a non existing filename you can't exit ([nomatch].

Note:
Of course the current behavior of find-file-read-only is fine, maybe a
little confusing but it's ok, this patch is just a proof of concept for
REQUIRE-MATCH used as a function with this new behavior.

The patches need to be reworked, didn't fully test the non interactive
usage and nothing is documented, particularly REQUIRE-MATCH in
completing-read, need also you commentaries because I guess not all the
corner cases are completed.

Thanks.

-- 
Thierry

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Allow-require-match-as-a-function-to-return-confirm.patch

From efcf6cd7280910b8aaa486af75bec293cd234d21 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@HIDDEN>
Date: Tue, 1 Jul 2025 16:48:56 +0200
Subject: [PATCH 1/2] Allow require-match as a function to return 'confirm

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

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 122459be062..6861c099bb7 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2007,12 +2007,17 @@ appear to be a match."
    ((= beg end) (funcall exit-function))
    ;; The CONFIRM argument is a predicate.
    ((functionp minibuffer-completion-confirm)
-    (if (funcall minibuffer-completion-confirm
-                 (buffer-substring beg end))
-        (funcall exit-function)
-      (unless completion-fail-discreetly
-	(ding)
-	(completion--message "No match"))))
+    (pcase (funcall minibuffer-completion-confirm
+                    (buffer-substring beg end))
+      ('confirm
+       (setq minibuffer-completion-confirm 'confirm)
+       (completion--complete-and-exit
+        beg end exit-function completion-function))
+      ((pred (eq nil))
+       (unless completion-fail-discreetly
+	 (ding)
+	 (completion--message "No match")))
+      (_ (funcall exit-function))))
    ;; See if we have a completion from the table.
    ((test-completion (buffer-substring beg end)
                      minibuffer-completion-table
-- 
2.34.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Make-find-file-read-only-ask-for-confirmation-or.patch

From dad76851b4124b0b7aec2e8576e4527bf06acc65 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@HIDDEN>
Date: Tue, 1 Jul 2025 16:51:31 +0200
Subject: [PATCH 2/2] Make find-file-read-only ask for confirmation or

prevent exiting when file doesn't exists.
---
 lisp/files.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 04a212b9bca..8aa426ad073 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2072,23 +2072,29 @@ file names with wildcards."
      (current-buffer)))
 
 (defun find-file--read-only (fun filename wildcards)
-  (unless (or (and wildcards find-file-wildcards
-		   (not (file-name-quoted-p filename))
-		   (string-match "[[*?]" filename))
-	      (file-exists-p filename))
-    (error "%s does not exist" filename))
+  ;; On interactive calls WILDCARDS is always non nil.
+  (let ((find-file-wildcards (and wildcards find-file-wildcards)))
+    (unless (find-file--read-only-require-match filename)
+      (error "%s does not exist" filename)))
   (let ((value (funcall fun filename wildcards)))
     (mapc (lambda (b) (with-current-buffer b (read-only-mode 1)))
 	  (if (listp value) value (list value)))
     value))
 
+(defun find-file--read-only-require-match (input)
+  (cond  ((and find-file-wildcards
+               (not (file-name-quoted-p input))
+	       (string-match "[[*?]" input))
+          'confirm)
+         (t (file-exists-p input))))
+
 (defun find-file-read-only (filename &optional wildcards)
   "Edit file FILENAME but don't allow changes.
 Like \\[find-file], but marks buffer as read-only.
 Use \\[read-only-mode] to permit editing."
   (interactive
    (find-file-read-args "Find file read-only: "
-                        (confirm-nonexistent-file-or-buffer)))
+                        #'find-file--read-only-require-match))
   (find-file--read-only #'find-file filename wildcards))
 
 (defun find-file-read-only-other-window (filename &optional wildcards)
-- 
2.34.1


--=-=-=--




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 15:01:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 11:01:37 2025
Received: from localhost ([127.0.0.1]:57663 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWcUK-0004m5-JW
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:01:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51402)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uWcUG-0004kV-MT
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 11:01:33 -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 1uWcUB-00014z-4g; Tue, 01 Jul 2025 11:01:27 -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=oQI2mnrOHd4lXaarmpkA2nKcLvbvvHnbgBry/NoO9f8=; b=W1jeP2GaH1/i
 ryh8bL1Ebf6ZW++Y1ovv8/XLYQbGR0qpNioaIeZVGygp+kmkCJZh0YY32lX6PdZPvYwKqaTvQxa+f
 Euh16Ol6i+t9jObMIqY9OwDLXTEjfMx3wDPE9NIVZ18hR8V89U18Q9b/0RDi0SrmdPB7T2mmlXBiW
 GFe224FpadwNaazAgWVsCXBMYglVw36EpLuWI+iPEegjao2X8J8dLN5kkkNWaOyop9uhu7j+4GGNa
 LfmAapMFJabTZxEr4VeuQvTXyoAzQUeB/sMvgHFSfFkw7lti5ElPnX0dp+sMaE6UZ/JV5u9+16rAa
 Lvyv2Ra0mEp9+ZoowB2/xQ==;
Date: Tue, 01 Jul 2025 18:01:24 +0300
Message-Id: <867c0s2bwb.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Thierry Volpiatto <thievol@HIDDEN>
In-Reply-To: <87sejgro6i.fsf@HIDDEN> (message from Thierry Volpiatto on
 Tue, 01 Jul 2025 14:16:53 +0000)
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN> <86bjq42f7w.fsf@HIDDEN>
 <87sejgro6i.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: 78926 <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 (---)

> From: Thierry Volpiatto <thievol@HIDDEN>
> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
> Date: Tue, 01 Jul 2025 14:16:53 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> >   emacs -Q
> >> >   M-x set-variable RET confirm-nonexistent-file-or-buffer RET nil RET
> >> >   M-x find-file-read-only RET foobar RET
> >> 
> >> > and Emacs signaled an error saying that the file does not exist.
> >> 
> >> I meant with the default value of confirm-nonexistent-file-or-buffer.
> >
> > I see the same with the default value as well.
> >
> >> It's surprizing that after pressing RET I have a minibuffer-message
> >> saying [confirm] and then when I hit RET again I have the error you
> >> mentioned.
> >
> > I don't see any [confirm] when invoking find-file-read-only.  When I
> > press RET, I see an error message:
> >
> >   /some/file/name does not exist
> >
> > So I guess something is still missing, which is why I asked for
> > detailed instructions.  I suspect we still do something differently.
> 
> The require-match used there is 'confirm-after-completion so perhaps you
> have to try to complete on something before RET? 

I didn't try to complete at all.  I just typed a name of a
non-existent file and pressed RET.

> With Helm such require-match is always transformed in 'confirm.

So you are not doing this in "emacs -Q", but after activating Helm?

> Please try with the patch applied and without to see the difference and
> perhaps what I mean.

Sorry, I don't understand why I need to patch Emacs in order to see
some behavior it has by default.




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 14:17:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 10:17:12 2025
Received: from localhost ([127.0.0.1]:57467 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWbnL-0006Hn-Vz
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 10:17:12 -0400
Received: from mout01.posteo.de ([185.67.36.65]:51307)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1uWbnH-0006Fg-U8
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 10:17:08 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 60A4B240027
 for <78926 <at> debbugs.gnu.org>; Tue,  1 Jul 2025 16:16:58 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net;
 s=1984.ea087b; t=1751379418;
 bh=DNHlWhUHwPuFHwscRn8Kmq8qiIRd+5LCIIYLNSYfrB4=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Autocrypt:OpenPGP:From;
 b=TKXUMcNWj5aMJ0zgPuXrM2TfzAXobA7M6AfC08MqJSsrVuFyKLCTjsckalxFKC0WL
 goYENLRmcj50R5XfkLS0/Zr8sdpBlcKbt69Vdb39SV6YSjiBgUIiUq5SPGNtZUTUYL
 An32cpzJDYYdqeggb2qrZhdmm48HbYZo46fEquI0YkFG6pqHXr9EiL6z6O4I8J+h04
 gyLAB+nqh6yUTimcXyM8MTckAFSGpW9PQiWINtlMdskKkdvjHRD7eBMKYRohQ17Nka
 H3g+aggt4D2AoNbeeflTkumS8KMRXVCWGA15IaTIrsZw6K2kbaBEpqRVV0NC2s7yfn
 TzGt4BoZwwu4HOSwK1VezV0BgNGfCeI6vlLbPuy7OJPEdwQTlvwYakDvbvstXT51nq
 ZHT4x091tplR2iQiG3Hla19/3FA5m6dB5s370xR1SCk1HDc4+SmtSk16mI5BbrfTg2
 7hcT437ugzxATUKcX07lSo1ZMeb7OwA2AxwBS217RMQjk+qjHdo
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4bWlTP1HLzz6tsb;
 Tue,  1 Jul 2025 16:16:57 +0200 (CEST)
From: Thierry Volpiatto <thievol@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
In-Reply-To: <86bjq42f7w.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 01 Jul
 2025 16:49:39 +0300")
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN> <86bjq42f7w.fsf@HIDDEN>
Date: Tue, 01 Jul 2025 14:16:53 +0000
Message-ID: <87sejgro6i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Autocrypt: addr=thievol@HIDDEN; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA
 edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p
 kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb
 tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ
 GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC
 WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha
 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA
 Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
 FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h
 Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx
 hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFC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d+FAA8p2GExpul4r6kOYnGogtojByHmVgrd30/3ZURTM8Vj51wwD05viMZccQHl
 Wd9J/qZIvhBJlJWYnwVxh+2Kg4/hkx7SGc7JJS5GS37+PFQOJHPGMxc+fe4Ty2FdjIOVf3P1Hov9
 K6yBI7Af66qqcL3aKJ4jJidRYN8sMaKOqEu4rcSpTxp8/3Ddbs9HezUgXeUzOLJMcEYFlvCyC8ZS
 l/QDZmpobKbxZ1JAqZM8lnmcZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: Thierry Volpiatto <thievol@HIDDEN>, 78926 <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 Zaretskii <eliz@HIDDEN> writes:

>> From: Thierry Volpiatto <thievol@HIDDEN>
>> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
>> Date: Tue, 01 Jul 2025 12:38:12 +0000
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> >> From: Thierry Volpiatto <thievol@HIDDEN>
>> >> Date: Mon, 30 Jun 2025 10:36:29 +0000
>> >> 
>> >> find-file-read-only is allowing confirmation to exit with a non existing
>> >> file with `confirm-nonexistent-file-or-buffer`, but when the
>> >> filename is selected it calls `find-file--read-only` which itself prevent
>> >> exiting with a non existing file.
>> >> 
>> >> Did I miss something or is it a bug?
>> >
>> > Sorry, could you please elaborate?  What exactly did you do and what
>> > did you see?
>> >
>> > I tried:
>> >
>> >   emacs -Q
>> >   M-x set-variable RET confirm-nonexistent-file-or-buffer RET nil RET
>> >   M-x find-file-read-only RET foobar RET
>> 
>> > and Emacs signaled an error saying that the file does not exist.
>> 
>> I meant with the default value of confirm-nonexistent-file-or-buffer.
>
> I see the same with the default value as well.
>
>> It's surprizing that after pressing RET I have a minibuffer-message
>> saying [confirm] and then when I hit RET again I have the error you
>> mentioned.
>
> I don't see any [confirm] when invoking find-file-read-only.  When I
> press RET, I see an error message:
>
>   /some/file/name does not exist
>
> So I guess something is still missing, which is why I asked for
> detailed instructions.  I suspect we still do something differently.

The require-match used there is 'confirm-after-completion so perhaps you
have to try to complete on something before RET? 

With Helm such require-match is always transformed in 'confirm.

Note that the behavior of 'confirm-after-completion is difficult to
understand because you have to try to complete on something that doesn't
exist to after exit with it, confusing.

Please try with the patch applied and without to see the difference and
perhaps what I mean.

Thanks.

-- 
Thierry




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 13:49:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 09:49:53 2025
Received: from localhost ([127.0.0.1]:55768 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWbMt-0001jA-K9
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 09:49:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49956)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uWbMp-0001hf-O0
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 09:49:49 -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 1uWbMk-0000ZM-3v; Tue, 01 Jul 2025 09:49:42 -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=CulxSCHkRVu8KgEGzt9QgNwqIJrJG5JoDDoDSkOkpFg=; b=bax2bOLSNkDn
 azRVjFQYNC3+QyRwpKuvXWt1mNrsE+WkefFblPt/+R5FrNQbxXQ+HP9PSAi3PgmYFzUtZ/5lSt6nL
 vYfpKPOQM67Xts1pn5jJG1Mkiy0U/VMUkxATca3wJOh/6v7czXALGE/9+CORRpJJBenteuDuYu8Qe
 UYDEsUSlHlFErBoQWw/qvdgheJtgG68mULWhh+WCfnPAeb/da9BFO6iE27D308BQtMZZh8goRauBU
 SU3tt17UgitlBjRsc18E3gCy9E1cLM7XeMt1ZPcPjUl0vkiAPFCe8bkOiwMZdoYtu5h5dL/EVAnbo
 TZkdWTYlbzWk64JzwTxejQ==;
Date: Tue, 01 Jul 2025 16:49:39 +0300
Message-Id: <86bjq42f7w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Thierry Volpiatto <thievol@HIDDEN>
In-Reply-To: <87wm8srsqz.fsf@HIDDEN> (message from Thierry Volpiatto on
 Tue, 01 Jul 2025 12:38:12 +0000)
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
 <87wm8srsqz.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: 78926 <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 (---)

> From: Thierry Volpiatto <thievol@HIDDEN>
> Cc: Thierry Volpiatto <thievol@HIDDEN>,  78926 <at> debbugs.gnu.org
> Date: Tue, 01 Jul 2025 12:38:12 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Thierry Volpiatto <thievol@HIDDEN>
> >> Date: Mon, 30 Jun 2025 10:36:29 +0000
> >> 
> >> find-file-read-only is allowing confirmation to exit with a non existing
> >> file with `confirm-nonexistent-file-or-buffer`, but when the
> >> filename is selected it calls `find-file--read-only` which itself prevent
> >> exiting with a non existing file.
> >> 
> >> Did I miss something or is it a bug?
> >
> > Sorry, could you please elaborate?  What exactly did you do and what
> > did you see?
> >
> > I tried:
> >
> >   emacs -Q
> >   M-x set-variable RET confirm-nonexistent-file-or-buffer RET nil RET
> >   M-x find-file-read-only RET foobar RET
> 
> > and Emacs signaled an error saying that the file does not exist.
> 
> I meant with the default value of confirm-nonexistent-file-or-buffer.

I see the same with the default value as well.

> It's surprizing that after pressing RET I have a minibuffer-message
> saying [confirm] and then when I hit RET again I have the error you
> mentioned.

I don't see any [confirm] when invoking find-file-read-only.  When I
press RET, I see an error message:

  /some/file/name does not exist

So I guess something is still missing, which is why I asked for
detailed instructions.  I suspect we still do something differently.




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 12:38:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 08:38:46 2025
Received: from localhost ([127.0.0.1]:55549 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWaG3-0007x5-Jy
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 08:38:45 -0400
Received: from mout02.posteo.de ([185.67.36.66]:42541)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1uWaFl-0007uy-0Y
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 08:38:37 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 5E4F3240103
 for <78926 <at> debbugs.gnu.org>; Tue,  1 Jul 2025 14:38:17 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net;
 s=1984.ea087b; t=1751373497;
 bh=JOKBdnyQFpbT9VfcFHU2txaO7D/CjTL6tmaHhRhalhs=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Autocrypt:OpenPGP:From;
 b=VycD2KvaCnVdkN7dlji+UoxO0E/WgmN5qNI8Rp4FODI6Q+qv7Fz3Aq57y8vPNpfHP
 k9e6/wYy/0f58hvv+AW8BmaEJk06Ro3+lVA8/CoEIetxk9HFy2wkDbLN9PhR0pIe61
 Nq6b9KRx0Y7PriEqOGFchNRU74gRa+w/IymQJrsD1UquOQgxvsrG8+IQ7gzN23UULH
 gQnMQWjVVYhEYlxFfsT39lhZCrg0aY+WOCxda/cI1WtwcRQ55vwMawrcoFW6dLUPw7
 XCEufYjMb5HddpUqg4LNxdwiqvddiSkElgI0wOfgr66qHdn/lqpwgjKpvDcKlsQntm
 2271pkYDrJCyfarniz9ErCbzcm0dP7UBQ8/i5WnHgeaV8fty3xDJARWUQUomY613e6
 /lNSMDnf5aoqnHquaNQwRajNa3Fei2RBf9GnJuv1QWeCdVz8oxeyDrFENhBYgaUajo
 Rpvtycx/EF9FrxXuNMWSuINsiM3wIek7Y0hlLQLNvmxV2Zv48dq
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4bWjHW66RNz6tx8;
 Tue,  1 Jul 2025 14:38:15 +0200 (CEST)
From: Thierry Volpiatto <thievol@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
In-Reply-To: <86o6u42mj2.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 01 Jul
 2025 14:11:45 +0300")
References: <87o6u58qj6.fsf@HIDDEN> <86o6u42mj2.fsf@HIDDEN>
Date: Tue, 01 Jul 2025 12:38:12 +0000
Message-ID: <87wm8srsqz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Autocrypt: addr=thievol@HIDDEN; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG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H5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 78926
Cc: Thierry Volpiatto <thievol@HIDDEN>, 78926 <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.1 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Thierry Volpiatto <thievol@HIDDEN>
>> Date: Mon, 30 Jun 2025 10:36:29 +0000
>> 
>> find-file-read-only is allowing confirmation to exit with a non existing
>> file with `confirm-nonexistent-file-or-buffer`, but when the
>> filename is selected it calls `find-file--read-only` which itself prevent
>> exiting with a non existing file.
>> 
>> Did I miss something or is it a bug?
>
> Sorry, could you please elaborate?  What exactly did you do and what
> did you see?
>
> I tried:
>
>   emacs -Q
>   M-x set-variable RET confirm-nonexistent-file-or-buffer RET nil RET
>   M-x find-file-read-only RET foobar RET

> and Emacs signaled an error saying that the file does not exist.

I meant with the default value of confirm-nonexistent-file-or-buffer.
It's surprizing that after pressing RET I have a minibuffer-message
saying [confirm] and then when I hit RET again I have the error you
mentioned.
It would be better to use a [no match] message preventing exiting
minibuffer in such case, however if you do this (i.e. require-match ==
t) you prevent exiting with a wildcard. I tried this patch that work as
I expect (which is maybe not what you or others expect):

    index 04a212b9bca..8cb93c90351 100644
    --- a/lisp/files.el
    +++ b/lisp/files.el
    @@ -2072,23 +2072,28 @@ file names with wildcards."
          (current-buffer)))
     
     (defun find-file--read-only (fun filename wildcards)
    -  (unless (or (and wildcards find-file-wildcards
    -		   (not (file-name-quoted-p filename))
    -		   (string-match "[[*?]" filename))
    -	      (file-exists-p filename))
    -    (error "%s does not exist" filename))
    +  ;; On interactive calls WILDCARDS is always non nil. 
    +  (let ((find-file-wildcards (and wildcards find-file-wildcards)))
    +    (unless (find-file--read-only-require-match filename)
    +      (error "%s does not exist" filename)))
       (let ((value (funcall fun filename wildcards)))
         (mapc (lambda (b) (with-current-buffer b (read-only-mode 1)))
     	  (if (listp value) value (list value)))
         value))
     
    +(defun find-file--read-only-require-match (input)
    +  (or (and find-file-wildcards
    +           (not (file-name-quoted-p input))
    +	   (string-match "[[*?]" input))
    +      (file-exists-p input)))
    +
     (defun find-file-read-only (filename &optional wildcards)
       "Edit file FILENAME but don't allow changes.
     Like \\[find-file], but marks buffer as read-only.
     Use \\[read-only-mode] to permit editing."
       (interactive
        (find-file-read-args "Find file read-only: "
    -                        (confirm-nonexistent-file-or-buffer)))
    +                        #'find-file--read-only-require-match))
       (find-file--read-only #'find-file filename wildcards))
     
     (defun find-file-read-only-other-window (filename &optional wildcards)

The problem is that this patch doesn't ask anymore for confirmation when
input is a wildcard, perhaps a new feature would be to enhance the
behavior of require-match used as a function.  Currently the function
can either return nil or t, it could return in addition 'confirm and
in this case send a minibuffer message [confirm], on next RET hit it
would exit.

-- 
Thierry




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

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


Received: (at 78926) by debbugs.gnu.org; 1 Jul 2025 11:12:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 07:12:04 2025
Received: from localhost ([127.0.0.1]:55312 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWYu9-0000AN-MB
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 07:12:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49488)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uWYu2-00008E-Az
 for 78926 <at> debbugs.gnu.org; Tue, 01 Jul 2025 07:11:58 -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 1uWYtv-0000g3-Im; Tue, 01 Jul 2025 07:11:47 -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=5EnnvednLSZxolxoKcz02KqwKhk+RXxQMBQHKYKZn4E=; b=QcsLo/0x2iA+
 OXbiI0lfCvnSAwLk/X27UjwVyP7+Y5ugKrXdQUtL+VeELOu8Ap0i4+OaAupDLe9eZXdAjiJ0uhoPz
 yj+EhwATdZ5NraLo/+zizcIv/XL42W4alpdiyc5amLKp0sc4IhYMmxpPVPmsJHgXydpLw00UstVbk
 Roiqw3kDExISLf6BcyED7N2u9wi86JVmGB14Ff67mZ/Tkv3t7qJ0Je/KR88m5P2qFyy/WcJH5Ucm2
 PDLuN1o2ixM+r3xDPk+8kOCnsSS+O07nf2fctU6HG9A/IFjPiSWVK9H3XboU8O7PFBlQuIFngBwnc
 CEE6LboMhzwIQx+qttyfUQ==;
Date: Tue, 01 Jul 2025 14:11:45 +0300
Message-Id: <86o6u42mj2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Thierry Volpiatto <thievol@HIDDEN>
In-Reply-To: <87o6u58qj6.fsf@HIDDEN> (message from Thierry Volpiatto on
 Mon, 30 Jun 2025 10:36:29 +0000)
Subject: Re: bug#78926: 30.1; find-file-read-only require-match inconsistency
References: <87o6u58qj6.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78926
Cc: 78926 <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 (---)

> From: Thierry Volpiatto <thievol@HIDDEN>
> Date: Mon, 30 Jun 2025 10:36:29 +0000
> 
> find-file-read-only is allowing confirmation to exit with a non existing
> file with `confirm-nonexistent-file-or-buffer`, but when the
> filename is selected it calls `find-file--read-only` which itself prevent
> exiting with a non existing file.
> 
> Did I miss something or is it a bug?

Sorry, could you please elaborate?  What exactly did you do and what
did you see?

I tried:

  emacs -Q
  M-x set-variable RET confirm-nonexistent-file-or-buffer RET nil RET
  M-x find-file-read-only RET foobar RET

and Emacs signaled an error saying that the file does not exist.
Sounds like Emacs does behave reasonably.




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

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


Received: (at submit) by debbugs.gnu.org; 30 Jun 2025 10:37:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 30 06:37:08 2025
Received: from localhost ([127.0.0.1]:40698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWBsq-0006gD-2U
	for submit <at> debbugs.gnu.org; Mon, 30 Jun 2025 06:37:08 -0400
Received: from lists.gnu.org ([2001:470:142::17]:51512)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1uWBsl-0006es-Se
 for submit <at> debbugs.gnu.org; Mon, 30 Jun 2025 06:37:04 -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 <thievol@HIDDEN>)
 id 1uWBsf-0007ml-Mv
 for bug-gnu-emacs@HIDDEN; Mon, 30 Jun 2025 06:36:58 -0400
Received: from mout01.posteo.de ([185.67.36.65])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <thievol@HIDDEN>)
 id 1uWBsW-00044T-FP
 for bug-gnu-emacs@HIDDEN; Mon, 30 Jun 2025 06:36:57 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 1B40E240042
 for <bug-gnu-emacs@HIDDEN>; Mon, 30 Jun 2025 12:36:34 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net;
 s=1984.ea087b; t=1751279794;
 bh=Xk3vLC1MvWUxrVyvWxkQXYzWHa7oa1rdilqMVTSMrGs=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Content-Transfer-Encoding:Autocrypt:OpenPGP:From;
 b=G7mhjUiBcbBIXXk9Wk0EnUi2/9f9WT/ZI1ImBxe+ApnAf01dsQyFrU6VrKV731UxU
 ffRKeyUc9jXfsp2yAKmga5MDK7mPu28m1gSiMRLOlbcqBoqFys7LNiDRzgFlsH2dTJ
 Q3+8aD7EeUghjrM9BtullWqZxh6awpQmlEs/UD8uuOrXhxY021awtPpp5/ebBROSSR
 zsWYcRYI8B2HmpePS64cYuwtCIywFEOdWNWbPYIZV1vLU1UP4hRoRVtQhts+bdtRaO
 xC5Rp0pW7WWR0TtC3IVu01O9QISg2/E8ezQbOYAXLB6SY1r0o1gEHs9pRMTjRhQ0Nc
 pVU6UobWOGBjXGmLn/eLhsIeXgDglajdg5SGtziTLwX0PXHP1z2vpMxy2hevLs11LR
 ZjPXox64FV5cxZ/+b0Z2jJ3TkuDU75WLBl/C/eEtDb9T23U8pOSn9L6a68rPMQ8ca4
 rUsEdm6LRYdbV9vefdH+agLE3WExDKcJEjlGUeBlKnxAuey0dqM
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4bW2dY1d7qz9rxT;
 Mon, 30 Jun 2025 12:36:33 +0200 (CEST)
From: Thierry Volpiatto <thievol@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.1; find-file-read-only require-match inconsistency
X-Debbugs-Cc: 
Date: Mon, 30 Jun 2025 10:36:29 +0000
Message-ID: <87o6u58qj6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Autocrypt: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C8ZS
 l/QDZmpobKbxZ1JAqZM8lnmcZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
Received-SPF: pass client-ip=185.67.36.65; envelope-from=thievol@HIDDEN;
 helo=mout01.posteo.de
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: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


Hello,

find-file-read-only is allowing confirmation to exit with a non existing
file with `confirm-nonexistent-file-or-buffer`, but when the
filename is selected it calls `find-file--read-only` which itself prevent
exiting with a non existing file.

Did I miss something or is it a bug?

Thanks.


In GNU Emacs 30.1 (build 6, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2025-05-29 built on IPad-S340
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Linux Mint 21.3

Configured using:
 'configure CFLAGS=3D-O8 --bindir=3D/usr/local/sbin/emacs-30.1 --with-cairo
 --with-x-toolkit=3Dlucid --with-modules --without-tree-sitter
 --without-native-compilation --disable-gc-mark-trace'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB

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

Major mode: =EE=A4=A6

Minor modes in effect:
  bug-reference-prog-mode: t
  server-mode: t
  psession-mode: t
  psession-savehist-mode: t
  global-git-gutter-mode: t
  git-gutter-mode: t
  display-time-mode: t
  winner-mode: t
  tv-save-place-mode: t
  helm-epa-mode: t
  helm-descbinds-mode: t
  helm-top-poll-mode: t
  helm-adaptive-mode: t
  helm-mode: t
  helm-minibuffer-history-mode: t
  helm-ff-icon-mode: t
  helm-popup-tip-mode: t
  dired-async-mode: t
  minibuffer-depth-indicate-mode: t
  gcmh-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort epa-mail mail-extr gnus-msg emacsbug tramp-sh shortdoc
comp-common char-fold tramp-archive tramp-gvfs tramp-cache time-stamp
zeroconf helm-command helm-elisp helm-eval edebug debug backtrace
helm-info helm-ls-git vc-git vc vc-dispatcher cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs make-mode
markdown-mode color oc-basic cl-extra org-element org-persist org-id
org-refile org-element-ast inline avl-tree generator ol-eww eww
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
gnus-spec gnus-int gnus-range gnus-win gnus nnheader range ol-docview
doc-view ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi org-config
ob-gnuplot org-crypt org-protocol org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs org-compat org-macs flycheck
find-func sh-script smie treesit executable jka-compr bug-reference
thingatpt cus-start naquadah-tv-theme view mule-util solar cal-dst
holidays holiday-loaddefs appt diary-lib diary-loaddefs cal-menu
calendar cal-loaddefs server imenu tv-utils psession frameset
mail-config gnus-patch diff-mode track-changes addressbook-bookmark
message sendmail yank-media puny rfc822 mml mml-sec gnus-util mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
bookmark git-gutter pcase avoid dired-extension time winner
describe-variable help-fns radix-tree tv-save-place.el init-helm epa
derived epg rfc6068 epg-config helm-epa helm-descbinds cus-edit pp
cus-load wid-edit helm-sys helm-adaptive helm-mode helm-misc helm-files
image-dired image-dired-tags image-dired-external image-dired-util
image-mode exif filenotify tramp rx trampver tramp-integration files-x
tramp-message help-mode tramp-compat xdg shell pcomplete parse-time
iso8601 time-date tramp-loaddefs helm-buffers helm-x-icons all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons helm-occur helm-tags
helm-locate helm-grep wgrep-helm wgrep grep compile text-property-search
comint ansi-osc ring helm-regexp format-spec ansi-color helm-utils
helm-help helm-types helm-extensions-autoloads helm-autoloads helm
helm-global-bindings helm-easymenu edmacro kmacro helm-core helm-source
helm-multi-match helm-lib dired-async async dired-aux dired
dired-loaddefs isl-autoloads mb-depth gcmh easy-mmode
all-the-icons-autoloads bash-completion-autoloads emms-autoloads
flycheck-autoloads info ledger-mode-autoloads markdown-mode-autoloads
nerd-icons-autoloads w3m-load w3m-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process emacs)

Memory information:
((conses 16 689730 616604) (symbols 48 37339 2)
 (strings 32 197873 47275) (string-bytes 1 5419858) (vectors 16 73920)
 (vector-slots 8 1155980 212667) (floats 8 3119 1134)
 (intervals 56 14099 2420) (buffers 984 127))

--=20
Thierry




Acknowledgement sent to Thierry Volpiatto <thievol@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#78926; 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: Wed, 2 Jul 2025 11:15:03 UTC

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