GNU bug report logs - #66187
read-file-name unexpected behavior when MUSTMATCH is a function

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: Joseph Turner <joseph@HIDDEN>; dated Sun, 24 Sep 2023 21:51:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 66187) by debbugs.gnu.org; 7 Oct 2023 15:13:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 07 11:13:15 2023
Received: from localhost ([127.0.0.1]:55665 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qp8zS-0006ix-Vc
	for submit <at> debbugs.gnu.org; Sat, 07 Oct 2023 11:13:15 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60929)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qp8zQ-0006ib-NX
 for 66187 <at> debbugs.gnu.org; Sat, 07 Oct 2023 11:13:13 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5FE1D80802;
 Sat,  7 Oct 2023 11:12:47 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1696691566;
 bh=w+kAq7aY8jmEck0isrF9ESOzEbe6rVX0vS7PXAVzqAA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=H8PmhaqluzbJt0RBgQjK4I3yetGuX9L30xysiRpactXa3fAQRG8UiK3ijrf+Bq2Ep
 6LbMIr1SnqFJ/GQtRib8gf7UuMfFHFRuv2gT4C7zpWnWX2+etJLkmPKNorfEqiIweb
 pbtRMr0Eo0XNtynumzTOfWRo8t3VunGES6Qf77QuSpYxi7ikNYicvyR3qH8HoV5lip
 g7bKf/tChvRLf0tiq6ShCIfDi8T4bHbSAae6SZu644QHOpIZh+ppqJE3G7uSu3D/BM
 E4nS679YeJL7Rjs5+oJE1beeanD/gv9a7mQsKsH/5ZTowPoauwjpHhX1HFWRRHkv2j
 MPyux+QL/URpQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2D0BE80595;
 Sat,  7 Oct 2023 11:12:46 -0400 (EDT)
Received: from pastel (unknown [45.72.225.62])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E78E01202B9;
 Sat,  7 Oct 2023 11:12:45 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <83sf6mzcz6.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 07 Oct
 2023 18:09:01 +0300")
Message-ID: <jwvzg0upive.fsf-monnier+emacs@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
 <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN> <83v8bj2794.fsf@HIDDEN>
 <jwva5sv4stk.fsf-monnier+emacs@HIDDEN> <83r0m70zwp.fsf@HIDDEN>
 <jwvh6n2qzn8.fsf-monnier+emacs@HIDDEN> <83sf6mzcz6.fsf@HIDDEN>
Date: Sat, 07 Oct 2023 11:12: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.013 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: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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 (---)

> Then I think we should install your patch on the emacs-29 branch,
> thanks.

Thanks for the vote of confidence, but as Joseph points out, the patch
isn't actually doing what it says on the tin, so we first have to fix
it :-)


        Stefan





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

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


Received: (at 66187) by debbugs.gnu.org; 7 Oct 2023 15:09:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 07 11:09:26 2023
Received: from localhost ([127.0.0.1]:55653 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qp8vl-0006be-UU
	for submit <at> debbugs.gnu.org; Sat, 07 Oct 2023 11:09:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:32774)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qp8vh-0006bL-BA
 for 66187 <at> debbugs.gnu.org; Sat, 07 Oct 2023 11:09: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 1qp8vG-0000KJ-LY; Sat, 07 Oct 2023 11: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=ZARSO9+xCmQpWw81RpFg1FuJ0N7L0j2MABdc6yIaXG0=; b=ZHW3XSZLtPeP
 5A/nNQhsY/+2M5URhcNxK+JxZ6oh89cSZKAJZvuaLphoK4NgeBOE/u/PWw9glOPA4s6nggE31vyc6
 a22c6T8XYCeAHW4gXUVaq1t4K8wvsXxRV9zDR+YF0Czrl6cpMSXlPRQWIxS3CNLAgek4NqxqLFo2s
 FDFwpzPHPgqKzPbKr+7XJZbK2N995POtnk0FIMigENcFKh4w0r3zxz5F6kvBiYtfkNiv+SCeIpMcr
 wUc1z53NkEz3azncGmI9+xKXHhfi5AFZYYQHs6Dt7bw9I3+C6a2l47J3RckZI7F8OY3ffODyg6OwI
 yqSJ72d3byMdh4r2PUrBdQ==;
Date: Sat, 07 Oct 2023 18:09:01 +0300
Message-Id: <83sf6mzcz6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwvh6n2qzn8.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Sat, 07 Oct 2023 10:25:13 -0400)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
 <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN> <83v8bj2794.fsf@HIDDEN>
 <jwva5sv4stk.fsf-monnier+emacs@HIDDEN> <83r0m70zwp.fsf@HIDDEN>
 <jwvh6n2qzn8.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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: joseph@HIDDEN,  michael_heerdegen@HIDDEN,
>   philipk@HIDDEN,  66187 <at> debbugs.gnu.org
> Date: Sat, 07 Oct 2023 10:25:13 -0400
> 
> > So you are saying that the current uses of MUSTMATCH simply don't do
> > what the change was supposed to allow?
> 
> I think so: the original use (don't know if there are others out there)
> wants the behavior that is being discussed rather than the behavior that
> is currently provided.

Then I think we should install your patch on the emacs-29 branch,
thanks.




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

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


Received: (at 66187) by debbugs.gnu.org; 7 Oct 2023 14:25:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 07 10:25:47 2023
Received: from localhost ([127.0.0.1]:55602 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qp8FX-0004vP-HX
	for submit <at> debbugs.gnu.org; Sat, 07 Oct 2023 10:25:47 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:2618)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qp8FV-0004vC-NA
 for 66187 <at> debbugs.gnu.org; Sat, 07 Oct 2023 10:25:46 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1D7F2804AD;
 Sat,  7 Oct 2023 10:25:20 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1696688714;
 bh=uURw+jv51ZccaD3NDxMmU4YJSBfA018Awx6qln1HMWs=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=lMukw9V0ag/nQCK+acZHa2COl4Mviyo9Q5Z3K54/QBZLd8uKG2wgZm0oMd/k8sE6E
 Lhv+RByBOzleNLBUkXxMYHQAgp5vFKCKAVTLKbZwvX4a6u9MSyafz1i9s9LIzxgOO8
 rwjCL6ohtAkhuqFxbZwJ5yLnuvM+jB22l8a6RotFHclljeeEQxKELCS1qyvQ2cR/tn
 92q9rBbaaSgNHHGuAeS/mlueJDNrSkvlCsMJIoYObBCmUGdxSVp4reCmJ11/y4btor
 W4P7vTfeJOGZs5kH00M4C71R11Ev7YdqhfwXT0KvNm3KbVud+Hv5kEr9hVrwSrR5ZQ
 ZMNNoiB+BTloA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AFBD080595;
 Sat,  7 Oct 2023 10:25:14 -0400 (EDT)
Received: from pastel (unknown [45.72.225.62])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 660E3120324;
 Sat,  7 Oct 2023 10:25:14 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <83r0m70zwp.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 07 Oct
 2023 08:23:02 +0300")
Message-ID: <jwvh6n2qzn8.fsf-monnier+emacs@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
 <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN> <83v8bj2794.fsf@HIDDEN>
 <jwva5sv4stk.fsf-monnier+emacs@HIDDEN> <83r0m70zwp.fsf@HIDDEN>
Date: Sat, 07 Oct 2023 10:25:13 -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.013 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: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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 (---)

> So you are saying that the current uses of MUSTMATCH simply don't do
> what the change was supposed to allow?

I think so: the original use (don't know if there are others out there)
wants the behavior that is being discussed rather than the behavior that
is currently provided.


        Stefan





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

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


Received: (at 66187) by debbugs.gnu.org; 7 Oct 2023 05:23:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 07 01:23:21 2023
Received: from localhost ([127.0.0.1]:53162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qozma-00083J-TY
	for submit <at> debbugs.gnu.org; Sat, 07 Oct 2023 01:23:21 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59806)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qozmY-000833-AM
 for 66187 <at> debbugs.gnu.org; Sat, 07 Oct 2023 01:23:19 -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 1qozm6-0003RE-NJ; Sat, 07 Oct 2023 01:22:50 -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=HYljA8BOBioLni0+rm3oFJ3NHhB+H8Wx259Mu7DEsbY=; b=T4aLmsfuUUF6
 MrgyxUpfkZAxz1hIZJoWkwy88p6pJ86wMiZYWg3clJ258gDnr8U+loEAAXhayx8WdgglPrhvE6mKK
 PFOPazTbhPrIMdbBwlQRg8SjbgK9FWbZ75Tbqm1OW9u0Ip11mL+5qGRCbOIyqbK8/XmyR8nwN86K8
 q8IYNT6p1S6yLpUT8OOD6BmGxTfd4juqVA0zu0TmVocB6K2+7gH+i8qYW9mXHjQxvuoZm92jA/+XH
 XVMtb+4MvbeJ/m6DGw3sYsI7ObeG/li/ljuK7wYQ25hBEXYgphBBTMOIvKcBlL+7txcWC+JOj6G/Q
 zl5N5S7yRD76MsYhTW81Rw==;
Date: Sat, 07 Oct 2023 08:23:02 +0300
Message-Id: <83r0m70zwp.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwva5sv4stk.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Fri, 06 Oct 2023 12:43:51 -0400)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
 <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN> <83v8bj2794.fsf@HIDDEN>
 <jwva5sv4stk.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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: joseph@HIDDEN,  michael_heerdegen@HIDDEN,
>   philipk@HIDDEN,  66187 <at> debbugs.gnu.org
> Date: Fri, 06 Oct 2023 12:43:51 -0400
> 
> >> Code which wants the 29.1 behavior can easily get it by modifying their
> >> `require-match` function accordingly (and such code then works
> >> correctly both with Emacs-29.1 and with the new behavior).
> > Do we have any users of this feature in the tree?
> 
> We do, and it turns out to be a good argument in favor of the change.
> 
> The use of a function for `completing-read`s REQUIRE-MATCH and
> `read-file-name`s MUSTMATCH was added in
> 
>     commit 49e06183f5972817d93dad6acf5351c204e61cc5
>     Author: Lars Ingebrigtsen <larsi@HIDDEN>
>     Date:   Fri Jun 10 10:16:57 2022 +0200
>     
>         Allow REQUIRE-MATCH to be a function
>         
>         * doc/lispref/minibuf.texi (Minibuffer Completion): Document it.
>         
>         * lisp/minibuffer.el (completion--complete-and-exit): Allow
>         REQUIRE-MATCH to be a function.
>         (read-file-name): Mention it.
>         
>         * src/minibuf.c (Fcompleting_read): Mention it.
> 
> and the surrounding commits point to its motivation in:
> 
>     commit 7ee736a884766f2017a934d936bfbfa4c70b5099
>     Author: Lars Ingebrigtsen <larsi@HIDDEN>
>     Date:   Fri Jun 10 10:19:15 2022 +0200
>     
>         Allow specifying a wildcard argument to list-directory again
>         
>         * lisp/files.el (list-directory): Allow specifying a wildcard
>         argument interactively again (bug#55877).
> 
> But the code in that patch uses MUSTMATCH to *restrict* the possible inputs,
> whereas Joseph's point is that the code currently does not allow using
> MUSTMATCH to restrict the possible inputs.
> 
> And indeed we can currently do `M-x list-directory RET /etc/passwd RET`
> and Emacs happily runs `list-directory` on that non-directory, contrary
> to the intention of the code (IIUC):
> 
>      [...]
>      (list (read-file-name
>             (if pfx "List directory (verbose): "
> 	      "List directory (brief): ")
> 	    nil default-directory
>             (lambda (file)
>               (or (file-directory-p file)
>                   (insert-directory-wildcard-in-dir-p
>                    (file-name-as-directory (expand-file-name file))))))
>      [...]
> 

So you are saying that the current uses of MUSTMATCH simply don't do
what the change was supposed to allow?




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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 16:44:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 12:44:27 2023
Received: from localhost ([127.0.0.1]:52530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qonw6-0007RA-ON
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 12:44:27 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6351)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qonw2-0007Qo-4o
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 12:44:22 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 80EED1000AD;
 Fri,  6 Oct 2023 12:43:53 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1696610632;
 bh=X6s5ZIPIPhxdto+GTd+1wcNiFP2yzmnKzmEkoz5+MFc=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=MjbqpnYNQrjgx2cbJ+T1KP35C3kK8xkntOAlTsp1pTvwfmw96M7lQoF6BUcxuvGzQ
 tOwrTELxap0bFfqAA4LLlVhPn7Kf8iSVFAel7cmhChHQTQ5HtUAY+FVR9JSbVNGwsN
 OeHUZnNb+FbEUWKELP2dkFob/J19cRhxS1NBmQhbzCXad6ebySkr+IaCdGV0Q8kfqi
 agF77tN/m2VTebzA3Goh/NEtY85DprAp1wvRG09KgjONiWNJdugelVQILw/jRUCOCw
 PpNJXIN/J88fFbxi8akbK5xWAMVmn7CLoMW5uND+ZrxaHnblXtjOal+VrDAx35MpSy
 eAq9sAxlMPdlQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4CA0A100033;
 Fri,  6 Oct 2023 12:43:52 -0400 (EDT)
Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 12DCB120037;
 Fri,  6 Oct 2023 12:43:52 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <83v8bj2794.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 06 Oct
 2023 16:46:47 +0300")
Message-ID: <jwva5sv4stk.fsf-monnier+emacs@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
 <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN> <83v8bj2794.fsf@HIDDEN>
Date: Fri, 06 Oct 2023 12:43:51 -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.181 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: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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 (---)

>> Code which wants the 29.1 behavior can easily get it by modifying their
>> `require-match` function accordingly (and such code then works
>> correctly both with Emacs-29.1 and with the new behavior).
> Do we have any users of this feature in the tree?

We do, and it turns out to be a good argument in favor of the change.

The use of a function for `completing-read`s REQUIRE-MATCH and
`read-file-name`s MUSTMATCH was added in

    commit 49e06183f5972817d93dad6acf5351c204e61cc5
    Author: Lars Ingebrigtsen <larsi@HIDDEN>
    Date:   Fri Jun 10 10:16:57 2022 +0200
    
        Allow REQUIRE-MATCH to be a function
        
        * doc/lispref/minibuf.texi (Minibuffer Completion): Document it.
        
        * lisp/minibuffer.el (completion--complete-and-exit): Allow
        REQUIRE-MATCH to be a function.
        (read-file-name): Mention it.
        
        * src/minibuf.c (Fcompleting_read): Mention it.

and the surrounding commits point to its motivation in:

    commit 7ee736a884766f2017a934d936bfbfa4c70b5099
    Author: Lars Ingebrigtsen <larsi@HIDDEN>
    Date:   Fri Jun 10 10:19:15 2022 +0200
    
        Allow specifying a wildcard argument to list-directory again
        
        * lisp/files.el (list-directory): Allow specifying a wildcard
        argument interactively again (bug#55877).

But the code in that patch uses MUSTMATCH to *restrict* the possible inputs,
whereas Joseph's point is that the code currently does not allow using
MUSTMATCH to restrict the possible inputs.

And indeed we can currently do `M-x list-directory RET /etc/passwd RET`
and Emacs happily runs `list-directory` on that non-directory, contrary
to the intention of the code (IIUC):

     [...]
     (list (read-file-name
            (if pfx "List directory (verbose): "
	      "List directory (brief): ")
	    nil default-directory
            (lambda (file)
              (or (file-directory-p file)
                  (insert-directory-wildcard-in-dir-p
                   (file-name-as-directory (expand-file-name file))))))
     [...]


-- Stefan





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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 14:09:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 10:09:19 2023
Received: from localhost ([127.0.0.1]:52335 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qolW3-000091-4X
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 10:09:19 -0400
Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:45924)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1qolW0-00008p-OV
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 10:09:18 -0400
Received: from pps.filterd (m0333520.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 396Cc2Wo015192; Fri, 6 Oct 2023 14:08:55 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2023-03-30;
 bh=j2X0r2yTjTn6fAFxSxeb16h7a6eMtoAzPO+oaSDRUek=;
 b=qBPcp8s1VFKycvYMJA6Xh/yibmvjmik9mFWpXGM0I426/WlzEM8lM6C3nnREjo2mBsLb
 2E1rORt/FWh0fyzcAc11/EyxvMcPP5z8P6VXZBSuVYv3bN+pDLslbLJWzqpDPVTbKHog
 JMKEGHMSMTQeO7Xwesn+6h0NW+BSxhjZJKBH2hY3iVXhDW3PfjAx+QRaBLaomkOg7HtX
 ZQ9mvepTXkVist9TTIEib8bkvq3RJCn2B6rhGwKMgkKkJD9RfhFKlTBX6wbg88wNUuMg
 XVEYyx2uckdM2YU7bgvqlXK+3fN12fkP6QBvQB6lxuUjAt8+wLX2MFpr7bspm+Xus5+j xQ== 
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com
 (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tebqe4170-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 06 Oct 2023 14:08:54 +0000
Received: from pps.filterd
 (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
 by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19)
 with ESMTP id 396E14f1033713; Fri, 6 Oct 2023 14:08:53 GMT
Received: from nam02-bn1-obe.outbound.protection.outlook.com
 (mail-bn1nam02lp2044.outbound.protection.outlook.com [104.47.51.44])
 by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id
 3tea4axt24-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 06 Oct 2023 14:08:53 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=kRAOKzni4qv7hiO5ehfe9V1LkrezwOD7Csq/zJvX8tkXkf1u4CyT73iIdm3BQbnhgKJ65+/pXxSco6eHqCW0jvUOhv4nwXa6pqta1QEWNVs4ZoUaYHKfySvOtij4BLfyIXMm8HqXqOIsSNnMZBvK0B3xLlLHm/EZKOu6dcwXqB64fd9EqZP7w7HqlccQcZN3F3aAJ+k/19eWMGYiVRgp6obrNUAzWRQW57I6ypYSUdHgXSvCp+T60cdIBxBHaw3LfuoNU7+ZrYLuIzq0viDIErDHc9gxYcfPJwrkYmfYvxYjCx4j48tiOaYM/Gsg5nDGhdC9wTMWR8IzJtvBOVRicQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=j2X0r2yTjTn6fAFxSxeb16h7a6eMtoAzPO+oaSDRUek=;
 b=QXM8cUp+5S/eJ40G7aeqQz33HAsfulFo+Qek7TC7KhB0LjNdQPgd0zZfdhf1qcHrsZC9CXek69dMBzHNEk5SBgdxDLoMyGaO+Nj1QbnylnXdeHhpp45uHUvSqGWe286aL29SFpOuLtwvYF1s2OOsHhW3Sl1FenYHcJrQSDsVot85+UdFYGskJwA3iiP+A0+vItDDaUJe2J7dN7gSOcx+mCL8oA1w4bwuQPaZ/si3U9t5ylulMLrU+eMo2zNq/bXLVuS0zTkkQiKz098GWI9MBR3vx44GKN0dUDvYuHJyjWXWCoOujzUws+agaZrbdYZXEijPNsSiedrWaq0BHG+UDA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=j2X0r2yTjTn6fAFxSxeb16h7a6eMtoAzPO+oaSDRUek=;
 b=Kb+nnaySTsOAx0Ejp5R9CGGTDg1jXYUGFoZ13+Y8nf+S/oaEqHG/VCA8hG2DDlfRaTOCJADjeDStif7lI4bKtxBzJUN1L33DhJYEx07hI9PTBjQ4hBj7yFoPCgVBhQ5uD7cg51j/wWKmMrBY8JIgf/hv9vVreq4492tmjKHdHYA=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by CO1PR10MB4497.namprd10.prod.outlook.com (2603:10b6:303:9d::16)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.37; Fri, 6 Oct
 2023 14:08:51 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::b7d5:c4af:24ca:f386]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::b7d5:c4af:24ca:f386%4]) with mapi id 15.20.6838.033; Fri, 6 Oct 2023
 14:08:51 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Subject: RE: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
Thread-Topic: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
Thread-Index: AQHZ+FXcycvvLGWk30ShwNYHkx3GKLA8yh1w
Date: Fri, 6 Oct 2023 14:08:51 +0000
Message-ID: <SJ0PR10MB5488BA53706149817D6B9FC3F3C9A@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
 <SJ0PR10MB54888896E4756978753C5C6AF3CAA@HIDDEN>
 <83edi82w75.fsf@HIDDEN> <jwvzg0vucnr.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvzg0vucnr.fsf-monnier+emacs@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|CO1PR10MB4497:EE_
x-ms-office365-filtering-correlation-id: 92878572-0844-4fe5-e216-08dbc675c478
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 4IGySQHQeye6YOavfKogEsUjNPeYpfoMnd+y6+wo1pupDvz8v+/J7Fl4nYTzbZRI18Sw3z3CWJ9hIen+pjqVEBMApjMSfDoVbW7G3q5bM/kMUc4SpziGg9KeMn342fu7g3AOWo37MSJ/AFP51cmxtt8361aBEg0K06INUwDJSHgOi1VD9x8xdADkjbHBlEmtUlraWz4ka4Txhi0T4nn9FNinhTCZDcI1Aw4TNfo244hq6j/DH0y7U7m5bmHjySiiNPvlrPJUcx84cdOHKlrPU/UB5/5PugVGSxJF7qH3yh973MInPQjRIh27oNSkfunavNs9vR/B1MBgHgKuMCbQwWmPjq6VlL/KbHSaNwDo0uNbBdUQztrcSPit4fmxVgDJ+apPNLYXwO5XgHUT3GvF4wQC7lwNphPPXEMzCqP5+IFInnDzrgz/oH1QiByk1sBW7mnrABA8CeSPgaGOo5Si6jyyacMZMflSgjcZ/XMDsmYZ18NK8aREQc75MHP5U3sLzU4v1cvDANds30m/ngOrVMENkCgyHATOCBiPKIxYjVUarehqg4LvctFNAFkzEOA3/NdRiL5B/OoB7V2nPqgsn74L0qkYh9I9PyJCfd0VSUlAy7KbWtp0FVJRO/AT6K0U
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230031)(136003)(346002)(366004)(396003)(39860400002)(376002)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(66476007)(66556008)(296002)(66446008)(64756008)(41300700001)(54906003)(66946007)(9686003)(33656002)(122000001)(71200400001)(26005)(7696005)(6506007)(38100700002)(38070700005)(83380400001)(478600001)(86362001)(76116006)(110136005)(55016003)(316002)(44832011)(2906002)(4326008)(8936002)(8676002)(52536014)(5660300002);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?umg7p0Qw/U6+oW08yK1EwTEvKg0dr+uLkhu+kD0J7Xa1stMaqBUd+/jANxdm?=
 =?us-ascii?Q?kM2205ecM0v3+cDLj4PbICVx4eyQf/nrzD8OPmjOqInolT9JZJP7w9V+7YsH?=
 =?us-ascii?Q?rn6685ktQ0z6sw0DVP0PRuUwDJv/rdmoGoiht7TVnKqAxqTsSkBNBv3haGDx?=
 =?us-ascii?Q?vLYRUS9yrosBpgzD2TgPm3IVKQ0hrt4/S9Fk3mIEphv8NDcQnwzf75QYDv28?=
 =?us-ascii?Q?Sjy1fe7urdBfZ/5UcApKMGvyWGVB2wNdgpXhnmZgiCW1uUmQgLGXZVIgp75C?=
 =?us-ascii?Q?zftsGTYDGzOONhYuRKsnvzwEsFulJIpcSqIykmr6/+gt+bW2SZJIfgO2Uh+L?=
 =?us-ascii?Q?nwy/JLDQQ3JsRh6v7+fYn6CkN5eokePocNCMSd+50LP9uVGWytPQ51jMPoFT?=
 =?us-ascii?Q?TwGPuX+N7EK/QQCzZzbGMaL8TT9hROiTJAcw/q7GjuuOatFRzLlA65sGvafW?=
 =?us-ascii?Q?3RVDAmMbOmUNFL8YmYSINfYLet//99fjcJYhW+etH1sHBxSdRA8+hejm9UNv?=
 =?us-ascii?Q?GTigv7BYJn9VALi+oFO/PlY4M325AH2EfWvZ0WKc/UeLeqPW3HJKSMKQV/53?=
 =?us-ascii?Q?Muhs2In7EnuqpZ8wgslKFRuDm5tI4UKJs33qbzaE/1Ia3jh9lmydMa5efMDh?=
 =?us-ascii?Q?K6LnVhYP2k5QOHgGHTTGPlefCIO5w7rI3eWSJtHx2WtZCvy40A9DQpE0Uq96?=
 =?us-ascii?Q?hOV+5uuR0dym3RF2azU+h/aVkPXyky3HqVXSdFpV/3+LpVf7epDtK5IZhNZ2?=
 =?us-ascii?Q?iOQb3lkSME2MhnxCfm4cIOkSxG5uTP4RxTTgV7nuPl3PXbSVf5tOjOrxi/0j?=
 =?us-ascii?Q?jsQZNh58wrEkTyowwhSH4iVMbSclgTh0eArrWE9s5NjZNPXu47wg8QsnLJl4?=
 =?us-ascii?Q?xzYLeZoGXVGhEBBeQ5LDB4sxTt1DZKF+L3e4mIBGGs1rJbTLge8iUMmaGaQb?=
 =?us-ascii?Q?8VkWUFxxSVe2+hKsuSpk7Li65tsiFAGa97PZ1xQe3CjA6Ehs5swOiIUaMQa5?=
 =?us-ascii?Q?usXD5BO+LWPmn8fDtwffKcVuKeURQ5lv5UC/3Iti5M9yTnL5Lp5slfTthlSJ?=
 =?us-ascii?Q?cEAZrgPaxPbKsHx57Sg70Emc9NIfD9PsHjytwqKIFZQ16kIRs3vFsN5WIhNB?=
 =?us-ascii?Q?A11AQilzI3BSAOh3L0OlR4iMo9+aES4+AcjqBZpQXWC2cvqFUjM23vde8DLe?=
 =?us-ascii?Q?h8LwPdoZ8bwbxw6+P/G0t3y+h2TXdZn6Qu4/8jPzsUgnfCF/kRyRBeHCpy7a?=
 =?us-ascii?Q?PsLg+0J8zN3+/aasHR7rn7Q14edrBH8dDh4j0IUezaRSBjSpVWtDln8S87NJ?=
 =?us-ascii?Q?oOJf4W6wSI2BxzehlobMKs4XokN1GJNn7TF9A0zqONpxlRvupiDozMhr+rZd?=
 =?us-ascii?Q?CfwkPLNoGA53FoHSR0dhXsIh1ujdqOTC++hv8bsLBE2rl8dx1oC+LRx7de66?=
 =?us-ascii?Q?r33VX6oZZIxIxE8gTfO+nSro8/SfxtMSYbn0tuJAgiSpb6+djtxtzY+QKidW?=
 =?us-ascii?Q?tzD587VQv+SBAAK/fsvG2AQXUcjxO5HvRmP7uOKEbpfBC5L0Qb1sMHInypSW?=
 =?us-ascii?Q?8npSggXNm59CTsw+l116h9CcPEqs3fdffUgxRVUa?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?us-ascii?Q?wnNU4y5mhdGp++Ssz3xP9nOELwR7CdBdiv+RAHBde0HDnI8GCtYbGhzeSp1N?=
 =?us-ascii?Q?8lFcnupKxtjYuHxsV+xaZYbj94Y/KLufyXGtWoihmStHJnomjnjBQuWioplP?=
 =?us-ascii?Q?qs5+4gH00aOc4EXheoo4HaNNjyTgX0Db46wiqJHC50jSfsdiZ0/fTuWHQRX4?=
 =?us-ascii?Q?0SMLmCcPeTDCDYZtBRArVFTz72yToENVqFZriNr4QDzqoawMM6aVmOcvh1Ol?=
 =?us-ascii?Q?MnWLYdnsdVm3/DUpl4JupKEfB5i5w76hRWQX7lnCamyLbf54RbFmEoTLSlVS?=
 =?us-ascii?Q?k8HGELeKE4TpEkrF3xgArRLzWlX9MnET7YU4UkRxDliwGN2c2vZ+cN3wjWYg?=
 =?us-ascii?Q?dLaA4NrSRjAxhmqtpnBPsiTzmWqUneOReCSwn7QNQAXgh8nNRWN8QyiyTm/b?=
 =?us-ascii?Q?CRxKvnw4VLlrNZ8AMFDfd9qGKvqdmzXdznUdcR848rz1z5Xkudm/wWL9kIYv?=
 =?us-ascii?Q?/gIT3AKH3gSQR5OYOpXrNQ8bB/69/LDmgvyvPMTi5/nLWEifNILg2IUYUbxk?=
 =?us-ascii?Q?JhtjF0R5EfVO8VyFhI8pB5txbPzriD1n4WoLuzhi9FuMDF3izU92bWcQRhgt?=
 =?us-ascii?Q?3M2gdBgIp0cid1IL7LTIPsvzDRFTpwfTzoDEFFEc297mj94GcL+CkavSgs+R?=
 =?us-ascii?Q?movafq+WLiJnqvVx/75upjzkhbr28YdYPygrwG2KafKhe5B7crKhxmP88u2s?=
 =?us-ascii?Q?qG4LezmrlXcEOMGGKHH/qAZXFXo953Pf7euF0y22Et6G7KMjXoUym2yv0v2D?=
 =?us-ascii?Q?njInxyfgBh8KpqpV2dkDoOCwId0Spw5QViMvWheqrCSCT8Bfdc5HOaYsiezz?=
 =?us-ascii?Q?sHrBu6zfb3AzfRM9QVq4oD8malo4Dtsj+dRoVl+lvmTQUDeZsuUwpuYCenje?=
 =?us-ascii?Q?lpMSqKzZvfwhtte+g12k/95ASeHq/Q2dhSJXDB/w6wVzgxF53lhEjliOJR0o?=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 92878572-0844-4fe5-e216-08dbc675c478
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2023 14:08:51.2688 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: sik9KVlgbsGdicERjZpk2coRUdyWomEyPemzi1FqHPSywaJW5O4E0AxHowlwMLK58J1qMJ9uNNaR4g/X7qUe8Q==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4497
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26
 definitions=2023-10-06_12,2023-10-06_01,2023-05-22_02
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0
 mlxlogscore=765
 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2309180000 definitions=main-2310060104
X-Proofpoint-GUID: m_UtQ_0nvU7i-sEdF5PW9EJta7_pVHeW
X-Proofpoint-ORIG-GUID: m_UtQ_0nvU7i-sEdF5PW9EJta7_pVHeW
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66187
Cc: "michael_heerdegen@HIDDEN" <michael_heerdegen@HIDDEN>,
 "philipk@HIDDEN" <philipk@HIDDEN>,
 "66187 <at> debbugs.gnu.org" <66187 <at> debbugs.gnu.org>,
 "joseph@HIDDEN" <joseph@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 (-)

> (we've had `require-match` for more than 30 years
> and it's only last year that we decided it was
> worth generalizing it to a function)
        ^^^^^^^^^^^^

It was decided with very little discussion, FWIW.

The 29.1 behavior is not at all more general than
the longstanding previous behavior.  Just the
opposite.  It confuses different things, co-opting
the REQUIRE-MATCH behavior with completion behavior.

All code that previously might have passed a
function value for REQUIRE-MATCH expects that value
to be treated as any other non-`nil', non-`t',
non-`confirm*' value.  That's now broken.  That more
general behavior is lost - a function value being
treated differently imposes a limitation - the
behavior is more specific now (another case added),
not more general.

The new behavior that was cobbled together into the
REQUIRE-MATCH arg should have been provided in some
other way - whether an additional arg, or a non-arg
variable, or whatever.  It should not have been
jammed into REQUIRE-MATCH, changing its behavior in
an incompatible way.

(Just one opinion.)





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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 13:47:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 09:47:10 2023
Received: from localhost ([127.0.0.1]:49465 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qolAZ-0007BO-H7
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 09:47:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56640)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qolAV-0007As-5v
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 09:47:06 -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 1qolA5-0001iA-H6; Fri, 06 Oct 2023 09:46:37 -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=zWyaGfaqBUUdReaoAwkEgdRAsW+jeDYWqcHGeg7sRFw=; b=HWFFj6YJsJzr
 0flgEr8pF4YLm/xtBB0Bbjo9pYvalP0m77l2jupW7WvMkxFK44B8DZq8fnjylyYtYWtoIdUv0ynEU
 znF6sXR7rWK9x1R0JlvYx6i5mh8TBvcwnnqOiwhSnC7frquWScLAUDmVi8n0sWfWTBMU6RV266RTL
 c372oLOECJ7pEDJwx/w9nzJ2+7MaqGP7Kng759lxRV8hdjkeWd4ZOgI6Da1oSGF7XwLsMi34wh8p6
 oxctv2QsL1QAnHcYL5yNAFHiteQ4w0QRfXJ/YgcVMn5wwjD3dQHDFlsCvlBFwqvekJfwn7WZJQJPL
 WgIN2fPAqYP7qPiMrPP1VA==;
Date: Fri, 06 Oct 2023 16:46:47 +0300
Message-Id: <83v8bj2794.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Fri, 06 Oct 2023 09:01:23 -0400)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
 <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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: joseph@HIDDEN,  michael_heerdegen@HIDDEN,
>   philipk@HIDDEN,  66187 <at> debbugs.gnu.org
> Date: Fri, 06 Oct 2023 09:01:23 -0400
> 
> >> >> For example, given:
> >> >> 
> >> >> (completing-read "Prompt: " '("a" "b") nil
> >> >>                  (lambda (input)
> >> >>                    (string= "a" input)))
> >> >> 
> >> >> I expected that the prompt would refuse to complete "b". I was wrong.
> >> >> 
> >> >> Since completing-read is such a fundamental part of Emacs, I doubt it
> >> >> will be possible to change this behavior.  What do you think about the
> >> >> attached patch to clarify the completing-read docstring?
> >> 
> >> The use of a function as `require-match` is brand new in Emacs-29, so
> >> I think it's not too late to fix it.  I think rather than fixing the doc
> >> we should fix the behavior, e.g. with the patch below.
> >
> > What change in behavior (wrt Emacs 29.1) does this patch cause?
> 
> In the example he gave above it makes it so completion can be used to
> insert "b" but when you try to exit it refuses to exit.
> 
> IOW it gives primacy to the `require-match` function over the
> completion-table w.r.t deciding when the minibuffer's content is
> acceptable or not.
> 
> Code which wants the 29.1 behavior can easily get it by modifying their
> `require-match` function accordingly (and such code then works
> correctly both with Emacs-29.1 and with the new behavior).

Do we have any users of this feature in the tree?




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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 13:06:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 09:06:19 2023
Received: from localhost ([127.0.0.1]:49409 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qokX4-0000tw-Uj
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 09:06:19 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51807)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qokX3-0000tk-89
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 09:06:18 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F1B534417F2;
 Fri,  6 Oct 2023 09:05:52 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1696597551;
 bh=CDjC0Y9CozWS2DtPc9O7SE1+QQ6uYrK0rXRfijbH9JE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=LuvEPRDN2pdvYyX4xxhnoQaQzyfiehDm/eeN9/OMhGCvqn/4Dg8SocMf/rzcvAC3/
 ZE6YpezyQ/U/AE8E8KQ5u+Of5JKWZeTw+Q77peBJXq/1POh/umayhYocWGhrVF7Dz/
 LBmElg0o4DZn9z6XPCY7Gcly5IQwEPaL/zE8Km6lXaRxRGMe+jAG70BV+87p7ruawV
 gSNRdrXURCcmZHcroOgp1pNNJ8+x/uwNupL+n60T5Mkx0ZceUJUzhnOOGg27rjCet3
 Q2Hc7z9GbqgIbGQfvYHq3zvytOuOFHA1pwQVJJ3VkYfkEjeFsqFMwm/V14crBlYuJu
 dWwTTXgey1YKQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7994C441805;
 Fri,  6 Oct 2023 09:05:51 -0400 (EDT)
Received: from pastel (unknown [45.72.225.62])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3F965120201;
 Fri,  6 Oct 2023 09:05:51 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
In-Reply-To: <83edi82w75.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 06 Oct
 2023 07:47:58 +0300")
Message-ID: <jwvzg0vucnr.fsf-monnier+emacs@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
 <SJ0PR10MB54888896E4756978753C5C6AF3CAA@HIDDEN>
 <83edi82w75.fsf@HIDDEN>
Date: Fri, 06 Oct 2023 09:05:49 -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.018 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: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 Drew Adams <drew.adams@HIDDEN>, joseph@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 (---)

>> then how about not breaking the
>> behavior of REQUIRE-MATCH at all, and instead
>> just add a separate argument for what a function
>> value of REQUIRE-MATCH does in 29.1?
>
> That is definitely not a change suitable for Emacs 29 at this point.

Not only that but that would be hideous over-engineering (so not
suitable for `master` either).
The use of a function for `require-match` is already extremely rare
(we've had `require-match` for more than 30 years and it's only last
year that we decided it was worth generalizing it to a function), and
the new proposed behavior is strictly more general than the
29.1 behavior.


        Stefan





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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 13:01:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 09:01:55 2023
Received: from localhost ([127.0.0.1]:49392 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qokSp-0000lE-B4
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 09:01:55 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11870)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qokSn-0000l0-8t
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 09:01:53 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 033AC8065C;
 Fri,  6 Oct 2023 09:01:29 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1696597287;
 bh=1GBtXVleJ3k1eSPfJFtyOfkvdFiqH/6hNMe/niWLcmE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=axuzJvc2Z4JlPSdOoGqkAUe4wbUTuNbZjHUu8sFZDMroQCX5oFd/KoS21NZYhFDfd
 bMoYxH/LCsE7DhNigANd8cwjfyyr/3383XCWmmRl93hzqBUAom2ujg6isrQpzyafO0
 63KESp5spjeFG/7jaUetauKC5socCFgC28tZSYHSe2qwBjYOzeCZlMIUc1vRj1YXUi
 7Qu5A2e+ACsviIA0Rs/2u5740XeR4+m9NJOii6O3VtVYk0DDQPy66UDaYIieSrUueG
 qHuj7SWEBCn6CA7T/0Yvzu5OsmGAUrEwnhuqvD3zVw2fDGGHlP46qJODyJ6Ji+RTAu
 xh1OOIOSmcsBg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 92022804AD;
 Fri,  6 Oct 2023 09:01:27 -0400 (EDT)
Received: from pastel (unknown [45.72.225.62])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8E90012041E;
 Fri,  6 Oct 2023 09:01:26 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <83fs2o2wb0.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 06 Oct
 2023 07:45:39 +0300")
Message-ID: <jwv5y3jvrgq.fsf-monnier+emacs@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> <83fs2o2wb0.fsf@HIDDEN>
Date: Fri, 06 Oct 2023 09:01:23 -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.013 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: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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 (---)

>> >> For example, given:
>> >> 
>> >> (completing-read "Prompt: " '("a" "b") nil
>> >>                  (lambda (input)
>> >>                    (string= "a" input)))
>> >> 
>> >> I expected that the prompt would refuse to complete "b". I was wrong.
>> >> 
>> >> Since completing-read is such a fundamental part of Emacs, I doubt it
>> >> will be possible to change this behavior.  What do you think about the
>> >> attached patch to clarify the completing-read docstring?
>> 
>> The use of a function as `require-match` is brand new in Emacs-29, so
>> I think it's not too late to fix it.  I think rather than fixing the doc
>> we should fix the behavior, e.g. with the patch below.
>
> What change in behavior (wrt Emacs 29.1) does this patch cause?

In the example he gave above it makes it so completion can be used to
insert "b" but when you try to exit it refuses to exit.

IOW it gives primacy to the `require-match` function over the
completion-table w.r.t deciding when the minibuffer's content is
acceptable or not.

Code which wants the 29.1 behavior can easily get it by modifying their
`require-match` function accordingly (and such code then works
correctly both with Emacs-29.1 and with the new behavior).


        Stefan





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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 06:21:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 02:21:09 2023
Received: from localhost ([127.0.0.1]:49031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoeCz-0003PF-9V
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 02:21:09 -0400
Received: from out-210.mta1.migadu.com ([95.215.58.210]:12720)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qoeCw-0003P5-LL
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 02:21:08 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696573246;
 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=hor5wusk6RKL2ICsYRqfm/pw3eE5JESs3hQHSx00SPo=;
 b=E4pffs3ubEagSGVDcr64MfRLGLybPXR4sdtzC1Gtgo1XOPzroJSJzMuoB0Em/GHB2sxc4W
 ySXTAyUaPS+eE10Pv33g585u3OgD1ogzrVzkVhTpfwSHPYo6I1zFZUKVlYSUEHsT8vJJjG
 xjGz/gz3KD1EJoudG6L1/QDNtZJV7jg=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Thu, 05 Oct 2023 22:55:49 -0700
In-reply-to: <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
Message-ID: <87il7kz2yu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, philipk@HIDDEN,
 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Stefan Monnier <monnier@HIDDEN> writes:

>>> For example, given:
>>>
>>> (completing-read "Prompt: " '("a" "b") nil
>>>                  (lambda (input)
>>>                    (string= "a" input)))
>>>
>>> I expected that the prompt would refuse to complete "b". I was wrong.
>>>
>>> Since completing-read is such a fundamental part of Emacs, I doubt it
>>> will be possible to change this behavior.  What do you think about the
>>> attached patch to clarify the completing-read docstring?
>
> The use of a function as `require-match` is brand new in Emacs-29, so
> I think it's not too late to fix it.  I think rather than fixing the doc
> we should fix the behavior, e.g. with the patch below.
>
>
>         Stefan
>
>
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 2120e31775e..d4da2d0d19b 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -1835,15 +1835,13 @@ completion--complete-and-exit
>    (cond
>     ;; Allow user to specify null string
>     ((= beg end) (funcall exit-function))
> -   ;; The CONFIRM argument is a predicate.
> -   ((and (functionp minibuffer-completion-confirm)
> -         (funcall minibuffer-completion-confirm
> -                  (buffer-substring beg end)))
> -    (funcall exit-function))
>     ;; See if we have a completion from the table.
> -   ((test-completion (buffer-substring beg end)
> -                     minibuffer-completion-table
> -                     minibuffer-completion-predicate)
> +   ((if (functionp minibuffer-completion-confirm)
> +        (funcall minibuffer-completion-confirm
> +                 (buffer-substring beg end))
> +      (test-completion (buffer-substring beg end)
> +                       minibuffer-completion-table
> +                       minibuffer-completion-predicate))
>      ;; FIXME: completion-ignore-case has various slightly
>      ;; incompatible meanings.  E.g. it can reflect whether the user
>      ;; wants completion to pay attention to case, or whether the

Thank you!! The above change fixes completion--complete-and-exit:
attempting to exit with "b" now runs the final catchall cond clause.

However, the unexpected behavior persists (it is possible to exit with
"b") because the completion-function that completion-complete-and-exit
passes to completion--complete-and-exit returns "b" anyway since "b"
exactly matches one of elements of COLLECTION.

Thank you!

Joseph




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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 04:48:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 00:48:19 2023
Received: from localhost ([127.0.0.1]:48993 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qocl8-0000dI-Pn
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 00:48:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:55032)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qocl6-0000cd-RK
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 00:48:17 -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 1qocki-00061W-By; Fri, 06 Oct 2023 00:47:52 -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=PTvyvqxwhx2zCm8QBcYjWtoQMUdrHZ+XELHMWcc1cs8=; b=eaomMyIIgaoL
 LPWbA1XHENKlVZVpiQBVLtLZuFHWZF7tBkUcV7oMVJ53PeASB2L6J9jlVBhhfuR543HozZilKVn5Y
 FcQ2vvzMVVBnhBXT6REOMkj4MM19ELoH801J39STi8sTcNBxdaqlfpJVx0qIY77yJDasP182e1Tp9
 /rvc2S3a/Xkug4S/AJWa+Qgd95Ij5Qu0K54YxZkEahABdx2P3Gtouy+soTPSsNxZfhcOEsR60HU76
 SwsrBeJcyXpYnjeJv2whOdbsjj26ep6X78iopc8LClaI8ImmSHR+qv/DIcZKdL2q5n81pSG6hxYI/
 UiE/MI1Ww7g+GL+PTOLrfg==;
Date: Fri, 06 Oct 2023 07:47:58 +0300
Message-Id: <83edi82w75.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
In-Reply-To: <SJ0PR10MB54888896E4756978753C5C6AF3CAA@HIDDEN>
 (message from Drew Adams on Thu, 5 Oct 2023 20:20:46 +0000)
Subject: Re: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> 
 <SJ0PR10MB54888896E4756978753C5C6AF3CAA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, joseph@HIDDEN,
 monnier@HIDDEN, 66187 <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: Drew Adams <drew.adams@HIDDEN>
> CC: "michael_heerdegen@HIDDEN" <michael_heerdegen@HIDDEN>,
>         "philipk@HIDDEN" <philipk@HIDDEN>,
>         "66187 <at> debbugs.gnu.org"
> 	<66187 <at> debbugs.gnu.org>,
>         Joseph Turner <joseph@HIDDEN>
> Date: Thu, 5 Oct 2023 20:20:46 +0000
> 
> > The use of a function as `require-match` is
> > brand new in Emacs-29, so I think it's not
> > too late to fix it.  I think rather than
> > fixing the doc we should fix the behavior 
> 
> If it's not too late to fix what was introduced
> in Emacs 29

That is not yet established.

> then how about not breaking the
> behavior of REQUIRE-MATCH at all, and instead
> just add a separate argument for what a function
> value of REQUIRE-MATCH does in 29.1?

That is definitely not a change suitable for Emacs 29 at this point.




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

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


Received: (at 66187) by debbugs.gnu.org; 6 Oct 2023 04:46:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 06 00:46:05 2023
Received: from localhost ([127.0.0.1]:48988 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qociw-0000Xh-3H
	for submit <at> debbugs.gnu.org; Fri, 06 Oct 2023 00:46:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60010)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qociq-0000XK-U3
 for 66187 <at> debbugs.gnu.org; Fri, 06 Oct 2023 00:46: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 1qociR-0005R4-2G; Fri, 06 Oct 2023 00:45:31 -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=0icmEpKydXKcYdxeAV8IL+nb6GvNCd0oXjHMj6XfW5I=; b=Bc5h9S9UojpH
 v6hQT7OFi1xSHYjlFKsH3zKaoMxEGoluY7LiSHDOAhmWS927sdTwe1T3qBwwtRgr6Uh+KHleX9CIc
 wPJKi/UJtuzhSvm5I3qBVglkpZ34bSGeUdNaYw9cSdm7/94EqGTijhWZmplmXrNPtRB2e51aL0hn2
 ObffiZ0noNvRWljPhbPnT2EdanPu/O/Z58JxHxV/cdAXSnhhXOlWI9jE8xBnR7V+eo8R2pJNTKce+
 5W7LiE8MCokKw+WFbcQUtm//xmuBtdN8WWxujt23r+ax8/vNgjEzP1WY6UkjB/u5iE0cQs44kM3U7
 iNNiy/3JDNKtOFZCkxjSRw==;
Date: Fri, 06 Oct 2023 07:45:39 +0300
Message-Id: <83fs2o2wb0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Thu, 05 Oct 2023 15:34:32 -0400)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 joseph@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: Joseph Turner <joseph@HIDDEN>,  michael_heerdegen@HIDDEN,
>   philipk@HIDDEN,  66187 <at> debbugs.gnu.org
> Date: Thu, 05 Oct 2023 15:34:32 -0400
> 
> >> For example, given:
> >> 
> >> (completing-read "Prompt: " '("a" "b") nil
> >>                  (lambda (input)
> >>                    (string= "a" input)))
> >> 
> >> I expected that the prompt would refuse to complete "b". I was wrong.
> >> 
> >> Since completing-read is such a fundamental part of Emacs, I doubt it
> >> will be possible to change this behavior.  What do you think about the
> >> attached patch to clarify the completing-read docstring?
> 
> The use of a function as `require-match` is brand new in Emacs-29, so
> I think it's not too late to fix it.  I think rather than fixing the doc
> we should fix the behavior, e.g. with the patch below.

What change in behavior (wrt Emacs 29.1) does this patch cause?




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

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


Received: (at 66187) by debbugs.gnu.org; 5 Oct 2023 20:21:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 05 16:21:24 2023
Received: from localhost ([127.0.0.1]:48591 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoUqZ-00062r-KV
	for submit <at> debbugs.gnu.org; Thu, 05 Oct 2023 16:21:24 -0400
Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:2626)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1qoUqT-00062R-Kl
 for 66187 <at> debbugs.gnu.org; Thu, 05 Oct 2023 16:21:22 -0400
Received: from pps.filterd (m0246629.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 395IlFVN027970; Thu, 5 Oct 2023 20:20:49 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2023-03-30;
 bh=clB3QRfb1fHN8OTXmCJHDOngOnw7XQ18t+q4GNmbImg=;
 b=bd+6+LFY1zNzWLzCSyT5sApJt06qMreEVfCPd+2L7nGUzGRtCvTbg2wBgxC/OOWx1O5K
 rgAe6a4VSE5FLtjrtGSuuWAs1yf/q1MKRyDpwsk4kzlNUvr9EhBj5H5FM7HD6YFHpcNC
 oUZB3HtAysNM2ENwwxQsM3Iw7hHdiI1wlk/qiUZm/SS9mMCyJ8r+gpnxICePW/OCji+r
 8ay3nVAheaC7b9vc+EDRBQHJN/88ryGCxo744/QJOS8m25VxSf8fTOyis8QQp1ocap2M
 XF1kwAyPWffDjBtfJ1WTyjAGg17u5H/p9IGbWiOkMNrbRSQGdnXOJNqab03JkSmOSKdq oA== 
Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com
 (phxpaimrmta02.appoci.oracle.com [147.154.114.232])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tebjc2byb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 05 Oct 2023 20:20:49 +0000
Received: from pps.filterd
 (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
 by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19)
 with ESMTP id 395JnLCr005851; Thu, 5 Oct 2023 20:20:48 GMT
Received: from nam12-dm6-obe.outbound.protection.outlook.com
 (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171])
 by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id
 3tea49ntjr-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 05 Oct 2023 20:20:48 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=nPK5q3acPlQDkznttovc2+s8k5S+3MAB83YRjDw35R8hGNfro4bsx/gsp4nZijNwFLaVKEQFJhs+a6U1/cLbNjNsPcNQ4igxaJkzavm4nGSKAxYd/b94uIYjnPdt+59Hh+J74GuMfaX3sHf1A0gMJWcdR3XWQhKML9WB3NCQankNmdNaTsxm/RvUZTvHPhJ3xKh3aY6nAS5gMBDDP92FV3ogfaQ98imdReA3tUzlwrZ1zw5NWsEIYbbVIWu9nAk4cTaFNbQ3/003N8fSU7pqELyzljsQAsMmVRell8pjEHMzl8tuqeJDeBP5gXbQGAk4aBs1yWu6RzcyK4lrGffw0A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=clB3QRfb1fHN8OTXmCJHDOngOnw7XQ18t+q4GNmbImg=;
 b=E4MNJXcAUatOw+IzAdPwgla5kX8cZqX7F62wXRsu2OpEQXy34LiIj38wxNLwHd9iaFxb0QiAkenkmNSNiRdXnCvQQVAFE8hqo/oQD3MkwQyePFPcK488SBbu6Awrr6JCDxBcUY1kBHT2895uvpeTYnP4Kg0Psa5FrAstsgT03ehd+ddWtv8ZrUsCwwoOIvzMTNSajggKDfHx7cAZjB6IcuHc9tVML5rgul/neQkww4aI49j73qcS1siW/42npJlLgnNQdSxtgjEM+jNG1AaV2bSSYOax0cC9ZNJLxKH76HG7alEaaa90mDVJJB336uc5H3GtD8u/0qaAt/PFRC4E4w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=clB3QRfb1fHN8OTXmCJHDOngOnw7XQ18t+q4GNmbImg=;
 b=awBryAyvtv0094QelvZGIBRpRPu0edFSz1GKl3nQeBMuQkkVPW+WMS365EUpT06XGI3g8DHkkDBaow8saY1QP1cpsbXEiN5LDA/kjDcNdGGG7sm96/HhLGSYAUDoWz8umaZuGbkR1pPrZqZ/xCTMZPsXhPw1QeaQoEpKVF+ZR/Y=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by CH2PR10MB4392.namprd10.prod.outlook.com (2603:10b6:610:79::20)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31; Thu, 5 Oct
 2023 20:20:46 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::b7d5:c4af:24ca:f386]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::b7d5:c4af:24ca:f386%4]) with mapi id 15.20.6838.033; Thu, 5 Oct 2023
 20:20:46 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Subject: RE: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
Thread-Topic: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
Thread-Index: AQHZ98M87PZz1BcbI0etWkBd2pmWqLA7oZGw
Date: Thu, 5 Oct 2023 20:20:46 +0000
Message-ID: <SJ0PR10MB54888896E4756978753C5C6AF3CAA@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
 <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|CH2PR10MB4392:EE_
x-ms-office365-filtering-correlation-id: 665813ca-08c6-41e4-c967-08dbc5e08ee5
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: gUpAYzabHEGZ3TaVbAA99/PMIlMKo20asPsuu24iFSR1OY+AZfY+Q58PCFGJok2Nht1Xioo8isOkO1nt9O5jhw1uE/9Zm4NZfU8BkG+sw2VFXIvubdxcpQOcQqUR8SagA3Ww7NX2AyusMJuU+J8VjwkxQLX+P8ownfI2VDjWZVVQHt0yydjSi51Nfcyf9td5cQK5n0KoRxPnRqiLM+tr9RQXRoWzWmjpydeI9glyT9/DLNOpixB1dDhcEaXQpy05zEtPhuICeBzBcu9tKL5hU2jjIiNPPJ8Otww6f5UCOC84UfbIgUYaxrS/Gd56qamC4PTQFlzHfuY9qVzyoWzrKHPMmt/oUoDvwjpJ+VWJd8Uzwd/MN/GOvnI1V3H7VsqIxedO/2xg93naS9xKK0iHNxwejsbJyvO1krbQ/OHHPRIwWuZ5Wv5//q0CyioYEYyuriv8efo4RYl5dNUDa1koVu+Yay1DuYWwS7mxFousYRl2Zf0xMV5kCnCftgMWFexGmJPKIGE/5HeX9ZyTJbLsLGF9rBoFpi5sAwjubvlrW9d81o4B3h7saIzNyav5RyMcu03vjPTsdK47epo3m/CFQY2XWdGodVIoWFHt2PTscErjtVavi+v+RGBM0fQIRDPn
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230031)(39860400002)(366004)(346002)(376002)(136003)(396003)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(6506007)(7696005)(4744005)(9686003)(2906002)(86362001)(83380400001)(33656002)(122000001)(26005)(38100700002)(55016003)(38070700005)(52536014)(4326008)(44832011)(8936002)(316002)(8676002)(478600001)(296002)(5660300002)(66946007)(66556008)(66476007)(41300700001)(66446008)(64756008)(54906003)(110136005)(76116006)(71200400001);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?sn1aTH4JYW/lVNn7H15Xh9N7N99xx4bnn80/uR2UOouKColX9v+BtobUsUUh?=
 =?us-ascii?Q?41v7MSr7TBjDlMfAErCSOD7ECd+v4nttP49hb06CZE9r+dvQRaoIMp71P9KC?=
 =?us-ascii?Q?gkLLOzrDKeGuLIAjcnIixSNAoAlOjYUbpfgF1HdjJg1/EHdz4EfaAWU8vpe9?=
 =?us-ascii?Q?OuIzB+4LfJ4I+dXjsO32IpS5DNKepYaMRl4Pia6JZIT26+xvjuae+NBMAHi2?=
 =?us-ascii?Q?M1yLhsF3ywvg4cT7WsF3joOnSoH3JavxXY8UdfzL18Q9wd2mNS3HTb3E0vlm?=
 =?us-ascii?Q?EHc2wzsOIJsu3EChpA+TFEnsFHBRad/MrOlOO6i8dBkufQ0M+1LcyxAWNn2U?=
 =?us-ascii?Q?OZvBKjcjT9bSyeUKJ/ZQ6xqxqdDi2x/R6sQsW3fyguc87R7YSGmmkktZMztk?=
 =?us-ascii?Q?P4X+j42rG6nU+lJmlok/gBHtNOrOvyPUGdgV2kNKUPY0oNnSgws6NTKKbQVA?=
 =?us-ascii?Q?o6EF02bWuP7tLoKad7xyAwqykGQzqO18AlJMkBPSnoFdTeODbyqLS/S/rlsd?=
 =?us-ascii?Q?gkdhf5vkTEq0LPan3z6JPD/Ht2DngHy9cykopjfuz/MzlcsfLg6r1LMDr7/4?=
 =?us-ascii?Q?IVokoktFort7T5kVhK0d5apf9b5t51W8tQvRYAH4v/rliiBGAXGksZpw1Ybu?=
 =?us-ascii?Q?rHGXqezgyyUBOPKVD1HzQQGZ3G73GVv4sZcosonEDJJwE4NIA5Y7lF3w5xdE?=
 =?us-ascii?Q?0zzDixz4jkTj6pF1orQcqCI526c0u4/+NLh5HVqAotmHMoNY255VWsL34xaX?=
 =?us-ascii?Q?LTc1rEO38zkwbEBt9CwUK+yGYjZLqs/OQMJ4ADIlvGHy/6KTDCkQzDWQw+nB?=
 =?us-ascii?Q?J6D7arV2K/BH/A3fhY+XBMdSzW4OYnx6YCU2gWUqkyw9wkIY7g2mTNoz2R/4?=
 =?us-ascii?Q?6nyAtu19f3k7ElGQt+JG5afVFUJPYVKaRFCm5Fr+3N8LvlvGvHvilaCCpxKs?=
 =?us-ascii?Q?q9E1Ht3U/NkmccdvHdg0D3PCj+aaky6MoR+xInW4xt9E8+0ZkVMZCQw18XvE?=
 =?us-ascii?Q?0wVZyBFOXS2IRG0a+BiGC0+RtEOzBSEC9cH0NlhFIaj6tmxt2swIJYm8iVDW?=
 =?us-ascii?Q?5qoIHYUcmFgiekutYsrfnPqoKVFlALGWJWDijNUChNpvNyp7wl8JR8gm4ejK?=
 =?us-ascii?Q?kxt9x//iS8ZzFQmJEAq3bbImcPCgRSFzhxKfbgCasYGY2rzBh6GYzLuYk25V?=
 =?us-ascii?Q?F+Wgy4A365qhhoslhmcyHRtZ53A2Gk5Oo747o75adTYE5D3QtthLkkiR4Ro3?=
 =?us-ascii?Q?K/PyCOeNkGL/n5fFgLfIgq2IRX5ksvrUa1n0apg3+wiZxv02qogjqHtDXLFR?=
 =?us-ascii?Q?xG+kwPBmr4s+pdgMUu9lDIS1rsjDAZQdW2LDbUjxRljh6nJsAwIXfYBtejkA?=
 =?us-ascii?Q?31sDLFc8Uu10LP/i6MJdeKJTMdK7eO21OgsXQKFTMj6qoI12tOC4QWI1+LCb?=
 =?us-ascii?Q?vwp+x/+GLY2tFEuyzdOFFWsGoREUa7d30Lfy6hdknykGmUeXyqWjRClz58Tq?=
 =?us-ascii?Q?2NZZbpuqn1UvwQuTEndXOprggSnUr6ttV4VY+4R31E1p80gm2doupjviVqom?=
 =?us-ascii?Q?bvblBgUFYxuDDsnFrCY1PMu+Ro6E+z2AQqItme8Z?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?us-ascii?Q?ieeGEAfAXZWb5TaguQxEODNsve2XO3rEYS8w828UyYKMpiVKzk3nVi84sVVr?=
 =?us-ascii?Q?CW9FtI+bugc7JJLZlS58HzS5vXiRpvR0hi3yGN6EJVK+VeAVcwXfZKoA3ZET?=
 =?us-ascii?Q?8r10sMkSyl8N4wmQ1VK/7EngtgGakq9IwtUCLNnQzbYsj8+DpZAvIVRIAqcD?=
 =?us-ascii?Q?6K8jwt6W7pl/ut1gDAUpE3pMd2LvFjCjdPsawVOxI8HQEJInYTIF9L49WEpz?=
 =?us-ascii?Q?CTIo3mBeS2ChwIAVpywbt4OLQpNeD6WqIJEfJLYR1v/EtNaEjOR4RVB8dxOZ?=
 =?us-ascii?Q?ZG0bZ6pmapp7PccRfxSzg4NpJ12+tvotnF3MfC9H56GIOhUOznOJ30tMPBOJ?=
 =?us-ascii?Q?N0eShu4GQtOA/JWXyaskQ0qlOW8+lSojs257J+DOUoGeZKxH6LNsKtTh7Hl9?=
 =?us-ascii?Q?MGJvUYfjO8ZaXTkfRYClBDpqQsEB9Fns14PCdxpgF7gdasizSOmZ+OU9EVgD?=
 =?us-ascii?Q?DaI01qsXDphsxHrj9K1QBx8xdHkE49nh5v2oDudahOCYMKNe5sXpWZ/STmzl?=
 =?us-ascii?Q?T7mwpCq3m19vVgIr/p6IX2caFn+WmLcCa45n6z7a7YpSjy3jgSdisuiM/SDQ?=
 =?us-ascii?Q?xO18FUSA7Q5OHYK4H+wisRbzCfMQL76LSi958618UBAn6PZTVw3fWapU5AJZ?=
 =?us-ascii?Q?T2v6KiAW1FWRwOeIhMK9O+3Qe7w0qlh0bEfEhyhWxH+aWjBV+rtlcJUWdgIk?=
 =?us-ascii?Q?ZaE18KRKEVLBPjcRSPL8FYzUOC8pKLkMSKa4T3VTAn6xj8MRA7RK2UALvwFG?=
 =?us-ascii?Q?TqkThbqbofxV6eu+QLK45/8UjUDNaQgiIRHifLyI8c+ydEE8J4MSYlGIMnPI?=
 =?us-ascii?Q?GEX3yP/1nKeHQP1mDxxMg3CzG0li6Iz7Zjet8EacmuiWHu9CeWg7OgQX0mYv?=
 =?us-ascii?Q?vSSCbkM+JWUCQaGb66Rrzr8Gmz9J3N+uRtcSInpyPRmRhr+kHkwnG/bc4jaV?=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 665813ca-08c6-41e4-c967-08dbc5e08ee5
X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2023 20:20:46.3643 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: f5d6FMLpy3PAwZ0DuKMPvBi9nyVvuBs7f/op0+Q5RFObqvr7TlGptTOyXaXuic+SGZ7IW25+wiR+J4qIRJXMtg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4392
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26
 definitions=2023-10-05_15,2023-10-05_01,2023-05-22_02
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0
 mlxscore=0 bulkscore=0
 adultscore=0 mlxlogscore=879 phishscore=0 spamscore=0 suspectscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000
 definitions=main-2310050155
X-Proofpoint-GUID: Qsf28TfZmXFqdoD4WhTb4g_mM_3K8xpB
X-Proofpoint-ORIG-GUID: Qsf28TfZmXFqdoD4WhTb4g_mM_3K8xpB
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66187
Cc: "michael_heerdegen@HIDDEN" <michael_heerdegen@HIDDEN>,
 "philipk@HIDDEN" <philipk@HIDDEN>,
 "66187 <at> debbugs.gnu.org" <66187 <at> debbugs.gnu.org>,
 Joseph Turner <joseph@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 (-)

> The use of a function as `require-match` is
> brand new in Emacs-29, so I think it's not
> too late to fix it.  I think rather than
> fixing the doc we should fix the behavior=20

If it's not too late to fix what was introduced
in Emacs 29, then how about not breaking the
behavior of REQUIRE-MATCH at all, and instead
just add a separate argument for what a function
value of REQUIRE-MATCH does in 29.1?

(As opposed to what a function value of
REQUIRE-MATCH has always done before Emacs 29,
i.e., act like any other non-nil, non-`confirm*',
non-`t' value.)





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

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


Received: (at 66187) by debbugs.gnu.org; 5 Oct 2023 19:35:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 05 15:35:03 2023
Received: from localhost ([127.0.0.1]:48573 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoU7i-0004me-NH
	for submit <at> debbugs.gnu.org; Thu, 05 Oct 2023 15:35:02 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53966)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1qoU7f-0004m2-Bd
 for 66187 <at> debbugs.gnu.org; Thu, 05 Oct 2023 15:35:01 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 40282444152;
 Thu,  5 Oct 2023 15:34:35 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1696534473;
 bh=guYye47qsEGSqZrJrdO5PY0/KLAAGqE92z0q32lFNX8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Q36Fmlai8kRornZpjLr8Xiph0OwF2z7RqQ2MAo+bvZ0cZOVT6CUWJqXQN9YYGK6mg
 9l1uh8I6YL4NQ51f4kxP5m51TJVZ3UpVzS3IMtRku1M9Tif4oSBtgHVEW5myLPCU91
 jAR0iSqwyBmuSvX9PEI1+YaWleSCvxQwxZQ5vYvVY2nH/QVD7bJld99FdgTLNByBRT
 VxkYsUH0ExbuBSw+ykDnZoTsbfs6fS6tCb1gBOmGgQIq6n9YmQUQecCy2TglUN7Pzr
 vCQAQShvkqY2SWktKj92oVCe+e5vfR2MGNS/UUIAn6onH2XUjUMGSjlDYEI+VnKqVG
 dQ/dy1v/EPT8A==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 8936344414F;
 Thu,  5 Oct 2023 15:34:33 -0400 (EDT)
Received: from alfajor (unknown [23.233.149.155])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 60DFB12020A;
 Thu,  5 Oct 2023 15:34:33 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <83pm1u6f8l.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 04 Oct
 2023 10:03:54 +0300")
Message-ID: <jwv34yo7tqv.fsf-monnier+emacs@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <83pm1u6f8l.fsf@HIDDEN>
Date: Thu, 05 Oct 2023 15:34:32 -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.029 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: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@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 (---)

>> For example, given:
>> 
>> (completing-read "Prompt: " '("a" "b") nil
>>                  (lambda (input)
>>                    (string= "a" input)))
>> 
>> I expected that the prompt would refuse to complete "b". I was wrong.
>> 
>> Since completing-read is such a fundamental part of Emacs, I doubt it
>> will be possible to change this behavior.  What do you think about the
>> attached patch to clarify the completing-read docstring?

The use of a function as `require-match` is brand new in Emacs-29, so
I think it's not too late to fix it.  I think rather than fixing the doc
we should fix the behavior, e.g. with the patch below.


        Stefan


diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2120e31775e..d4da2d0d19b 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1835,15 +1835,13 @@ completion--complete-and-exit
   (cond
    ;; Allow user to specify null string
    ((= beg end) (funcall exit-function))
-   ;; The CONFIRM argument is a predicate.
-   ((and (functionp minibuffer-completion-confirm)
-         (funcall minibuffer-completion-confirm
-                  (buffer-substring beg end)))
-    (funcall exit-function))
    ;; See if we have a completion from the table.
-   ((test-completion (buffer-substring beg end)
-                     minibuffer-completion-table
-                     minibuffer-completion-predicate)
+   ((if (functionp minibuffer-completion-confirm)
+        (funcall minibuffer-completion-confirm
+                 (buffer-substring beg end))
+      (test-completion (buffer-substring beg end)
+                       minibuffer-completion-table
+                       minibuffer-completion-predicate))
     ;; FIXME: completion-ignore-case has various slightly
     ;; incompatible meanings.  E.g. it can reflect whether the user
     ;; wants completion to pay attention to case, or whether the





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

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


Received: (at 66187) by debbugs.gnu.org; 5 Oct 2023 01:13:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 21:13:18 2023
Received: from localhost ([127.0.0.1]:45595 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoCvW-0002xG-C2
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:13:18 -0400
Received: from mout.web.de ([217.72.192.78]:47057)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qoCvT-0002wy-EM
 for 66187 <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:13:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696468369; x=1697073169; i=michael_heerdegen@HIDDEN;
 bh=pEfyVefUBtv9rLtqvGHicDSeIP/703ch4Q15PtmYn6Y=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=tvwQONyxKDgs5xDrsE8nihzSB6WnUoFC7jXSNbEh70UHEM8R+XKSKlCPVZbD+FQuaCuK8gDLSru
 OjfrXgYzfCYyyaOa62U+ovByKalj4seBx/CdrXqD9icKaeNcVHrqFnoio/sQnvFEa44BZlD0wiMte
 6EAmRQDBILXghBOcShD0m4c7XSPjZqlWOLG2+IfO8cB7kEn/ZrKrscAmtqTRCiVGxajTCC0a6frSM
 8QkpUIR4UDCx5vccBLSbMExoX5K9RWLWk9jfZIbtVwNGHV+kBip49/A3xnJUZ9UQrGS+LO6ilPUp9
 BKW6y1KalSMslCieCmGgHtuxvqFWdOmBHlEw==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MOm0r-1qxuF53Os3-00Q7ry; Thu, 05
 Oct 2023 03:12:48 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <877co33qf9.fsf@HIDDEN> (Joseph Turner via's
 message of "Tue, 03 Oct 2023 22:22:05 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <87jzs33vqs.fsf@HIDDEN>
 <877co33qf9.fsf@HIDDEN>
Date: Thu, 05 Oct 2023 03:12:51 +0200
Message-ID: <87ttr53m98.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:hpSeMtfsGMWC3pUbornzUoeglucoPwgv3eyEZFt01ZsJPb2SCdL
 VEEmpTNLjHdFFwkrv/eAsothYwkW0fgfXjDPuMIsSCkMlCSUcqXi68TE+JuVBGbOW9sdbuX
 eZRiBbZdIV3pDf7mJKAVqMyEtdG2aDAvi7UZAJ0gDLwqHT55Habn226GpFxGxaFMz2pnalq
 D6FYTB/KPS9lL8U/EMzjA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:i9qN84bhGAs=;UmYw98BRXuMntpGJxrE2mUhly3z
 kEOyiT52YpNPh8TTbGou6ZH8nXyMd2q/0XenQaSQ4EzZmMCpQFwDX1aTjyXR2fHB3stR+K71t
 6ORnZ9rxKH/OGySK4IojvHt5lPwR8tLPD4RlWJGP5Y846yPc3X8/EXDpz8IxvTbVM2TXPxgf+
 VlvbgH9TsLCu1HZhXBD3qyc1xAvMkuZFt+VyBHIrTJMXNOYkPbtvTUvzKjuGMncTl27owxTp2
 2vENFTfzBkMfTlfEfmmqDH1KM92h6vE/I1xIRFlVFCKUEklbj6KzQdQ2eqtCHTfhl+yWmT6dR
 U28SWpcIAZDVHB7YU5N7YD2r5p2c6AF3UV3AbA4fGqvx3xMZN916C2SrQkuVFze7bd7xzLiIr
 yxNUhrHG/DZqscAw0fin9WawyNsYmEPmCB8j7pmtteYGHxlxK4tHxoUPm6LJChpoVq18ra33g
 8Ky4YqlNc9kFL/7Hc2PhgcpEqQXbw8zJsXWqwiqySEd2n659jdNm57+IzCBHT0lCbSpKbmm2E
 B9AW/qan1yUqJRF7WDEom58iyg10AlXNTuSA5NPfApyD8t4o/iTLiVstqh2DSkuwIeBYxOTor
 EhdLNOJ4Jh4zGJv9WxLfLyxF9jE/nsxXzbEPDYHJBL3nj8aUgY4DLFX29FZ5tCfPOKITZnI1h
 bgrj6KjQZ7cpdd43/6v3za1k/g/Zpjr/kUmMERI07GbX8GnASdgUVuMlufDe+tyYVMkTH0gXg
 QCWMqRrAkFL7o7aAleLTATXUNoIojdG0RHAL5BUslEPl9Q/IDd6tziQSsLiJBlmc8by/ChIyx
 BdW3ES9yz4jwEzDk1pHOkHmoD0KrBXaduzLxYEqLqyOaCRULi1Ts+hOcqpOwFEwIq1koppJ3J
 0o4RFJtvAaPATyH3M+xfgAprwPD4kTaBjX2CtW1eJsTRVN0JUwRZpIWS5RwhC6HmyG4Yani7i
 LrUvwRWR5KSOlsPbu+vhb2gFNfw=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66187
Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@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 (-)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> My original expectations:
>
> - PREDICATE narrows the list of completion candidates
> - MUST-MATCH function determines whether to accept the input
> [...]

> > This is only about `read-file-name'
>
> Doesn't the unexpected behavior originate in completing-read?

If that's the behavioral aspect you mean, then yes, the meaning of the
arguments is analogue, and they are passed to `completing-read'.

Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 5 Oct 2023 01:13:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 21:13:27 2023
Received: from localhost ([127.0.0.1]:45598 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoCvf-0002xe-Ld
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:13:27 -0400
Received: from lists.gnu.org ([2001:470:142::17]:50954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qoCvd-0002xQ-Vf
 for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:13:26 -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 <michael_heerdegen@HIDDEN>)
 id 1qoCvG-0005Y1-Mv
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 21:13:02 -0400
Received: from mout.web.de ([217.72.192.78])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qoCvF-0002im-4K
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 21:13:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696468369; x=1697073169; i=michael_heerdegen@HIDDEN;
 bh=pEfyVefUBtv9rLtqvGHicDSeIP/703ch4Q15PtmYn6Y=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=tvwQONyxKDgs5xDrsE8nihzSB6WnUoFC7jXSNbEh70UHEM8R+XKSKlCPVZbD+FQuaCuK8gDLSru
 OjfrXgYzfCYyyaOa62U+ovByKalj4seBx/CdrXqD9icKaeNcVHrqFnoio/sQnvFEa44BZlD0wiMte
 6EAmRQDBILXghBOcShD0m4c7XSPjZqlWOLG2+IfO8cB7kEn/ZrKrscAmtqTRCiVGxajTCC0a6frSM
 8QkpUIR4UDCx5vccBLSbMExoX5K9RWLWk9jfZIbtVwNGHV+kBip49/A3xnJUZ9UQrGS+LO6ilPUp9
 BKW6y1KalSMslCieCmGgHtuxvqFWdOmBHlEw==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MOm0r-1qxuF53Os3-00Q7ry; Thu, 05
 Oct 2023 03:12:48 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <877co33qf9.fsf@HIDDEN> (Joseph Turner via's
 message of "Tue, 03 Oct 2023 22:22:05 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <87jzs33vqs.fsf@HIDDEN>
 <877co33qf9.fsf@HIDDEN>
Date: Thu, 05 Oct 2023 03:12:51 +0200
Message-ID: <87ttr53m98.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:hpSeMtfsGMWC3pUbornzUoeglucoPwgv3eyEZFt01ZsJPb2SCdL
 VEEmpTNLjHdFFwkrv/eAsothYwkW0fgfXjDPuMIsSCkMlCSUcqXi68TE+JuVBGbOW9sdbuX
 eZRiBbZdIV3pDf7mJKAVqMyEtdG2aDAvi7UZAJ0gDLwqHT55Habn226GpFxGxaFMz2pnalq
 D6FYTB/KPS9lL8U/EMzjA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:i9qN84bhGAs=;UmYw98BRXuMntpGJxrE2mUhly3z
 kEOyiT52YpNPh8TTbGou6ZH8nXyMd2q/0XenQaSQ4EzZmMCpQFwDX1aTjyXR2fHB3stR+K71t
 6ORnZ9rxKH/OGySK4IojvHt5lPwR8tLPD4RlWJGP5Y846yPc3X8/EXDpz8IxvTbVM2TXPxgf+
 VlvbgH9TsLCu1HZhXBD3qyc1xAvMkuZFt+VyBHIrTJMXNOYkPbtvTUvzKjuGMncTl27owxTp2
 2vENFTfzBkMfTlfEfmmqDH1KM92h6vE/I1xIRFlVFCKUEklbj6KzQdQ2eqtCHTfhl+yWmT6dR
 U28SWpcIAZDVHB7YU5N7YD2r5p2c6AF3UV3AbA4fGqvx3xMZN916C2SrQkuVFze7bd7xzLiIr
 yxNUhrHG/DZqscAw0fin9WawyNsYmEPmCB8j7pmtteYGHxlxK4tHxoUPm6LJChpoVq18ra33g
 8Ky4YqlNc9kFL/7Hc2PhgcpEqQXbw8zJsXWqwiqySEd2n659jdNm57+IzCBHT0lCbSpKbmm2E
 B9AW/qan1yUqJRF7WDEom58iyg10AlXNTuSA5NPfApyD8t4o/iTLiVstqh2DSkuwIeBYxOTor
 EhdLNOJ4Jh4zGJv9WxLfLyxF9jE/nsxXzbEPDYHJBL3nj8aUgY4DLFX29FZ5tCfPOKITZnI1h
 bgrj6KjQZ7cpdd43/6v3za1k/g/Zpjr/kUmMERI07GbX8GnASdgUVuMlufDe+tyYVMkTH0gXg
 QCWMqRrAkFL7o7aAleLTATXUNoIojdG0RHAL5BUslEPl9Q/IDd6tziQSsLiJBlmc8by/ChIyx
 BdW3ES9yz4jwEzDk1pHOkHmoD0KrBXaduzLxYEqLqyOaCRULi1Ts+hOcqpOwFEwIq1koppJ3J
 0o4RFJtvAaPATyH3M+xfgAprwPD4kTaBjX2CtW1eJsTRVN0JUwRZpIWS5RwhC6HmyG4Yani7i
 LrUvwRWR5KSOlsPbu+vhb2gFNfw=
Received-SPF: pass client-ip=217.72.192.78;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=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
Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> My original expectations:
>
> - PREDICATE narrows the list of completion candidates
> - MUST-MATCH function determines whether to accept the input
> [...]

> > This is only about `read-file-name'
>
> Doesn't the unexpected behavior originate in completing-read?

If that's the behavioral aspect you mean, then yes, the meaning of the
arguments is analogue, and they are passed to `completing-read'.

Michael.




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

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


Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 07:04:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 03:04:23 2023
Received: from localhost ([127.0.0.1]:41382 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnvvi-0006nT-I0
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 03:04:23 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:44020)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qnvvf-0006nC-P3
 for 66187 <at> debbugs.gnu.org; Wed, 04 Oct 2023 03:04: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 1qnvvH-0006b6-Np; Wed, 04 Oct 2023 03:03:55 -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=ksyeBxesaIftzvMmW1FZd0YHipOcF4l4ntiBcI7ZdnA=; b=Git7N1BFj9R4
 meSzLIhr1zRe+0V4qPTtOdRmgGNdIrNrcbHQ6G0ZtsepvqAE+mugr5TVCU4Vtg79Kl9em2IKyNGD6
 qT0N99PUVZtTAFnNNfsw3o2Jwg12sNBT69xmowCXKZw8kn7GDyo5Rf6SzjueFg7dKgGI5bCYnEv4y
 5Ro4NwdARP2VDY8Xgr4kCLrzDHlqlaX9MPD+7ZqSTiMyfNMcXPWARXmev65joDzO+BXLggkQ8q4Uj
 k14S6r89NP/jBT+xuUuSXzhmAceMvZxUWbs+YuiK2dPJNMw+pil/C1Im/jn/Le/kRSfUEalTisOow
 9w8hiicGCAIKgPi8GN5opw==;
Date: Wed, 04 Oct 2023 10:03:54 +0300
Message-Id: <83pm1u6f8l.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <87ttr7nzyj.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a
 function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <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 (---)

> Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org
> Date: Tue, 03 Oct 2023 14:18:42 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> I dug a little more and realized that the IMO unexpected behavior
> resides in completing-read itself.  According to the completing-read
> docstring, its REQUIRE-MATCH argument can be
> 
> - a function, which will be called with the input as the
>   argument.  If the function returns a non-nil value, the
>   minibuffer is exited with that argument as the value.
> 
> I incorrectly assumed that this function would prevent matching items
> inside COLLECTION for which the function returns nil.  What it actually
> does it accept input which is not part of COLLECTION if the
> REQUIRE-MATCH function returns non-nil.  IOW, it doesn't narrow the
> potential completion options; it widens them.
> 
> For example, given:
> 
> (completing-read "Prompt: " '("a" "b") nil
>                  (lambda (input)
>                    (string= "a" input)))
> 
> I expected that the prompt would refuse to complete "b". I was wrong.
> 
> Since completing-read is such a fundamental part of Emacs, I doubt it
> will be possible to change this behavior.  What do you think about the
> attached patch to clarify the completing-read docstring?

I don't think I see how your proposed change clarifies this issue.

Adding Stefan for possibly more comments and ideas.




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

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


Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 06:26:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 02:26:52 2023
Received: from localhost ([127.0.0.1]:41334 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnvLP-000360-Lh
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 02:26:52 -0400
Received: from out-206.mta0.migadu.com ([91.218.175.206]:32203)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnvLM-00035r-R2
 for 66187 <at> debbugs.gnu.org; Wed, 04 Oct 2023 02:26:50 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <83y1gpyysv.fsf@HIDDEN>
 <871qebph9p.fsf@HIDDEN> <83ttr66hxy.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696400789;
 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=HtVuCKb2YYx/2+NQ61Dlz7OQBRAK+UhWjJpBRFkPU8s=;
 b=DvYnec7wRWQkqLHY0uH282WxuH7o/L4qAlwIZn6Zc4vvs3op9NawF+COxkmIJm4/gn++QJ
 vQKSkW4Vlc2QakXmSQFOG+EOkpocjv3oDdyyjtm72uLzleZGPpKHMSaXPAEGTR7ZeGJx8b
 0bf3Hp/96ljRHnu1HPS44EqsWe960Zs=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 03 Oct 2023 23:25:18 -0700
In-reply-to: <83ttr66hxy.fsf@HIDDEN>
Message-ID: <8734yq52em.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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


Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Joseph Turner <joseph@HIDDEN>
>> Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org
>> Date: Tue, 03 Oct 2023 13:43:56 -0700
>>
>>
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>
>> > This is okay, except that we do document the other arguments.  So why
>> > not just copy/paste the description of MUSTMATCH from read-file-name
>> > to read-directory-name instead?
>>
>> The read-file-name docstring for MUSTMATCH is lengthy, and duplicating
>> it will mean that if read-file-name changes, we'll need to remember to
>> change the docstring of read-directory-name.
>
> That's true, but it doesn't sound like a grave problem to me.  We have
> the same duplication elsewhere, so this isn't a precedent.  Moreover,
> when a doc string is long and complicated, asking the reader to read
> part of it elsewhere is also quite a hassle.
>
> So I still think duplication is the lesser evil here.

Thanks for the explanation! See patch.

Joseph


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-MUSTMATCH-description-in-read-directory-name-doc.patch

From 3a653d681083d8d14d2d2437cb3f405dd7f07f04 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 26 Sep 2023 18:01:27 -0700
Subject: [PATCH] Fix MUSTMATCH description in read-directory-name docstring

* lisp/files.el (read-directory-name): Copy from read-file-name
description, replacing "file" with "directory".
---
 lisp/files.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..c31cb13653e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -817,8 +817,23 @@ non-empty string that was inserted by this function.
 If the user exits with an empty minibuffer, this function returns
 an empty string.  (This can happen only if the user erased the
 pre-inserted contents or if `insert-default-directory' is nil.)
-Fourth arg MUSTMATCH non-nil means require existing directory's name.
- Non-nil and non-t means also require confirmation after completion.
+
+Fourth arg MUSTMATCH can take the following values:
+- nil means that the user can exit with any input.
+- t means that the user is not allowed to exit unless
+  the input is (or completes to) an existing directory.
+- `confirm' means that the user can exit with any input, but she needs
+  to confirm her choice if the input is not an existing directory.
+- `confirm-after-completion' means that the user can exit with any
+  input, but she needs to confirm her choice if she called
+  `minibuffer-complete' right before `minibuffer-complete-and-exit'
+  and the input is not an existing directory.
+- a function, which will be called with the input as the
+  argument.  If the function returns a non-nil value, the
+  minibuffer is exited with that argument as the value.
+- anything else behaves like t except that typing RET does not exit if it
+  does non-null completion.
+
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
 the value of `default-directory'."
-- 
2.41.0


--=-=-=--




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

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


Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 06:05:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 02:05:57 2023
Received: from localhost ([127.0.0.1]:41287 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnv1A-0002Xz-Om
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 02:05:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36510)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qnv18-0002Xm-8B
 for 66187 <at> debbugs.gnu.org; Wed, 04 Oct 2023 02:05:54 -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 1qnv0j-0004WJ-Ak; Wed, 04 Oct 2023 02:05:30 -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=fW8/qECV9qD7q61Jfac5DSJ5MN4ZPCMw6WYxJeGEtIo=; b=WiyLo2rVr5r3
 UHdKVvCd3+RWdzZbkL0V1pYlmAaC4WZye5ZJ0TLWJSiTL6f3YFWgwloM1ZB/KkWmB2MlpgIfAnEkx
 LlKxmWZo4eexqwwCTXtQccaqIN1gTNutCDD9nyIKJ1b6KdPloRP33zT3J9eEZXyLNl9Pr8PCSxeZ+
 3lAXoUoM0DTMgGiz9VQyukqrCmHXQH3sMJ8vBhtozkR8wMJte6GOgH5SICZmjvw6Oyfo3k0fsztFz
 WS2ya0FOLoE4rPAdzPRdp02n/PetXG1UL9ow7CqqPRy3jmTjfTSP2FC8l22fp68bH1Rv8SX8r3CDX
 23vZyZ3MUv+oSKoiWRbvvA==;
Date: Wed, 04 Oct 2023 09:05:29 +0300
Message-Id: <83ttr66hxy.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
In-Reply-To: <871qebph9p.fsf@HIDDEN> (message from Joseph Turner
 on Tue, 03 Oct 2023 13:43:56 -0700)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <83y1gpyysv.fsf@HIDDEN>
 <871qebph9p.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <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: Joseph Turner <joseph@HIDDEN>
> Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org
> Date: Tue, 03 Oct 2023 13:43:56 -0700
> 
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org
> >> Date: Tue, 26 Sep 2023 17:55:37 -0700
> >> From:  Joseph Turner via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> >>
> >> > Finally, I think the docstring of `read-directory-name' needs to be
> >> > updated: it fails to mention that MUSTMATCH can be a function (the
> >> > argument is passed directly to `read-file-name').
> >>
> >> How about the attached patch?
> >
> > This is okay, except that we do document the other arguments.  So why
> > not just copy/paste the description of MUSTMATCH from read-file-name
> > to read-directory-name instead?
> 
> The read-file-name docstring for MUSTMATCH is lengthy, and duplicating
> it will mean that if read-file-name changes, we'll need to remember to
> change the docstring of read-directory-name.

That's true, but it doesn't sound like a grave problem to me.  We have
the same duplication elsewhere, so this isn't a precedent.  Moreover,
when a doc string is long and complicated, asking the reader to read
part of it elsewhere is also quite a hassle.

So I still think duplication is the lesser evil here.




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

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


Received: (at submit) by debbugs.gnu.org; 4 Oct 2023 05:31:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 01:31:09 2023
Received: from localhost ([127.0.0.1]:41249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnuTU-0001V4-VH
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 01:31:09 -0400
Received: from lists.gnu.org ([2001:470:142::17]:55906)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnuTT-0001UW-7W
 for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 01:31:07 -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 <joseph@HIDDEN>)
 id 1qnuT6-0007W5-5E
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 01:30:44 -0400
Received: from out-195.mta0.migadu.com ([2001:41d0:1004:224b::c3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qnuT3-0006YR-Vq
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 01:30:43 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <87jzs33vqs.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696397438;
 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=vjSB4OubI2HvszkOMdeDHXJdRuLMfKJ2IOskfqO38gU=;
 b=hyQILJjfgAraDCDYXsotQ5FaCV1CUW1xC/avbhZKBpMdvKLF/lO9JpbxoQOlXSsAQwBeS5
 rwpzsLuw1W5zcUkKf3p7PmAw42bCePuvYDN0gLexY5EhgPJ1tKyYGELn95YVTFNJyPOa/Q
 /pudy5d4RaQ1+tD+Zy9sreeUG7m3elw=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 03 Oct 2023 22:22:05 -0700
In-reply-to: <87jzs33vqs.fsf@HIDDEN>
Message-ID: <877co33qf9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=2001:41d0:1004:224b::c3;
 envelope-from=joseph@HIDDEN; helo=out-195.mta0.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, philipk@HIDDEN,
 66187 <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: -0.1 (/)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> Since completing-read is such a fundamental part of Emacs, I doubt it
>> will be possible to change this behavior.
>
> This is only about `read-file-name' - and MUST-MATCH being allowed to be
> a function is quite new (June 2022).  If we have good reasons to change
> the behavior because we find that the case when both MUST-MATCH and
> PREDICATE are specified does not work intuitively I think it would still
> be possible to tune it a bit.
>
> But we have to know which behavior is more expected than what we
> currently have.

My original expectations:

- PREDICATE narrows the list of completion candidates
- MUST-MATCH function determines whether to accept the input

I had thought that the two arguments would work independently of one
another.  IOW, the return value of MUST-MATCH would be the only factor
that determines whether input is accepted.  If MUST-MATCH returns
non-nil, the input is unconditionally accepted, and vice versa.

> This is only about `read-file-name'

Doesn't the unexpected behavior originate in completing-read?

Joseph




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

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


Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 05:31:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 04 01:31:00 2023
Received: from localhost ([127.0.0.1]:41245 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnuTM-0001UG-Jg
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 01:31:00 -0400
Received: from out-205.mta0.migadu.com ([91.218.175.205]:59814)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnuTJ-0001U6-N3
 for 66187 <at> debbugs.gnu.org; Wed, 04 Oct 2023 01:30:59 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN> <87jzs33vqs.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696397438;
 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=vjSB4OubI2HvszkOMdeDHXJdRuLMfKJ2IOskfqO38gU=;
 b=hyQILJjfgAraDCDYXsotQ5FaCV1CUW1xC/avbhZKBpMdvKLF/lO9JpbxoQOlXSsAQwBeS5
 rwpzsLuw1W5zcUkKf3p7PmAw42bCePuvYDN0gLexY5EhgPJ1tKyYGELn95YVTFNJyPOa/Q
 /pudy5d4RaQ1+tD+Zy9sreeUG7m3elw=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 03 Oct 2023 22:22:05 -0700
In-reply-to: <87jzs33vqs.fsf@HIDDEN>
Message-ID: <877co33qf9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, philipk@HIDDEN,
 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> Since completing-read is such a fundamental part of Emacs, I doubt it
>> will be possible to change this behavior.
>
> This is only about `read-file-name' - and MUST-MATCH being allowed to be
> a function is quite new (June 2022).  If we have good reasons to change
> the behavior because we find that the case when both MUST-MATCH and
> PREDICATE are specified does not work intuitively I think it would still
> be possible to tune it a bit.
>
> But we have to know which behavior is more expected than what we
> currently have.

My original expectations:

- PREDICATE narrows the list of completion candidates
- MUST-MATCH function determines whether to accept the input

I had thought that the two arguments would work independently of one
another.  IOW, the return value of MUST-MATCH would be the only factor
that determines whether input is accepted.  If MUST-MATCH returns
non-nil, the input is unconditionally accepted, and vice versa.

> This is only about `read-file-name'

Doesn't the unexpected behavior originate in completing-read?

Joseph




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

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


Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 03:36:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 03 23:36:11 2023
Received: from localhost ([127.0.0.1]:41136 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnsgE-00077e-Ue
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 23:36:11 -0400
Received: from mout.web.de ([212.227.17.11]:59231)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qnsgC-00077E-7D
 for 66187 <at> debbugs.gnu.org; Tue, 03 Oct 2023 23:36:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696390537; x=1696995337; i=michael_heerdegen@HIDDEN;
 bh=5wIXguSeozyG9lnJyLHhv2YYK0MGV8znoZYz58FjJXM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=DsQ1wJhFfH+ilvgen1SLToHaMPh6fJAtcC6J7D4gzmayLq9vX/4JI7d/R87EyUdsR7n5dnDsXEV
 m1K1rDq24g9E2deeQHiz1ViwmWdIhua9C/eG44EW73DukQVXEonpC+bhOf1nQ0yUYkI6n4twsT/ET
 gfanw2IS/wQsFWdXLgA0FVAaW4mx+QjbHg1ghv7Btwa3/twWfxT7urgk8IjvfZREiSqKOvm7MxkCA
 BnCdcJNxMqQF/3NKa7LG+8vNwrfOiMrEsCR6kZSyfGLYn1q34+r3ibKP/icaaAZvMCukK+hYpGp4c
 iWKhDP/14zdspC+g6YqozvfPQNS5zKCgg99w==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MPKB5-1qxxJ61N4H-00PP8j; Wed, 04
 Oct 2023 05:35:37 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87ttr7nzyj.fsf@HIDDEN> (Joseph Turner via's
 message of "Tue, 03 Oct 2023 14:18:42 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN>
Date: Wed, 04 Oct 2023 05:35:39 +0200
Message-ID: <87jzs33vqs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:KhtU4HPcEdB/JYGrvo/nJG4ghX82/M7R/vqp8gZlOryVuLgjPh1
 2lTuEj/gx1hao4ltcMIOWTWcv0+2vLKvfMU3iVcGt5gDy+kk04DFe/scgwgmHvSeq31wpiS
 0zadgn7DXsP9amyNXU4SCj0tTYPSTF96fuUIcm0UCOJh7FJxdog5l5300JFqAk1AdPtSt6D
 DHc2eaWEMgY4LYW5xL4fg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:RVJE1qIUdCg=;XFHYPh2gLsZYeBluhwZQ1Mqgvfp
 JlDkkVG6J73tvcfKtOS16mCg9OBfr/7rDo45KHQ2MuVZPvsv589YfLOJv7yhUDHx2dJf8Pr9h
 zJPzDuLDrmpGyqWF+cVKsdoFDsTU1JGlpYuUbk/Az4kcOEnzDwO2y73k4XE/ptjbJJnEKDzJa
 wIFcj8Xe1TLdHTJZCMJfKS2IsJf8A87qXr/VpuyyKdTvQODTQXwzLHMkgVuuDtLVDID+mkiOi
 5LNVTphGXVs5qp2ImuYkFp6kmZUuGl9vUqpHh77PJrKMTeagMqjBuS7fTM/YLrekjezkUfIAo
 jR/XqHwA3OVGpzWEWXFr/obBx+f2MK6C+yp7wUcBSyrh0S6A0ixTwdF+nuhwU+yPvClDMT9Gm
 IpFZpw3C61sZX5QRv0NOzRUDAoOWyy7OOu+COmkjRqOIPjMW+5yMaCRWoMx1eyAw1+rUZYyKu
 ln86UrLwE7cbK1A4Q7GBl58nVVeWDX0/VAVLvsLdbH+J+AEDYWy5iOAUn/XzR7NPxYkhXoO6I
 K4O7MsWV/2iGIeNWaa74ydNQH5kYH+L0fTCVEkSCmTBnxxZgU7byEqzdB11ZHNECyRnYpGFEp
 85u4ZdPrMuLd+QAa1et8yzlI5LL3HZjTHyXQXIrg7P6x4HF2YoI6tsVXHbEVPF6g26zmyvkfk
 /9/uwQa83fF+RQm8CG15bjh43rduxaIsNkXS8JAkON1yMmUyedO0cjkb1SJl50r1vm+RLdLb5
 008UspMEewD/9nzS+dFy+jligzgM98BWgW9N7SC+gkh//YTunsF/U0yakdugrKvflpB81HyGp
 8i37cqNJXzHY8B+1fs/P6ZQZnkQAPF9O/KQMwi9L6cBis1MgoA/mEHFV97R5t+lquNxUqIktc
 rhQKN1bj2SnWPkqA/H2Anv6XpzzAdrw0m9p2WjWauD32u9uVOr39S6b6o/gP1Xm+EB6yR9ttz
 QRaNsTYCwdB/RwqLSj9n0R1/9GA=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Since completing-read is such a fundamental part of Emacs, I doubt it
> will be possible to change this behavior.

This is only about `read-file-name' - and MUST-MATCH being allowed to be
a function is quite new (June 2022).  If we have good reasons to change
the behavior because we find that the case when both MUST-MATCH and
PREDICATE are specified does not work intuitively I think it would still
be possible to tune it a bit.

But we have to know which behavior is more expected than what we
currently have.

Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 4 Oct 2023 03:36:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 03 23:36:24 2023
Received: from localhost ([127.0.0.1]:41139 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnsgS-000788-A7
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 23:36:24 -0400
Received: from lists.gnu.org ([2001:470:142::17]:41896)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qnsgQ-00077r-7a
 for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 23:36:22 -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 <michael_heerdegen@HIDDEN>)
 id 1qnsg2-0005U8-0l
 for bug-gnu-emacs@HIDDEN; Tue, 03 Oct 2023 23:35:58 -0400
Received: from mout.web.de ([212.227.17.11])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qnsfz-000574-ET
 for bug-gnu-emacs@HIDDEN; Tue, 03 Oct 2023 23:35:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696390537; x=1696995337; i=michael_heerdegen@HIDDEN;
 bh=5wIXguSeozyG9lnJyLHhv2YYK0MGV8znoZYz58FjJXM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=DsQ1wJhFfH+ilvgen1SLToHaMPh6fJAtcC6J7D4gzmayLq9vX/4JI7d/R87EyUdsR7n5dnDsXEV
 m1K1rDq24g9E2deeQHiz1ViwmWdIhua9C/eG44EW73DukQVXEonpC+bhOf1nQ0yUYkI6n4twsT/ET
 gfanw2IS/wQsFWdXLgA0FVAaW4mx+QjbHg1ghv7Btwa3/twWfxT7urgk8IjvfZREiSqKOvm7MxkCA
 BnCdcJNxMqQF/3NKa7LG+8vNwrfOiMrEsCR6kZSyfGLYn1q34+r3ibKP/icaaAZvMCukK+hYpGp4c
 iWKhDP/14zdspC+g6YqozvfPQNS5zKCgg99w==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MPKB5-1qxxJ61N4H-00PP8j; Wed, 04
 Oct 2023 05:35:37 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87ttr7nzyj.fsf@HIDDEN> (Joseph Turner via's
 message of "Tue, 03 Oct 2023 14:18:42 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN>
Date: Wed, 04 Oct 2023 05:35:39 +0200
Message-ID: <87jzs33vqs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:KhtU4HPcEdB/JYGrvo/nJG4ghX82/M7R/vqp8gZlOryVuLgjPh1
 2lTuEj/gx1hao4ltcMIOWTWcv0+2vLKvfMU3iVcGt5gDy+kk04DFe/scgwgmHvSeq31wpiS
 0zadgn7DXsP9amyNXU4SCj0tTYPSTF96fuUIcm0UCOJh7FJxdog5l5300JFqAk1AdPtSt6D
 DHc2eaWEMgY4LYW5xL4fg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:RVJE1qIUdCg=;XFHYPh2gLsZYeBluhwZQ1Mqgvfp
 JlDkkVG6J73tvcfKtOS16mCg9OBfr/7rDo45KHQ2MuVZPvsv589YfLOJv7yhUDHx2dJf8Pr9h
 zJPzDuLDrmpGyqWF+cVKsdoFDsTU1JGlpYuUbk/Az4kcOEnzDwO2y73k4XE/ptjbJJnEKDzJa
 wIFcj8Xe1TLdHTJZCMJfKS2IsJf8A87qXr/VpuyyKdTvQODTQXwzLHMkgVuuDtLVDID+mkiOi
 5LNVTphGXVs5qp2ImuYkFp6kmZUuGl9vUqpHh77PJrKMTeagMqjBuS7fTM/YLrekjezkUfIAo
 jR/XqHwA3OVGpzWEWXFr/obBx+f2MK6C+yp7wUcBSyrh0S6A0ixTwdF+nuhwU+yPvClDMT9Gm
 IpFZpw3C61sZX5QRv0NOzRUDAoOWyy7OOu+COmkjRqOIPjMW+5yMaCRWoMx1eyAw1+rUZYyKu
 ln86UrLwE7cbK1A4Q7GBl58nVVeWDX0/VAVLvsLdbH+J+AEDYWy5iOAUn/XzR7NPxYkhXoO6I
 K4O7MsWV/2iGIeNWaa74ydNQH5kYH+L0fTCVEkSCmTBnxxZgU7byEqzdB11ZHNECyRnYpGFEp
 85u4ZdPrMuLd+QAa1et8yzlI5LL3HZjTHyXQXIrg7P6x4HF2YoI6tsVXHbEVPF6g26zmyvkfk
 /9/uwQa83fF+RQm8CG15bjh43rduxaIsNkXS8JAkON1yMmUyedO0cjkb1SJl50r1vm+RLdLb5
 008UspMEewD/9nzS+dFy+jligzgM98BWgW9N7SC+gkh//YTunsF/U0yakdugrKvflpB81HyGp
 8i37cqNJXzHY8B+1fs/P6ZQZnkQAPF9O/KQMwi9L6cBis1MgoA/mEHFV97R5t+lquNxUqIktc
 rhQKN1bj2SnWPkqA/H2Anv6XpzzAdrw0m9p2WjWauD32u9uVOr39S6b6o/gP1Xm+EB6yR9ttz
 QRaNsTYCwdB/RwqLSj9n0R1/9GA=
Received-SPF: pass client-ip=212.227.17.11;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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
Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Since completing-read is such a fundamental part of Emacs, I doubt it
> will be possible to change this behavior.

This is only about `read-file-name' - and MUST-MATCH being allowed to be
a function is quite new (June 2022).  If we have good reasons to change
the behavior because we find that the case when both MUST-MATCH and
PREDICATE are specified does not work intuitively I think it would still
be possible to tune it a bit.

But we have to know which behavior is more expected than what we
currently have.

Michael.




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

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


Received: (at 66187) by debbugs.gnu.org; 3 Oct 2023 23:01:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 03 19:01:02 2023
Received: from localhost ([127.0.0.1]:40871 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnoNy-0003M6-Gh
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:01:02 -0400
Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:45554)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1qnoNx-0003La-0w
 for 66187 <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:01:01 -0400
Received: from pps.filterd (m0246631.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 393I4MxC027092; Tue, 3 Oct 2023 23:00:41 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2023-03-30;
 bh=nQa95PzzB2Nl/0kxD3jTxGPToNX1ht4r8kavYGwztKQ=;
 b=zhwtNlf7pz1LmjpzdbqAfbIWro9KYl8qGrI8n6YYVmP48C8C+voaXNTSTwn2UZQnBR7u
 9zRJ6hsLcUnB7E9wmE6m5eZBNijrwOUdHfTXQoI3cGSFI1sf7IPZG/4v1HVpcrPFxLhR
 8tlh4q0o8VWV6SpWbZhGpiNyL8ajbv8Tfj5s6Hnwl55Mn9I+b/vwSINu+HvnYGANxE9o
 PPty4DAI5Kb4geDWw/VJfNDjFgW+v329xwzHl6Iciyhfl9Pa+4wA29jXYiY/203Ecd2x
 5mBAxdV+Ct35gpA3+YVMKcr55KPa9ud3dyBJ5tTsNqnYfIYjKCdzzjypUMUiYMMg53HV ww== 
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com
 (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3teaf45wfd-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Tue, 03 Oct 2023 23:00:41 +0000
Received: from pps.filterd
 (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
 by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19)
 with ESMTP id 393MU2q9033597; Tue, 3 Oct 2023 23:00:40 GMT
Received: from nam10-mw2-obe.outbound.protection.outlook.com
 (mail-mw2nam10lp2108.outbound.protection.outlook.com [104.47.55.108])
 by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id
 3tea46xrvt-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Tue, 03 Oct 2023 23:00:40 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=V0Yg9I4T98Mein2McrLvOyHiIjdxaoZXp90J/+BgH3TZHHchP25DO7vIm3LduzHRQFtd6eDQIrr/KvFMaYUN+ytIdknbcgJ9t2S3bQJuuGkigXioEXXq7F0EgLzTI8eyYkg/HgrQgvQDg9H1dEkweYtHk645qtu47hSvuMglN5/7VEIsgi+xmnCz3Dq7qe1K9zFox9Rtv/9sSv2Qtbes6AgzJxZtlXmxYctasyRmmxnjEssc+We7ytVOnoVNnS+/Se8FxJKLjQoEeapMriXUrDnqPHBdEJhCuHo236UJkf99Kxh7rOE9cN3rgydtHlJPNkmnN+SAXNf7mzf6exPcag==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=nQa95PzzB2Nl/0kxD3jTxGPToNX1ht4r8kavYGwztKQ=;
 b=Gd1VNSuUtoelDWPCo/roiFVwklzW7bEqZmhFSiaR5VsFFTEnQjRPxifmYOaJrBX3Pffbe9zGH+9smjS2EDCnYGfrbEZxxpiWfLTpIdCxpyQv4V6n1NzWeCpwJahMdHD9AabuPUeIT3L7TMr+HPx424KbyhevePi12/HqEXWEQBa/BX1guwYcDbR+pqo18eEA+bZcDM1wxcYU/8mB3b1CWKkTY5tuYeXNFyIjnoOATaWvDEKcGAhJn/XNM994WUbhJJOdIbJiCWPM1QDc8vlajS2AeZrtIZIv9iC6Z1LG6qFTKjqalRXf3F1fD+PmCicL42bK/xXi56uHzcyNzgc7cA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=nQa95PzzB2Nl/0kxD3jTxGPToNX1ht4r8kavYGwztKQ=;
 b=if1A5BCUPg4mv6a+8c2Upl3mByTaW/POvcAeGmie++trcOW1ycnP+HrSz0ZAlKpIF9+X0wa0YGYuY0NacYxgKZsaCtHrZpI0Oy+yOyxFknEXTqgtStc66GdVIvRUuRjgVnV92EU5/3KGUvzzLWv2zqlYv81KKUPQlgBq4DUoNOI=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by DS7PR10MB7375.namprd10.prod.outlook.com (2603:10b6:8:d9::21) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31; Tue, 3 Oct
 2023 23:00:38 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::b7d5:c4af:24ca:f386]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::b7d5:c4af:24ca:f386%4]) with mapi id 15.20.6838.033; Tue, 3 Oct 2023
 23:00:37 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>, Michael Heerdegen
 <michael_heerdegen@HIDDEN>
Subject: RE: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
Thread-Topic: [External] : bug#66187: read-file-name unexpected behavior when
 MUSTMATCH is a function
Thread-Index: AQHZ9kL0LYSBm849pEC8Ez3K++fnKLA4no6w
Date: Tue, 3 Oct 2023 23:00:37 +0000
Message-ID: <SJ0PR10MB5488B213FAFF20CA23342126F3C4A@HIDDEN>
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
 <87ttr7nzyj.fsf@HIDDEN>
In-Reply-To: <87ttr7nzyj.fsf@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|DS7PR10MB7375:EE_
x-ms-office365-filtering-correlation-id: 35f4f5e8-8f36-4dca-870f-08dbc4648f13
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: AMLca5vhnaE9fOH9xBWEoSXds2XwepFjZ+QhscIVj4gXa9flBes80o4U61sq+moEGeCIytPZv5tk1u+Y4kR2v3I/wK1OBZbWwstTrcIgp9TGNOMCM8JZKEbRZGdmFhFJl/ktSao2Y9iVzTuCd91PuPWsc2VdAQ5EjSiOpz2WHSKc414QBW7XK9WuTFwORoKAjVXVhj1QjQho8JjTIw1hvSma13u70DsISUGltdtQT5vXKI5O1Lf33HjrU+1cKpQv3Y+mUuELdOEhkqJhVv95nce7/KKpkQU77VcSGi6bBTvjMmMz45B7lycBeHarpyJeJgJ1L9Vo5LmUNgXY2z/pqsbkc7dIxUOcJ85nJZurNxjy/E3YoU+8saRn6AfAz5v+O5KQPlZ2M/vKzpCWmS30uLtCW5hlICyhH1xTMCfnxCO+FUcHIfnbShR9DTKzGWvTiClSrrPArgiIDhbnPl1Fh3Hyiqcijq1d0Flbgc/S3SpZHnSuEzKnkLqN0mDQUTGOIYeRTwnKas6sPio3AZVWgFpEZhNWVqO43t5I2oBDV90VGEUGQNSza2s3PgwhpqJ7RHk5XL81Ijutfho5PnfqvpK/SPsRr5JdgU7nwFPSxskKL3azviQXAtB5F7nFNSwd
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230031)(366004)(136003)(39860400002)(376002)(396003)(346002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(83380400001)(44832011)(5660300002)(2906002)(55016003)(4744005)(38100700002)(38070700005)(9686003)(122000001)(7696005)(6506007)(478600001)(86362001)(33656002)(71200400001)(26005)(52536014)(8676002)(8936002)(4326008)(66556008)(76116006)(54906003)(64756008)(66446008)(66476007)(110136005)(66946007)(316002)(41300700001);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?n5WlLvLf9d+467122qEfdIdurZTFj60RcsGZTpPKlMpufGUHmS4SJIuIbLs7?=
 =?us-ascii?Q?OmtFOIvIGbVrvhsfnWWGWrilzmaW36qTPlzANk41IluHZv0MoHkxy+J+abTj?=
 =?us-ascii?Q?i4BYHTFSXGK/K7IiGkxFHHO6he8rQN0dHpfgKz37ALEC9wd7AykDvLwBRBzM?=
 =?us-ascii?Q?q1ST57TRYl3XKkj7qiFTrjtO23QnPf4qZRkwBf41JrlxyFfKb8b1eGL9lo3q?=
 =?us-ascii?Q?V81/bzsDE1TaJFcFYm11GuSFlJU5dyK6GP4/1S6uBJlCFSHv932jilpfxF8G?=
 =?us-ascii?Q?8bDc6hCW+HG0fFcO6/RGZYLNZ98olYZogikR4VWRQdP4ASW89IiceBQhKjeh?=
 =?us-ascii?Q?q517x7+xBlfo+unJyhIcwxHw3C36IDKn5HJmz5up1BKQmR83H0KaUopJ6nER?=
 =?us-ascii?Q?Ypkr1sLtvJYDEnxQrZfz2jXlg1g1+2/SQdGmn6B9c8eke4IH5C11j429JfXo?=
 =?us-ascii?Q?XogYHKT4aWZRVjXPTOsk2i74Zzo6r4JcG7VVk8BzmV14ZQw48pYUmktLGt3h?=
 =?us-ascii?Q?qAqu3sVHzzAbT51JPSsWQuEjtqSpTyv62goN2XNS/EtWo7MdtqLGEBxsTRVJ?=
 =?us-ascii?Q?1J0R598ObJtdC9ikKsYk2ogzo0Y/44Ni8N78A10tVUVw41lifDBTdsbTIZxx?=
 =?us-ascii?Q?Bm6q2l98bpb0InoSxBu9M2rLaatHjZOOd3Te3Wol8CjfATkcDWGwQ9hge6+B?=
 =?us-ascii?Q?4k8eSde9Xy8yP/nBlhLY2dcs2CZfUfidpn/vPS651MaDu0w5GUEYhScicaUT?=
 =?us-ascii?Q?OZRfm9lzHP3beLOHHhjXHYifOTTSkCF8E3Sy/HzYwnitoTgFxlK2GGWqm1I0?=
 =?us-ascii?Q?kFv4lZOmH7mxEL1L5FAfDbx0vOBeIC6MZIdGftvUUmo1HQyrOj/WnNRak908?=
 =?us-ascii?Q?jkRLqgqKDBOCX39xA7yeyxUQOPdFKl0SRsDflI6NsLPKeBFF8NP/Ndyyl5lS?=
 =?us-ascii?Q?flPRF+ehxKbWPuNeQRm5Q6PEDRjr1O7MjAMHoFrNBDgKZ3SmyKUdfC0X4KsR?=
 =?us-ascii?Q?UshR/EaqaBsqnE6VRqVibSOvXZ8soYiJIjakvhz0mRr797tyG9QRUbmpSmUc?=
 =?us-ascii?Q?Dxq3m7jwkNsE4rjI8petfreNwwk1qK+35BfzAAvLvbjm7Cm3ZETys2CFsbQm?=
 =?us-ascii?Q?13Sg2+o9y+72kPvnvfM6WAsCNLO/LCQXRzJmv5zwfs5NFhG6UGBU87h+SNOz?=
 =?us-ascii?Q?KE+NuHiRzlwEmW57a7YmQIh9/93/Pwed4rqfNaB1FcfoY32ENi6at1iKLQ9O?=
 =?us-ascii?Q?m5EAKE97Q6GRNHNs7gdlb+TGGqBLQHqwrFWK32lA7SYN7PUs6+KIpou5MQNM?=
 =?us-ascii?Q?mSBVk+gY4/ZAMipEja7vz6YFrfqu0F3wQchW0jolDmgJ1GeGvqtL4iyrACcO?=
 =?us-ascii?Q?dlH8WQQKcMlHtytQFiybMq8Bx8tAVxUPy3/MWkL7braGkBUKNQPsbvbd9G+9?=
 =?us-ascii?Q?Qw3n9MLlhNiqaFSLPM6GJUOR5fd2P6s/G/4YuG36Cnzgul5RD0VeVKzmuNEL?=
 =?us-ascii?Q?tyk2s0Z5ZzAxqiV6f2LqBWF3ZTaDAdDDnfkA48fFMUSE4sIrJnYKU06ZB4GC?=
 =?us-ascii?Q?lRChWaAgy0FQZvw5wW6oeUb6tNTKAnZHgZ8dYgeR?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LzDNyfER6f3hWLPkgc12psxPI2Pi4xAgWxXnueiQFcI2aBAhsZM1OFg6skEDOLN+neldJKGPWOOkvSXHT+mMmTuVVbCqxC5OF2CPMueGL8+Vjg3CuLY1jzT4S7slrs9zuvJas1AuZxyKx93wog8DicT16DCcnlaDorH/1UBD2tb6diJssDv0yuZFbCCI+HE9KT7k8l/ru198GmfRQHhwLMSBbT1DFPa/Qs1iIl/RateB+sfdtpY66GOUySmPfCsdjk0LqWOdzAKmloV8Wo0y/uzLQs4f88S7XFms2oW9dQuX5IB3Wo9Vs1AmaJdFgTHdfHuwMzBZL02HCYXmBjgThNOFsXiDKEFNKbrOgO4DeCrL50qcxGy7UlwXqb4KsWuuex5Y17FkI+ktcahUISTxl3NFu2UM2XtnokDUH6SZ3jdV1ZZIaouQz56e6kmLjeX5KM6vXMtJGwAmMhJz0bSskLBenhRLwy63Ypa+Li2L8QUXit09D285DfFr4FGe/zktq/yDMoE8YeR4NedZnixs2ofP/4hawJtL1FVV7c+c4Ov/QF/hhXnQN8YGDWkRpizHgNGF9Lv4OKN1AL1PHmEwdTQtgWY0zRMRuyfiSDGt3FXYW6XRslB+D8bXjx1AHGb4yYrMskjMmou7SbCEF2Dc/TvuDJCarD2C+QRM12XFWQqlY4ldpDBfVqDmuTs6aK4Qm/fwfOvhMUdfSu9ffq6Lnyz/iZepOIRrwMoHWqB2HB9pApdPziPSGJaLoOTOSw0ttxep+sWQHJLmkmtDm7r8c5bVdZSh38fqH8CfVzk7DQNZzTIR2PBRYH2ujFKnsKWhAE0oYMp5Xl5V0Ul3fVV0lagdjBLDO9DdICPci9QZDYvP4lbCXBogvk/c9Zl7qahy
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 35f4f5e8-8f36-4dca-870f-08dbc4648f13
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2023 23:00:37.8753 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: B/B3FRxORMswHLvMCxXEXI6M5n+HDUV8jYREUf7PpF7p/OH/TQJhXxT4+X+Dq6rjMAK/hX2Mk+EhTvHHRrmbUQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB7375
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26
 definitions=2023-10-03_18,2023-10-02_01,2023-05-22_02
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0
 mlxlogscore=638
 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2309180000 definitions=main-2310030174
X-Proofpoint-GUID: 6tWCixEPTwGkQuJhphfJ0q5ikF7OYpr_
X-Proofpoint-ORIG-GUID: 6tWCixEPTwGkQuJhphfJ0q5ikF7OYpr_
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66187
Cc: "philipk@HIDDEN" <philipk@HIDDEN>,
 "66187 <at> debbugs.gnu.org" <66187 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Since completing-read is such a fundamental part of Emacs,
> I doubt it will be possible to change this behavior.

Apparently it was possible for Someone (TM) to
change the behavior, in spite of the fact that
it's a longstanding "fundamental part of Emacs".
It _was_ a fundamental part of Emacs, but it
seems that somehow it's signature was changed
for Emacs 29.

The new behavior for a function value of
REQUIRE-MATCH is backward-incompatible.

A function as REQUIRE-MATCH value _should_ still
be treated as any other value that's not nil, t,
`confirm', or `confirm-after-completion'.  I
filed bug #66328 for this.






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

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


Received: (at 66187) by debbugs.gnu.org; 3 Oct 2023 21:44:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 03 17:44:46 2023
Received: from localhost ([127.0.0.1]:40835 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnnC9-00072X-UG
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 17:44:46 -0400
Received: from out-198.mta1.migadu.com ([2001:41d0:203:375::c6]:14806)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnnC7-00072O-70
 for 66187 <at> debbugs.gnu.org; Tue, 03 Oct 2023 17:44:44 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696369464;
 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=2M8CtT3MSfavIDkfw4MlLIMBbB/avU+mP6n6hgt7NoI=;
 b=IjLTtpaANqEmI7a3bXLFSCl+xfNosP1VIUSVVVXpIGolbZ9QOwQBZaomIC3K+kr+77Z3Ak
 8cTeB+At6O6Dix+j1aPPPFjp/tROCmKh2rhUyOcCbEIn8pDtIZziOUDx4PgSW4a/Y9vp/O
 /TFR8qZesIfyAwNObw0sM9pnI0kEMjs=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 03 Oct 2023 14:18:42 -0700
In-reply-to: <87h6ngs85e.fsf@HIDDEN>
Message-ID: <87ttr7nzyj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> I had a look and tried this:
>
> [2. text/x-diff; 0001-WIP-Bug-66187.patch]
> From ad895d2df5c69e015c2c7eba5116ab2d440e1fbc Mon Sep 17 00:00:00 2001
> From: Michael Heerdegen <michael_heerdegen@HIDDEN>
> Date: Wed, 27 Sep 2023 03:32:37 +0200
> Subject: [PATCH] WIP: Bug#66187
>
> ---
>  lisp/minibuffer.el | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 2120e31775e..79a8786fbac 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -3061,13 +3061,23 @@ completion-file-name-table
>            (funcall (or pred 'file-exists-p) string)))
>
>         (t
> -        (let* ((name (file-name-nondirectory string))
> +        (let* ((test-directory (lambda (s)
> +                                 (let ((len (length s)))
> +                                   (and (> len 0) (eq (aref s (1- len)) ?/)))))
> +               (should-complete
> +                (and pred
> +                     (if (eq pred 'file-directory-p)
> +                         test-directory
> +                       (lambda (f)
> +                         (or (funcall test-directory f)
> +                             (funcall pred f))))))
> +               (name (file-name-nondirectory string))
>                 (specdir (file-name-directory string))
>                 (realdir (or specdir default-directory)))
>
>            (cond
>             ((null action)
> -            (let ((comp (file-name-completion name realdir pred)))
> +            (let ((comp (file-name-completion name realdir should-complete)))
>                (if (stringp comp)
>                    (concat specdir comp)
>                  comp)))
> @@ -3078,18 +3088,9 @@ completion-file-name-table
>                ;; Check the predicate, if necessary.
>                (unless (memq pred '(nil file-exists-p))
>                  (let ((comp ())
> -                      (pred
> -                       (if (eq pred 'file-directory-p)
> -                           ;; Brute-force speed up for directory checking:
> -                           ;; Discard strings which don't end in a slash.
> -                           (lambda (s)
> -                             (let ((len (length s)))
> -                               (and (> len 0) (eq (aref s (1- len)) ?/))))
> -                         ;; Must do it the hard (and slow) way.
> -                         pred)))
> -                  (let ((default-directory (expand-file-name realdir)))
> -                    (dolist (tem all)
> -                      (if (funcall pred tem) (push tem comp))))
> +                      (default-directory (expand-file-name realdir)))
> +                  (dolist (tem all)
> +                    (if (funcall should-complete tem) (push tem comp)))
>                    (setq all (nreverse comp))))
>
>                all))))))

> I thought this would make Emacs complete as you want.  But: what files
> should be shown when hitting TAB?  I decided to show only matching
> files, plus all directories (seems logical, since these may contain
> matching files).

> But that gives a bad user experience: When I tried this I thought it
> would not work because completion did not accept an existing empty
> directory.  Then I saw that it actually was not empty.  But it contained only
> plain files, no subdirectories, and TAB displayed nothing.  Quite confusing!

I dug a little more and realized that the IMO unexpected behavior
resides in completing-read itself.  According to the completing-read
docstring, its REQUIRE-MATCH argument can be

- a function, which will be called with the input as the
  argument.  If the function returns a non-nil value, the
  minibuffer is exited with that argument as the value.

I incorrectly assumed that this function would prevent matching items
inside COLLECTION for which the function returns nil.  What it actually
does it accept input which is not part of COLLECTION if the
REQUIRE-MATCH function returns non-nil.  IOW, it doesn't narrow the
potential completion options; it widens them.

For example, given:

(completing-read "Prompt: " '("a" "b") nil
                 (lambda (input)
                   (string= "a" input)))

I expected that the prompt would refuse to complete "b". I was wrong.

Since completing-read is such a fundamental part of Emacs, I doubt it
will be possible to change this behavior.  What do you think about the
attached patch to clarify the completing-read docstring?

Thank you!!

Joseph


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Clarify-completing-read-REQUIRE-MATCH-function-docst.patch

From 10fa6dd5c659bed2b818fb925445cab2cbbb5325 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 3 Oct 2023 14:40:22 -0700
Subject: [PATCH] Clarify completing-read REQUIRE-MATCH function docstring

* src/minibuf.c (Fcompleting_read): Explicitly note that REQUIRE-MATCH
function does not narrow the completion candidates.
---
 src/minibuf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/minibuf.c b/src/minibuf.c
index 58adde1bf66..616be7091ee 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1999,8 +1999,11 @@ REQUIRE-MATCH can take the following values:
   `minibuffer-complete' right before `minibuffer-complete-and-exit'
   and the input is not an element of COLLECTION.
 - a function, which will be called with the input as the
-  argument.  If the function returns a non-nil value, the
-  minibuffer is exited with that argument as the value.
+  argument.  If the function returns a non-nil value or if
+  the input is a member of COLLECTION, the minibuffer is
+  exited with that argument as the value.  If the function
+  returns nil and the input is not a member of COLLECTION,
+  then the user is not allowed to exit.
 - anything else behaves like t except that typing RET does not exit if it
   does non-null completion.
 
-- 
2.41.0


--=-=-=--




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

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


Received: (at submit) by debbugs.gnu.org; 3 Oct 2023 21:44:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 03 17:44:55 2023
Received: from localhost ([127.0.0.1]:40838 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnnCI-00072r-Ii
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 17:44:55 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58342)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnnCG-00072f-Sv
 for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 17:44:53 -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 <joseph@HIDDEN>)
 id 1qnnBt-0000Cd-3E
 for bug-gnu-emacs@HIDDEN; Tue, 03 Oct 2023 17:44:29 -0400
Received: from out-208.mta1.migadu.com ([95.215.58.208])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qnnBq-0000RH-9t
 for bug-gnu-emacs@HIDDEN; Tue, 03 Oct 2023 17:44:28 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <87h6ngs85e.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696369464;
 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=2M8CtT3MSfavIDkfw4MlLIMBbB/avU+mP6n6hgt7NoI=;
 b=IjLTtpaANqEmI7a3bXLFSCl+xfNosP1VIUSVVVXpIGolbZ9QOwQBZaomIC3K+kr+77Z3Ak
 8cTeB+At6O6Dix+j1aPPPFjp/tROCmKh2rhUyOcCbEIn8pDtIZziOUDx4PgSW4a/Y9vp/O
 /TFR8qZesIfyAwNObw0sM9pnI0kEMjs=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 03 Oct 2023 14:18:42 -0700
In-reply-to: <87h6ngs85e.fsf@HIDDEN>
Message-ID: <87ttr7nzyj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.208;
 envelope-from=joseph@HIDDEN; helo=out-208.mta1.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.1 (/)

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


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> I had a look and tried this:
>
> [2. text/x-diff; 0001-WIP-Bug-66187.patch]
> From ad895d2df5c69e015c2c7eba5116ab2d440e1fbc Mon Sep 17 00:00:00 2001
> From: Michael Heerdegen <michael_heerdegen@HIDDEN>
> Date: Wed, 27 Sep 2023 03:32:37 +0200
> Subject: [PATCH] WIP: Bug#66187
>
> ---
>  lisp/minibuffer.el | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 2120e31775e..79a8786fbac 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -3061,13 +3061,23 @@ completion-file-name-table
>            (funcall (or pred 'file-exists-p) string)))
>
>         (t
> -        (let* ((name (file-name-nondirectory string))
> +        (let* ((test-directory (lambda (s)
> +                                 (let ((len (length s)))
> +                                   (and (> len 0) (eq (aref s (1- len)) ?/)))))
> +               (should-complete
> +                (and pred
> +                     (if (eq pred 'file-directory-p)
> +                         test-directory
> +                       (lambda (f)
> +                         (or (funcall test-directory f)
> +                             (funcall pred f))))))
> +               (name (file-name-nondirectory string))
>                 (specdir (file-name-directory string))
>                 (realdir (or specdir default-directory)))
>
>            (cond
>             ((null action)
> -            (let ((comp (file-name-completion name realdir pred)))
> +            (let ((comp (file-name-completion name realdir should-complete)))
>                (if (stringp comp)
>                    (concat specdir comp)
>                  comp)))
> @@ -3078,18 +3088,9 @@ completion-file-name-table
>                ;; Check the predicate, if necessary.
>                (unless (memq pred '(nil file-exists-p))
>                  (let ((comp ())
> -                      (pred
> -                       (if (eq pred 'file-directory-p)
> -                           ;; Brute-force speed up for directory checking:
> -                           ;; Discard strings which don't end in a slash.
> -                           (lambda (s)
> -                             (let ((len (length s)))
> -                               (and (> len 0) (eq (aref s (1- len)) ?/))))
> -                         ;; Must do it the hard (and slow) way.
> -                         pred)))
> -                  (let ((default-directory (expand-file-name realdir)))
> -                    (dolist (tem all)
> -                      (if (funcall pred tem) (push tem comp))))
> +                      (default-directory (expand-file-name realdir)))
> +                  (dolist (tem all)
> +                    (if (funcall should-complete tem) (push tem comp)))
>                    (setq all (nreverse comp))))
>
>                all))))))

> I thought this would make Emacs complete as you want.  But: what files
> should be shown when hitting TAB?  I decided to show only matching
> files, plus all directories (seems logical, since these may contain
> matching files).

> But that gives a bad user experience: When I tried this I thought it
> would not work because completion did not accept an existing empty
> directory.  Then I saw that it actually was not empty.  But it contained only
> plain files, no subdirectories, and TAB displayed nothing.  Quite confusing!

I dug a little more and realized that the IMO unexpected behavior
resides in completing-read itself.  According to the completing-read
docstring, its REQUIRE-MATCH argument can be

- a function, which will be called with the input as the
  argument.  If the function returns a non-nil value, the
  minibuffer is exited with that argument as the value.

I incorrectly assumed that this function would prevent matching items
inside COLLECTION for which the function returns nil.  What it actually
does it accept input which is not part of COLLECTION if the
REQUIRE-MATCH function returns non-nil.  IOW, it doesn't narrow the
potential completion options; it widens them.

For example, given:

(completing-read "Prompt: " '("a" "b") nil
                 (lambda (input)
                   (string= "a" input)))

I expected that the prompt would refuse to complete "b". I was wrong.

Since completing-read is such a fundamental part of Emacs, I doubt it
will be possible to change this behavior.  What do you think about the
attached patch to clarify the completing-read docstring?

Thank you!!

Joseph


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Clarify-completing-read-REQUIRE-MATCH-function-docst.patch

From 10fa6dd5c659bed2b818fb925445cab2cbbb5325 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 3 Oct 2023 14:40:22 -0700
Subject: [PATCH] Clarify completing-read REQUIRE-MATCH function docstring

* src/minibuf.c (Fcompleting_read): Explicitly note that REQUIRE-MATCH
function does not narrow the completion candidates.
---
 src/minibuf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/minibuf.c b/src/minibuf.c
index 58adde1bf66..616be7091ee 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1999,8 +1999,11 @@ REQUIRE-MATCH can take the following values:
   `minibuffer-complete' right before `minibuffer-complete-and-exit'
   and the input is not an element of COLLECTION.
 - a function, which will be called with the input as the
-  argument.  If the function returns a non-nil value, the
-  minibuffer is exited with that argument as the value.
+  argument.  If the function returns a non-nil value or if
+  the input is a member of COLLECTION, the minibuffer is
+  exited with that argument as the value.  If the function
+  returns nil and the input is not a member of COLLECTION,
+  then the user is not allowed to exit.
 - anything else behaves like t except that typing RET does not exit if it
   does non-null completion.
 
-- 
2.41.0


--=-=-=--




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

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


Received: (at 66187) by debbugs.gnu.org; 3 Oct 2023 20:45:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 03 16:45:34 2023
Received: from localhost ([127.0.0.1]:40783 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnmGr-0005PP-QY
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 16:45:34 -0400
Received: from out-210.mta1.migadu.com ([95.215.58.210]:18141)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnmGo-0005PB-HB
 for 66187 <at> debbugs.gnu.org; Tue, 03 Oct 2023 16:45:32 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN> <83y1gpyysv.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696365911;
 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=6GgGRNrp2heHXIgaTjLH3n2cFxOFbze8tdRS8hXib2U=;
 b=eSgz+tbPTf9tW1KIRdOL0FYHmGSQuKl/Hn5pusncjIOAkNhIjwyrYttiGkeIvLglqqmj0d
 xjSuY3TdbE/ezCAoexJNOkjx8Mf0d5BZPmQv5rGupQyg0LbEIozn99Q1YycEMa682aiCc/
 lPlcizFau5Zc1z7h34+XAse+6wQJmic=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 03 Oct 2023 13:43:56 -0700
In-reply-to: <83y1gpyysv.fsf@HIDDEN>
Message-ID: <871qebph9p.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Eli Zaretskii <eliz@HIDDEN> writes:

>> Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org
>> Date: Tue, 26 Sep 2023 17:55:37 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>
>> > Finally, I think the docstring of `read-directory-name' needs to be
>> > updated: it fails to mention that MUSTMATCH can be a function (the
>> > argument is passed directly to `read-file-name').
>>
>> How about the attached patch?
>
> This is okay, except that we do document the other arguments.  So why
> not just copy/paste the description of MUSTMATCH from read-file-name
> to read-directory-name instead?

The read-file-name docstring for MUSTMATCH is lengthy, and duplicating
it will mean that if read-file-name changes, we'll need to remember to
change the docstring of read-directory-name.




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

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


Received: (at 66187) by debbugs.gnu.org; 29 Sep 2023 12:01:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 29 08:01:09 2023
Received: from localhost ([127.0.0.1]:55466 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qmCB7-0003sH-CQ
	for submit <at> debbugs.gnu.org; Fri, 29 Sep 2023 08:01:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38942)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qmCB4-0003re-I3
 for 66187 <at> debbugs.gnu.org; Fri, 29 Sep 2023 08:01: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 1qmCAe-0006Td-Kp; Fri, 29 Sep 2023 08:00:38 -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=FmOBd1hntUUnp1jMQktZgstWsPiIn7UliTMo8vdCcuI=; b=MiEL88PtVjGq
 f/wW5PzA5xYtfZcgV+xr5pzlY9hYF9k0c5MkBNwMGCGjZv0nfeqmIRfz/lNDEVT4vCegQK6beYHoe
 MI8pw41lMAAfdVmtM3O14O9egNMulj6fvqqMHX1b38iD7UUboekptRVe8yD+TBtYhyVTPjHmA4+OQ
 11K3snnfNbiHJPQN0y6X0UJKycpxxjjN44DBaWpd6/DyKrB2OmHZEx8OGfIoz0wdeR9SrIscWW/8d
 94wIcuw/n1Dc4DojQpzisU7d1xztlDPulqDFWd99VeJE5sTqQfZIzSHdgHE51tk9xQgu5BSlb3QEn
 OE06sJloChGaKFKktMr0hw==;
Date: Fri, 29 Sep 2023 15:00:16 +0300
Message-Id: <83y1gpyysv.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
In-Reply-To: <87bkdoh1gy.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a
 function
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66187
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66187 <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 (---)

> Cc: philipk@HIDDEN, 66187 <at> debbugs.gnu.org
> Date: Tue, 26 Sep 2023 17:55:37 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> > Finally, I think the docstring of `read-directory-name' needs to be
> > updated: it fails to mention that MUSTMATCH can be a function (the
> > argument is passed directly to `read-file-name').
> 
> How about the attached patch?

This is okay, except that we do document the other arguments.  So why
not just copy/paste the description of MUSTMATCH from read-file-name
to read-directory-name instead?




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

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


Received: (at submit) by debbugs.gnu.org; 27 Sep 2023 01:44:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 21:44:08 2023
Received: from localhost ([127.0.0.1]:50150 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlJay-00054E-CG
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:44:08 -0400
Received: from lists.gnu.org ([2001:470:142::17]:55652)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qlJaw-00053q-Q2
 for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:44:07 -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 <michael_heerdegen@HIDDEN>)
 id 1qlJad-0002cT-O9
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 21:43:48 -0400
Received: from mout.web.de ([212.227.17.12])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qlJab-0006tw-NC
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 21:43:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695779005; x=1696383805; i=michael_heerdegen@HIDDEN;
 bh=uk5FsPfzwEVEXt5dnheE31v1oUXyfiEeXy/HMI9Zb+A=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=n8GhP5Apeos/mMxTyv0ogzX0y8GwToi0DYDZKN8W00/Xw6YIMrWhRz+AQJDzwgmG96fZU3z4RiE
 Rc8AZ0wMcOdeqQwdQwkRhd6yBTb/QWRYUJ1Ydseykcfad6RZg5EqlJsPnr5ifpeFVJxNmkCOS5Tlk
 ss3r44Uis2q9FcJjBm9omdqhNwyI+HjWM8eaYfFLSaHe82mp03aPy236XhOF8b9dogIzg272Wu94n
 EmkL57/czSq9PwIDnr9az/re3XLVAhgq1qob6V3c5Tdu7Ss0RV2nE/rIKgc9/XGKwZfTMhjyr5sdy
 khpD7PtWG/qPJJmVMK/kglwsCBqi48yp9lrA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Ml46w-1rWVI90vBU-00lYRl; Wed, 27
 Sep 2023 03:43:25 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87bkdoh1gy.fsf@HIDDEN> (Joseph Turner's message of
 "Tue, 26 Sep 2023 17:55:37 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN>
Date: Wed, 27 Sep 2023 03:43:25 +0200
Message-ID: <87h6ngs85e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:xl72ThruC5LxPiyYJV+9RjDLnxrwGCNuea7CJBi/VIFABgvNbYs
 mqCf+ClZViyj3AY5CUk1S3eu5bJ30fRCCeqk3G516ChOIdNSRHu0DqQ2dq7+b0q7AXaqc8U
 Y4XqZ2nt5NDIMj03VHBHHN/J0ljk0I9rbH0yGP+Dh4UZzRwzlStbX6dzMm0fpGcCMth0o/0
 5I6d8z3wTpmDxh3oNcW3w==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:A+ly6Ajqnnw=;4QoLm/0v6FXjNPnd0KsAFoxBJHd
 LumXibD+5YSJhlvFyHfVE6aJ0/2J0rUJrpKk0GBuJ57DG/QZQ2WNOBTXyIpv9M4Uo4LziLshl
 wSnfTZPsVriwv2HjYA7UiUypGyWJWwALkDAUT2E1tANzFqYzYIA76GxjDs+iyH/XWqcDEUKPx
 FPUZzcODazpAo8tVNUFyzN7uMYQHGgRwucjuOx88CMNhg3+jZzG99FesVbm0Xckp8201pWTpo
 aAEYRF+8qeeOrAo6FXZ3HGHai9X1kJHvK2VJhXUSUrFVHlmDLMyF3wIhGL5TvVpE4EZkLYgJx
 7HylqZx06bCqFLe9aUpSJiDbX7/yV6hqDA/RqcXofWdZOC47OYHz0qEDmtSASX417qEzVtcaa
 fVy2ayuqCtiBENTQFkprpj6wTZMq5nF/hM04HyPXWkBbW6H7qVfTSQ6E63h+Zw8nILlLmF8Og
 wpEGMG8Bfamw0zQN0acIXlH8Gir9iZd1MVRqJzhonxSgUvqYFgkC/h1CjeLg26w/0FPPJrzli
 10iDP8BiCWUlFBPW9dwZOmbXcsfGdGwX2cdWt8pqVigbp0x05lat3DbBkcwGWn6ajIkQ4DKYi
 sZUEjkl+tLs4rZF99lurZpsTW9u5aJ0kcnkjmt3mcyrz4yFAc7PnYMAkgbkTHLuekXJWj9i8y
 Kh3eIOX5ZFckbfiut8OpgFaozaHi3NzB6CtW+lQEw3s01pxUTCBQsM5ZFms+fwGFo9zwPNJiN
 ZubiZx8z08sqk1IfS96VM+2aW5nC1wzKSY+/dZAoI4pQ6M5ie/lR+XGZS/WvCOznTFcIOcaiW
 hCn4c2efCYQCuJA99EyyHO5bNxm2mOj5JI24AhTmPHogmMDbcJt0LAsmMtjDuwJ2Nk4snb2hQ
 owkspIyd0eQHdMax++Cn3Dj8iI2rP4BPCnkkRndbnuv+ym9sIGpwftOh5DjzE/nlGhAOaJ4cI
 2N8WVg==
Received-SPF: pass client-ip=212.227.17.12;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.0 (/)

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

Joseph Turner <joseph@HIDDEN> writes:

> > Yes, looks like a bug that this is not possible.  It should be possible
> > to complete directory names that do not match.
>
> I'm happy to work on the bug, if others agree that this change is
> desired.

I had a look and tried this:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=0001-WIP-Bug-66187.patch
Content-Transfer-Encoding: quoted-printable

=46rom ad895d2df5c69e015c2c7eba5116ab2d440e1fbc Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Date: Wed, 27 Sep 2023 03:32:37 +0200
Subject: [PATCH] WIP: Bug#66187

=2D--
 lisp/minibuffer.el | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2120e31775e..79a8786fbac 100644
=2D-- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3061,13 +3061,23 @@ completion-file-name-table
           (funcall (or pred 'file-exists-p) string)))

        (t
-        (let* ((name (file-name-nondirectory string))
+        (let* ((test-directory (lambda (s)
+                                 (let ((len (length s)))
+                                   (and (> len 0) (eq (aref s (1- len)) ?=
/)))))
+               (should-complete
+                (and pred
+                     (if (eq pred 'file-directory-p)
+                         test-directory
+                       (lambda (f)
+                         (or (funcall test-directory f)
+                             (funcall pred f))))))
+               (name (file-name-nondirectory string))
                (specdir (file-name-directory string))
                (realdir (or specdir default-directory)))

           (cond
            ((null action)
-            (let ((comp (file-name-completion name realdir pred)))
+            (let ((comp (file-name-completion name realdir should-complet=
e)))
               (if (stringp comp)
                   (concat specdir comp)
                 comp)))
@@ -3078,18 +3088,9 @@ completion-file-name-table
               ;; Check the predicate, if necessary.
               (unless (memq pred '(nil file-exists-p))
                 (let ((comp ())
-                      (pred
-                       (if (eq pred 'file-directory-p)
-                           ;; Brute-force speed up for directory checking=
:
-                           ;; Discard strings which don't end in a slash.
-                           (lambda (s)
-                             (let ((len (length s)))
-                               (and (> len 0) (eq (aref s (1- len)) ?/)))=
)
-                         ;; Must do it the hard (and slow) way.
-                         pred)))
-                  (let ((default-directory (expand-file-name realdir)))
-                    (dolist (tem all)
-                      (if (funcall pred tem) (push tem comp))))
+                      (default-directory (expand-file-name realdir)))
+                  (dolist (tem all)
+                    (if (funcall should-complete tem) (push tem comp)))
                   (setq all (nreverse comp))))

               all))))))
=2D-
2.39.2


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


I thought this would make Emacs complete as you want.  But: what files
should be shown when hitting TAB?  I decided to show only matching
files, plus all directories (seems logical, since these may contain
matching files).

But that gives a bad user experience: When I tried this I thought it
would not work because completion did not accept an existing empty
directory.  Then I saw that it actually was not empty.  But it contained only
plain files, no subdirectories, and TAB displayed nothing.  Quite confusing!


> How about the attached patch?

| diff --git a/lisp/files.el b/lisp/files.el
| index b72f141c0ee..1fe124848b9 100644
| --- a/lisp/files.el
| +++ b/lisp/files.el
| @@ -817,7 +817,7 @@ non-empty string that was inserted by this function.
|  If the user exits with an empty minibuffer, this function returns
|  an empty string.  (This can happen only if the user erased the
|  pre-inserted contents or if `insert-default-directory' is nil.)
| -Fourth arg MUSTMATCH non-nil means require existing directory's name.
| +Fourth arg MUSTMATCH is passed as-is to `read-file-name', which see.

Ok from my side.

What do others think about all of this?


Thx,

Michael.


--=-=-=--




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

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


Received: (at 66187) by debbugs.gnu.org; 27 Sep 2023 01:43:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 21:43:58 2023
Received: from localhost ([127.0.0.1]:50145 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlJan-00053M-Uu
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:43:58 -0400
Received: from mout.web.de ([212.227.17.12]:40125)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qlJai-000531-V1
 for 66187 <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:43:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695779005; x=1696383805; i=michael_heerdegen@HIDDEN;
 bh=uk5FsPfzwEVEXt5dnheE31v1oUXyfiEeXy/HMI9Zb+A=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=n8GhP5Apeos/mMxTyv0ogzX0y8GwToi0DYDZKN8W00/Xw6YIMrWhRz+AQJDzwgmG96fZU3z4RiE
 Rc8AZ0wMcOdeqQwdQwkRhd6yBTb/QWRYUJ1Ydseykcfad6RZg5EqlJsPnr5ifpeFVJxNmkCOS5Tlk
 ss3r44Uis2q9FcJjBm9omdqhNwyI+HjWM8eaYfFLSaHe82mp03aPy236XhOF8b9dogIzg272Wu94n
 EmkL57/czSq9PwIDnr9az/re3XLVAhgq1qob6V3c5Tdu7Ss0RV2nE/rIKgc9/XGKwZfTMhjyr5sdy
 khpD7PtWG/qPJJmVMK/kglwsCBqi48yp9lrA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Ml46w-1rWVI90vBU-00lYRl; Wed, 27
 Sep 2023 03:43:25 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87bkdoh1gy.fsf@HIDDEN> (Joseph Turner's message of
 "Tue, 26 Sep 2023 17:55:37 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
 <87bkdoh1gy.fsf@HIDDEN>
Date: Wed, 27 Sep 2023 03:43:25 +0200
Message-ID: <87h6ngs85e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:xl72ThruC5LxPiyYJV+9RjDLnxrwGCNuea7CJBi/VIFABgvNbYs
 mqCf+ClZViyj3AY5CUk1S3eu5bJ30fRCCeqk3G516ChOIdNSRHu0DqQ2dq7+b0q7AXaqc8U
 Y4XqZ2nt5NDIMj03VHBHHN/J0ljk0I9rbH0yGP+Dh4UZzRwzlStbX6dzMm0fpGcCMth0o/0
 5I6d8z3wTpmDxh3oNcW3w==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:A+ly6Ajqnnw=;4QoLm/0v6FXjNPnd0KsAFoxBJHd
 LumXibD+5YSJhlvFyHfVE6aJ0/2J0rUJrpKk0GBuJ57DG/QZQ2WNOBTXyIpv9M4Uo4LziLshl
 wSnfTZPsVriwv2HjYA7UiUypGyWJWwALkDAUT2E1tANzFqYzYIA76GxjDs+iyH/XWqcDEUKPx
 FPUZzcODazpAo8tVNUFyzN7uMYQHGgRwucjuOx88CMNhg3+jZzG99FesVbm0Xckp8201pWTpo
 aAEYRF+8qeeOrAo6FXZ3HGHai9X1kJHvK2VJhXUSUrFVHlmDLMyF3wIhGL5TvVpE4EZkLYgJx
 7HylqZx06bCqFLe9aUpSJiDbX7/yV6hqDA/RqcXofWdZOC47OYHz0qEDmtSASX417qEzVtcaa
 fVy2ayuqCtiBENTQFkprpj6wTZMq5nF/hM04HyPXWkBbW6H7qVfTSQ6E63h+Zw8nILlLmF8Og
 wpEGMG8Bfamw0zQN0acIXlH8Gir9iZd1MVRqJzhonxSgUvqYFgkC/h1CjeLg26w/0FPPJrzli
 10iDP8BiCWUlFBPW9dwZOmbXcsfGdGwX2cdWt8pqVigbp0x05lat3DbBkcwGWn6ajIkQ4DKYi
 sZUEjkl+tLs4rZF99lurZpsTW9u5aJ0kcnkjmt3mcyrz4yFAc7PnYMAkgbkTHLuekXJWj9i8y
 Kh3eIOX5ZFckbfiut8OpgFaozaHi3NzB6CtW+lQEw3s01pxUTCBQsM5ZFms+fwGFo9zwPNJiN
 ZubiZx8z08sqk1IfS96VM+2aW5nC1wzKSY+/dZAoI4pQ6M5ie/lR+XGZS/WvCOznTFcIOcaiW
 hCn4c2efCYQCuJA99EyyHO5bNxm2mOj5JI24AhTmPHogmMDbcJt0LAsmMtjDuwJ2Nk4snb2hQ
 owkspIyd0eQHdMax++Cn3Dj8iI2rP4BPCnkkRndbnuv+ym9sIGpwftOh5DjzE/nlGhAOaJ4cI
 2N8WVg==
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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

Joseph Turner <joseph@HIDDEN> writes:

> > Yes, looks like a bug that this is not possible.  It should be possible
> > to complete directory names that do not match.
>
> I'm happy to work on the bug, if others agree that this change is
> desired.

I had a look and tried this:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=0001-WIP-Bug-66187.patch
Content-Transfer-Encoding: quoted-printable

=46rom ad895d2df5c69e015c2c7eba5116ab2d440e1fbc Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Date: Wed, 27 Sep 2023 03:32:37 +0200
Subject: [PATCH] WIP: Bug#66187

=2D--
 lisp/minibuffer.el | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2120e31775e..79a8786fbac 100644
=2D-- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3061,13 +3061,23 @@ completion-file-name-table
           (funcall (or pred 'file-exists-p) string)))

        (t
-        (let* ((name (file-name-nondirectory string))
+        (let* ((test-directory (lambda (s)
+                                 (let ((len (length s)))
+                                   (and (> len 0) (eq (aref s (1- len)) ?=
/)))))
+               (should-complete
+                (and pred
+                     (if (eq pred 'file-directory-p)
+                         test-directory
+                       (lambda (f)
+                         (or (funcall test-directory f)
+                             (funcall pred f))))))
+               (name (file-name-nondirectory string))
                (specdir (file-name-directory string))
                (realdir (or specdir default-directory)))

           (cond
            ((null action)
-            (let ((comp (file-name-completion name realdir pred)))
+            (let ((comp (file-name-completion name realdir should-complet=
e)))
               (if (stringp comp)
                   (concat specdir comp)
                 comp)))
@@ -3078,18 +3088,9 @@ completion-file-name-table
               ;; Check the predicate, if necessary.
               (unless (memq pred '(nil file-exists-p))
                 (let ((comp ())
-                      (pred
-                       (if (eq pred 'file-directory-p)
-                           ;; Brute-force speed up for directory checking=
:
-                           ;; Discard strings which don't end in a slash.
-                           (lambda (s)
-                             (let ((len (length s)))
-                               (and (> len 0) (eq (aref s (1- len)) ?/)))=
)
-                         ;; Must do it the hard (and slow) way.
-                         pred)))
-                  (let ((default-directory (expand-file-name realdir)))
-                    (dolist (tem all)
-                      (if (funcall pred tem) (push tem comp))))
+                      (default-directory (expand-file-name realdir)))
+                  (dolist (tem all)
+                    (if (funcall should-complete tem) (push tem comp)))
                   (setq all (nreverse comp))))

               all))))))
=2D-
2.39.2


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


I thought this would make Emacs complete as you want.  But: what files
should be shown when hitting TAB?  I decided to show only matching
files, plus all directories (seems logical, since these may contain
matching files).

But that gives a bad user experience: When I tried this I thought it
would not work because completion did not accept an existing empty
directory.  Then I saw that it actually was not empty.  But it contained only
plain files, no subdirectories, and TAB displayed nothing.  Quite confusing!


> How about the attached patch?

| diff --git a/lisp/files.el b/lisp/files.el
| index b72f141c0ee..1fe124848b9 100644
| --- a/lisp/files.el
| +++ b/lisp/files.el
| @@ -817,7 +817,7 @@ non-empty string that was inserted by this function.
|  If the user exits with an empty minibuffer, this function returns
|  an empty string.  (This can happen only if the user erased the
|  pre-inserted contents or if `insert-default-directory' is nil.)
| -Fourth arg MUSTMATCH non-nil means require existing directory's name.
| +Fourth arg MUSTMATCH is passed as-is to `read-file-name', which see.

Ok from my side.

What do others think about all of this?


Thx,

Michael.


--=-=-=--




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

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


Received: (at 66187) by debbugs.gnu.org; 27 Sep 2023 01:03:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 21:03:34 2023
Received: from localhost ([127.0.0.1]:50118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlIxi-0003x6-0T
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:03:34 -0400
Received: from out-202.mta0.migadu.com ([91.218.175.202]:30716)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qlIxc-0003wt-W1
 for 66187 <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:03:32 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695776594;
 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=lY4jDIp/TdGOkfJ8bo+8ykV/cng1PutlO25ArFRNpsI=;
 b=EULKiPFk6tM0n4EdPo/05bfa5cR1PHXtZwZPIzOh92qfswMXpJJHgHpZgEswmH95e5/55e
 UCPwVvM4kvVvvmsHToG+9pO5T42YvcRd2m5yR38gDpyHvNSLFSFKG8m4/05I/hK9f9/L4a
 Y3+732Hwaa/ZyofQBRz8mragScbfiYI=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 26 Sep 2023 17:55:37 -0700
In-reply-to: <87msx8sbpv.fsf@HIDDEN>
Message-ID: <87bkdoh1gy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
> Ah - ok, now finally I've understood all the parts.
>
> You want to prompt for a directory that is either empty or not yet
> existing.  But with `read-file-name' you only get either (a) non-empty
> directories accepted as input, or (b) failing completion of existing
> non-empty directories, which makes it impossible to choose a directory
> inside an existing directory.
>
> Yes, looks like a bug that this is not possible.  It should be possible
> to complete directory names that do not match.

I'm happy to work on the bug, if others agree that this change is desired.

> Then the documentation needs to be improved: what exactly is accepted
> when both MUSTMATCH and PREDICATE are specified?

I can improve the docs too, once I have the answer that questions.

> Finally, I think the docstring of `read-directory-name' needs to be
> updated: it fails to mention that MUSTMATCH can be a function (the
> argument is passed directly to `read-file-name').

How about the attached patch?

> Michael.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-MUSTMATCH-description-in-read-directory-name-doc.patch

From e0ea8501af4e0dfd9777879e44a07902f86d1a7e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 26 Sep 2023 18:01:27 -0700
Subject: [PATCH] Fix MUSTMATCH description in read-directory-name docstring

* lisp/files.el (read-directory-name)
---
 lisp/files.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..1fe124848b9 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -817,7 +817,7 @@ non-empty string that was inserted by this function.
 If the user exits with an empty minibuffer, this function returns
 an empty string.  (This can happen only if the user erased the
 pre-inserted contents or if `insert-default-directory' is nil.)
-Fourth arg MUSTMATCH non-nil means require existing directory's name.
+Fourth arg MUSTMATCH is passed as-is to `read-file-name', which see.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-- 
2.41.0


--=-=-=--




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

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


Received: (at submit) by debbugs.gnu.org; 27 Sep 2023 01:03:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 21:03:52 2023
Received: from localhost ([127.0.0.1]:50121 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlIy0-0003xg-E9
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:03:52 -0400
Received: from lists.gnu.org ([2001:470:142::17]:55968)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qlIxw-0003xP-W2
 for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:03:51 -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 <joseph@HIDDEN>)
 id 1qlIxe-0002h5-6n
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 21:03:30 -0400
Received: from out-195.mta0.migadu.com ([2001:41d0:1004:224b::c3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qlIxS-0006th-J3
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 21:03:28 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN> <87msx8sbpv.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695776594;
 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=lY4jDIp/TdGOkfJ8bo+8ykV/cng1PutlO25ArFRNpsI=;
 b=EULKiPFk6tM0n4EdPo/05bfa5cR1PHXtZwZPIzOh92qfswMXpJJHgHpZgEswmH95e5/55e
 UCPwVvM4kvVvvmsHToG+9pO5T42YvcRd2m5yR38gDpyHvNSLFSFKG8m4/05I/hK9f9/L4a
 Y3+732Hwaa/ZyofQBRz8mragScbfiYI=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 26 Sep 2023 17:55:37 -0700
In-reply-to: <87msx8sbpv.fsf@HIDDEN>
Message-ID: <87bkdoh1gy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=2001:41d0:1004:224b::c3;
 envelope-from=joseph@HIDDEN; helo=out-195.mta0.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.1 (/)

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


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
> Ah - ok, now finally I've understood all the parts.
>
> You want to prompt for a directory that is either empty or not yet
> existing.  But with `read-file-name' you only get either (a) non-empty
> directories accepted as input, or (b) failing completion of existing
> non-empty directories, which makes it impossible to choose a directory
> inside an existing directory.
>
> Yes, looks like a bug that this is not possible.  It should be possible
> to complete directory names that do not match.

I'm happy to work on the bug, if others agree that this change is desired.

> Then the documentation needs to be improved: what exactly is accepted
> when both MUSTMATCH and PREDICATE are specified?

I can improve the docs too, once I have the answer that questions.

> Finally, I think the docstring of `read-directory-name' needs to be
> updated: it fails to mention that MUSTMATCH can be a function (the
> argument is passed directly to `read-file-name').

How about the attached patch?

> Michael.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-MUSTMATCH-description-in-read-directory-name-doc.patch

From e0ea8501af4e0dfd9777879e44a07902f86d1a7e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 26 Sep 2023 18:01:27 -0700
Subject: [PATCH] Fix MUSTMATCH description in read-directory-name docstring

* lisp/files.el (read-directory-name)
---
 lisp/files.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..1fe124848b9 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -817,7 +817,7 @@ non-empty string that was inserted by this function.
 If the user exits with an empty minibuffer, this function returns
 an empty string.  (This can happen only if the user erased the
 pre-inserted contents or if `insert-default-directory' is nil.)
-Fourth arg MUSTMATCH non-nil means require existing directory's name.
+Fourth arg MUSTMATCH is passed as-is to `read-file-name', which see.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-- 
2.41.0


--=-=-=--




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

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


Received: (at 66187) by debbugs.gnu.org; 27 Sep 2023 00:26:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 20:26:44 2023
Received: from localhost ([127.0.0.1]:50087 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlIO4-0002rh-ID
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 20:26:44 -0400
Received: from mout.web.de ([212.227.15.3]:53583)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qlIO1-0002rQ-KD
 for 66187 <at> debbugs.gnu.org; Tue, 26 Sep 2023 20:26:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695774380; x=1696379180; i=michael_heerdegen@HIDDEN;
 bh=4cLv8dTj1pcJCtXSwoZU3YcVjN1zwbsBEuZgtNbE1rc=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=Rd3ULVm2PfcQpjzZFO5C94Xm1SgKqjSIK7pQuyoTe2JFQZuTiLpAcP8fU0CTRh/f7Z9kks9ILMj
 SW4exTFLPf3/18l4S4+AwCi7Bd+D6yS9JADQcZW7/PQk8vhhk8zcISm30g1AgJiy0ab1U9SHHzZky
 TNu4GJM8v6zv395Rl/XT5CCKtnvBR6EtSZJSmHzGaoMT80YX6mvO8bc1VcRHW1d+l/LOEcZY0KRs/
 mpx+mSA9L1DuXfc58+6DzLtdS4aUKF7xJGzTsSsySA7ybQh8YT9rggH1rPVOxaVg4j3Rx4uhOJQ+b
 spQmZ0u6XBYBKRM/kKbciWqwdLNsJd0jQEOg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MYu16-1r7Aqa22lM-00V9bi; Wed, 27
 Sep 2023 02:26:20 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87v8bx48ww.fsf@HIDDEN> (Joseph Turner's message of
 "Tue, 26 Sep 2023 01:37:12 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN>
Date: Wed, 27 Sep 2023 02:26:20 +0200
Message-ID: <87msx8sbpv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:4UMJSasukcNGwwePgOL2hI9RJLYDfQDXip+Tp1vh+ie2HPrhRTN
 PWQCtFfGyPd6cFN1XamAMLTKFtjiACBJ1lC5tF/TJhFTlAY2Xk2QKpqhsXoyqEQ7Bt7+oPN
 ee/gOw9hYx8ruqyIN6GTG4T6e3DhRmkupett7AQRqIdXGdf/oWNubtxVmszHErEOUKNbK6z
 WLTBqWOnOk0JaktM3YKuA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:EPNIBn4lK3M=;ug2xaVrpDZJJTUJKPAisKvZN+eC
 5DZcb+g4Xl9ni3+uagKNqE0hvVuiNu0/4PGwMCL/M+TvSKhp7SiszfQi0x0hHeFgNR1t7cuYQ
 nUFKkC0g3g2A4BaYaDyK7H87bpgkY0G6Ffz7N9DKb9YaO7euTyPWPFy7xMVQQcSARYGOYc2kZ
 R684GvD1I3dvTxV0b2n04WuFC1dWtuH4ibfIDU4mGKk6MeAaGnRPuybJYua7E5wpQ8LbDdbs5
 LSg5B0dDco8ZqK9SJSD8wV0mHT/gBjhVgcdzo7521nRMjIoHdmSOnixBlbo2EC2pUzAmPr9Gc
 mypj5BeZ2p9nYfM+evYCzGWs8cIcWPf0OD+OOWKrRvHbhokc7v/vfstpxTx4O2ddNABlyAIpq
 njdTF1Ah7vvg5LOsfeb3jPoJo85YLH3QjcLdOGhmNZggsNOqcdG3FgKMzoGNkpQYWHgWyk8z7
 SmJliVL4IhsjDkIe9B9VC8kIv4zB/VjrvaF6fNAsOKCaApMioJgXQOSmm3n5EoIcsMSkDZLSb
 vOWsl1LvrHIm2keRNziAiGljaxJWr6b+cuJMdl3vTWIP84NCNlUmT/UC98bcf8xQIA8f7P6hM
 pmhabGuChkvLvvzMECCkNf5OCcE/WHRak6OUdg7bxfyZaKh6el2X+6TedzjW5nR+2F8dsbTXR
 IfC+PaCaEdZU9bZ6KYxuaQVgBRMs58Rq575uF+ZLys0+HmLjoC3SuokKZeDKevnQcYlBOMtzL
 FU9K8M8r6mG71FkmCl0r2G1q/9LBwmpeXqtJBU0SqRDtCZ9hQLW+N/HzbfVYA2IA+7NiP5OQg
 R8Y0GBlhJEgAT1vSFeQdDuEQFRVgmiXhyYDZ99RST805JcTIfMd1UCB25tIH+QCN3RCI7qFZE
 VXxhTvNexSXaE7HY5R8r905LCrPNsWKTOmQlEys7jqL186beLtI5iJs3HaqPtjGfAPr5E46wG
 1/HvsLHakhEOyzrr7cm3WAjwGVE=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Joseph Turner <joseph@HIDDEN> writes:

> Thank you! What I was hoping for may not have a clean solution:
>
> - the completions buffer displays and allows tab-completion for all
>   directories, empty or not, then
> - upon pressing RET on a non-empty directory, the "[Match required]"
>   message appears. Only upon pressing RET on an empty directory does
>   completion succeed.

Ah - ok, now finally I've understood all the parts.

You want to prompt for a directory that is either empty or not yet
existing.  But with `read-file-name' you only get either (a) non-empty
directories accepted as input, or (b) failing completion of existing
non-empty directories, which makes it impossible to choose a directory
inside an existing directory.

Yes, looks like a bug that this is not possible.  It should be possible
to complete directory names that do not match.

Then the documentation needs to be improved: what exactly is accepted
when both MUSTMATCH and PREDICATE are specified?

Finally, I think the docstring of `read-directory-name' needs to be
updated: it fails to mention that MUSTMATCH can be a function (the
argument is passed directly to `read-file-name').


Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 27 Sep 2023 00:26:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 20:26:56 2023
Received: from localhost ([127.0.0.1]:50090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlIOF-0002s7-Rd
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 20:26:56 -0400
Received: from lists.gnu.org ([2001:470:142::17]:39016)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qlIOE-0002rr-1I
 for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 20:26:54 -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 <michael_heerdegen@HIDDEN>)
 id 1qlINu-0005D4-4c
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 20:26:34 -0400
Received: from mout.web.de ([212.227.15.3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qlINs-0002r3-De
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 20:26:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695774380; x=1696379180; i=michael_heerdegen@HIDDEN;
 bh=4cLv8dTj1pcJCtXSwoZU3YcVjN1zwbsBEuZgtNbE1rc=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=Rd3ULVm2PfcQpjzZFO5C94Xm1SgKqjSIK7pQuyoTe2JFQZuTiLpAcP8fU0CTRh/f7Z9kks9ILMj
 SW4exTFLPf3/18l4S4+AwCi7Bd+D6yS9JADQcZW7/PQk8vhhk8zcISm30g1AgJiy0ab1U9SHHzZky
 TNu4GJM8v6zv395Rl/XT5CCKtnvBR6EtSZJSmHzGaoMT80YX6mvO8bc1VcRHW1d+l/LOEcZY0KRs/
 mpx+mSA9L1DuXfc58+6DzLtdS4aUKF7xJGzTsSsySA7ybQh8YT9rggH1rPVOxaVg4j3Rx4uhOJQ+b
 spQmZ0u6XBYBKRM/kKbciWqwdLNsJd0jQEOg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MYu16-1r7Aqa22lM-00V9bi; Wed, 27
 Sep 2023 02:26:20 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87v8bx48ww.fsf@HIDDEN> (Joseph Turner's message of
 "Tue, 26 Sep 2023 01:37:12 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
 <87v8bx48ww.fsf@HIDDEN>
Date: Wed, 27 Sep 2023 02:26:20 +0200
Message-ID: <87msx8sbpv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:4UMJSasukcNGwwePgOL2hI9RJLYDfQDXip+Tp1vh+ie2HPrhRTN
 PWQCtFfGyPd6cFN1XamAMLTKFtjiACBJ1lC5tF/TJhFTlAY2Xk2QKpqhsXoyqEQ7Bt7+oPN
 ee/gOw9hYx8ruqyIN6GTG4T6e3DhRmkupett7AQRqIdXGdf/oWNubtxVmszHErEOUKNbK6z
 WLTBqWOnOk0JaktM3YKuA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:EPNIBn4lK3M=;ug2xaVrpDZJJTUJKPAisKvZN+eC
 5DZcb+g4Xl9ni3+uagKNqE0hvVuiNu0/4PGwMCL/M+TvSKhp7SiszfQi0x0hHeFgNR1t7cuYQ
 nUFKkC0g3g2A4BaYaDyK7H87bpgkY0G6Ffz7N9DKb9YaO7euTyPWPFy7xMVQQcSARYGOYc2kZ
 R684GvD1I3dvTxV0b2n04WuFC1dWtuH4ibfIDU4mGKk6MeAaGnRPuybJYua7E5wpQ8LbDdbs5
 LSg5B0dDco8ZqK9SJSD8wV0mHT/gBjhVgcdzo7521nRMjIoHdmSOnixBlbo2EC2pUzAmPr9Gc
 mypj5BeZ2p9nYfM+evYCzGWs8cIcWPf0OD+OOWKrRvHbhokc7v/vfstpxTx4O2ddNABlyAIpq
 njdTF1Ah7vvg5LOsfeb3jPoJo85YLH3QjcLdOGhmNZggsNOqcdG3FgKMzoGNkpQYWHgWyk8z7
 SmJliVL4IhsjDkIe9B9VC8kIv4zB/VjrvaF6fNAsOKCaApMioJgXQOSmm3n5EoIcsMSkDZLSb
 vOWsl1LvrHIm2keRNziAiGljaxJWr6b+cuJMdl3vTWIP84NCNlUmT/UC98bcf8xQIA8f7P6hM
 pmhabGuChkvLvvzMECCkNf5OCcE/WHRak6OUdg7bxfyZaKh6el2X+6TedzjW5nR+2F8dsbTXR
 IfC+PaCaEdZU9bZ6KYxuaQVgBRMs58Rq575uF+ZLys0+HmLjoC3SuokKZeDKevnQcYlBOMtzL
 FU9K8M8r6mG71FkmCl0r2G1q/9LBwmpeXqtJBU0SqRDtCZ9hQLW+N/HzbfVYA2IA+7NiP5OQg
 R8Y0GBlhJEgAT1vSFeQdDuEQFRVgmiXhyYDZ99RST805JcTIfMd1UCB25tIH+QCN3RCI7qFZE
 VXxhTvNexSXaE7HY5R8r905LCrPNsWKTOmQlEys7jqL186beLtI5iJs3HaqPtjGfAPr5E46wG
 1/HvsLHakhEOyzrr7cm3WAjwGVE=
Received-SPF: pass client-ip=212.227.15.3;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=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
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.0 (/)

Joseph Turner <joseph@HIDDEN> writes:

> Thank you! What I was hoping for may not have a clean solution:
>
> - the completions buffer displays and allows tab-completion for all
>   directories, empty or not, then
> - upon pressing RET on a non-empty directory, the "[Match required]"
>   message appears. Only upon pressing RET on an empty directory does
>   completion succeed.

Ah - ok, now finally I've understood all the parts.

You want to prompt for a directory that is either empty or not yet
existing.  But with `read-file-name' you only get either (a) non-empty
directories accepted as input, or (b) failing completion of existing
non-empty directories, which makes it impossible to choose a directory
inside an existing directory.

Yes, looks like a bug that this is not possible.  It should be possible
to complete directory names that do not match.

Then the documentation needs to be improved: what exactly is accepted
when both MUSTMATCH and PREDICATE are specified?

Finally, I think the docstring of `read-directory-name' needs to be
updated: it fails to mention that MUSTMATCH can be a function (the
argument is passed directly to `read-file-name').


Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 26 Sep 2023 08:49:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 04:49:08 2023
Received: from localhost ([127.0.0.1]:47220 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ql3ki-0005V0-AK
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 04:49:08 -0400
Received: from lists.gnu.org ([2001:470:142::17]:57088)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1ql3kf-0005UF-TL
 for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 04:49:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1ql3kK-0004kO-5F
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 04:48:45 -0400
Received: from out-210.mta1.migadu.com ([95.215.58.210])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1ql3kG-0006to-6S
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 04:48:42 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695718115;
 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=sVvKxRMEbwze5zrSnl7z+YdobUyjhIsxZZJcajSU2SM=;
 b=IaAgNWbgovrEQspfFMMw6tlU/uL1OzXuuyYYFRt4dUIKCQMcAV1kPFPB0D82z/nWNsXEfn
 sO0M7M7Jho7rYLEz0MBzvz9b1B9bhtJg+bFovXAwfrE0/tXzfQec+HS70i4R2EQgWznq08
 wBzaX68DOcsohmLKCZ0IojddKDGfEgE=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 26 Sep 2023 01:37:12 -0700
In-reply-to: <87pm260wh9.fsf@HIDDEN>
Message-ID: <87v8bx48ww.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.210;
 envelope-from=joseph@HIDDEN; helo=out-210.mta1.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.1 (/)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> AFAIU the algorithm
> works like this: first it's checked whether a completion is allowed (by
> checking whether it's the name of an existing file and consulting
> PREDICATE when specified).  Only when it is not allowed we check whether
> MUSTMATCH declares it acceptable.

Thank you!! That makes sense now.

> This is not really explained in the docstring, however.
>
> In your example, the default-directory is the name of an existing file,
> so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
> fulfilled, so it's accepted as input.
>
> If I guess correctly I think you want something like this:
>
> #+begin_src emacs-lisp
> (let ((acceptable-p (lambda (filename)
>                       (and (file-directory-p filename)
>                            (directory-empty-p filename)))))
>   (read-file-name "Clone into new or empty directory: " nil nil
>                   (lambda (filename)
>                     (if (file-exists-p filename)
>                         (funcall acceptable-p filename)
>                       t))
>                   nil
>                   acceptable-p))
> #+end_src
>
> Does that come close?

Thank you! What I was hoping for may not have a clean solution:

- the completions buffer displays and allows tab-completion for all
  directories, empty or not, then
- upon pressing RET on a non-empty directory, the "[Match required]"
  message appears. Only upon pressing RET on an empty directory does
  completion succeed.

If this cannot be accomplished elegantly, I'll consider other designs
for the interactive prompt in package-vc-checkout.

Thanks!!

Joseph





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

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


Received: (at 66187) by debbugs.gnu.org; 26 Sep 2023 08:48:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 04:48:54 2023
Received: from localhost ([127.0.0.1]:47216 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ql3kT-0005Th-Oi
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 04:48:54 -0400
Received: from out-190.mta1.migadu.com ([2001:41d0:203:375::be]:50441)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1ql3kQ-0005T7-Ul
 for 66187 <at> debbugs.gnu.org; Tue, 26 Sep 2023 04:48:52 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN> <87pm260wh9.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695718115;
 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=sVvKxRMEbwze5zrSnl7z+YdobUyjhIsxZZJcajSU2SM=;
 b=IaAgNWbgovrEQspfFMMw6tlU/uL1OzXuuyYYFRt4dUIKCQMcAV1kPFPB0D82z/nWNsXEfn
 sO0M7M7Jho7rYLEz0MBzvz9b1B9bhtJg+bFovXAwfrE0/tXzfQec+HS70i4R2EQgWznq08
 wBzaX68DOcsohmLKCZ0IojddKDGfEgE=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Tue, 26 Sep 2023 01:37:12 -0700
In-reply-to: <87pm260wh9.fsf@HIDDEN>
Message-ID: <87v8bx48ww.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> AFAIU the algorithm
> works like this: first it's checked whether a completion is allowed (by
> checking whether it's the name of an existing file and consulting
> PREDICATE when specified).  Only when it is not allowed we check whether
> MUSTMATCH declares it acceptable.

Thank you!! That makes sense now.

> This is not really explained in the docstring, however.
>
> In your example, the default-directory is the name of an existing file,
> so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
> fulfilled, so it's accepted as input.
>
> If I guess correctly I think you want something like this:
>
> #+begin_src emacs-lisp
> (let ((acceptable-p (lambda (filename)
>                       (and (file-directory-p filename)
>                            (directory-empty-p filename)))))
>   (read-file-name "Clone into new or empty directory: " nil nil
>                   (lambda (filename)
>                     (if (file-exists-p filename)
>                         (funcall acceptable-p filename)
>                       t))
>                   nil
>                   acceptable-p))
> #+end_src
>
> Does that come close?

Thank you! What I was hoping for may not have a clean solution:

- the completions buffer displays and allows tab-completion for all
  directories, empty or not, then
- upon pressing RET on a non-empty directory, the "[Match required]"
  message appears. Only upon pressing RET on an empty directory does
  completion succeed.

If this cannot be accomplished elegantly, I'll consider other designs
for the interactive prompt in package-vc-checkout.

Thanks!!

Joseph





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

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


Received: (at 66187) by debbugs.gnu.org; 25 Sep 2023 21:33:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 25 17:33:38 2023
Received: from localhost ([127.0.0.1]:46831 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qktD0-0000lT-AR
	for submit <at> debbugs.gnu.org; Mon, 25 Sep 2023 17:33:38 -0400
Received: from mout.web.de ([212.227.17.12]:33983)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qktCv-0000l4-3H
 for 66187 <at> debbugs.gnu.org; Mon, 25 Sep 2023 17:33:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695677586; x=1696282386; i=michael_heerdegen@HIDDEN;
 bh=wEVA881m+8MjEJSM8uFOgochWNhduSqHLIbqiGMkhc8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=at0pRGWr5+2/iAbR24pfAoHQPU8tFCwlp1/uH61MoVA/v/JMXLGqp6XSZAXaNcxyHOOTSZQb9s4
 S6offFhqWVri9rKINcSk0AJIYfUJm3flib2t0unwzq0DDfAxHALpyugRwu+Uhe88hXkweo9SAIV+l
 Z+3Gx50vKa+vLXvEHPqLHXoPbJq0Xxip2MpPBZbz+XO5uDfI8lg6xSOOjNbiF9MyFarPfow4Z+Nm2
 +k1PGvZh00VtAx8cM9xCTkFwVSwWrgPm9YhPAs/dCwVVBEBluVfXGFNYVBahVL7q5r9OC9kxtnmug
 OOcQ7Y90VR4+VlT3p4EMI5vS4bWeXBQ5GmQA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N1d7i-1rmR5e2JmC-011tlh; Mon, 25
 Sep 2023 23:33:06 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <875y3yx221.fsf@HIDDEN> (Joseph Turner's message of
 "Sun, 24 Sep 2023 22:12:18 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN>
Date: Mon, 25 Sep 2023 23:33:06 +0200
Message-ID: <87pm260wh9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:qLA5JiI6yrFvqrMNn+omak2nDTqz4SU6WIOFC4BdHBt31tIyLOn
 5177JOu9l2KHnzCYG1mhK4c/+GPZRmv2ph8h8Cm8MAfxQGo6KxuJHJetfYEV6T7LU8jAuw9
 D1KIPCZRSAqABPgOqpS0RBw0gYAZ5bgyvRsWOA3ad9DiD4fxuGfxVEIY1gn0KMTy1eMN7rc
 0spw79TuYCTQrmn1AgoMA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:elVqmbkcJAs=;aGC3cZIWCldaf5Ag3uphhlf3Xxl
 Qw8jv6xj2akB6u58GazwNFh7xcyFL+60f6bNVFZ8k9ppJXFJm21TeVLp79MqktBXqta/LDqvg
 /XanQmI3SWNTE7CST26sW1bkrfC5Rp2LRezc16CPvfl8gpXOBC8pyjqBoVAZ8vZqgrQCQ4E0x
 beL/JRAYLJOwdOfCcCwOPEWATtfD9i61FVn5peq6MTsuyjUGwlShKoLgCjG65iYCWki6CxfEZ
 sq8ysebUcXUIsx+XUaQB0B55r852x0iEIeEWzwTDXGJ4L8NXrsAM8//wIb2f/2cwu+5CWEJe9
 U+OWAbhw83aAmkJq8qCrifdUUbmUzcgLC+lb2F9EL9jFftLVpegD8CGKaWc+w/zJDnmg9jQWT
 AvrgxRGYZZDPZmiQNrxafw/UsIzFaDHOJ5QtNxIdGxSCxTpMAyhkHPNa1aIdNMYy0ZW7EP8yF
 ZT82kx8H/ia9OQ+1AmzCb96EAVLhgjzvE90eUduk27so6okYdx4laq6G04qLD7jbTk7ZxybL+
 MmhRkC4xn+2fArKbwGqxGVp/XVpfCwf8ORwWyMf266tOOzsN3Y6tYMErV7ly+nmot9QxZirOl
 maI8rSk4bndwCMLaOnVHPkqKHl1TOcqxnAzCby+2OkEGZmJKghewYEjUK8vf6CLfXzGJ1inEr
 XT1vKlHR3d9DwbOGhj6FlgKtcPL48jkzERh0V/o5Ksvf4BAlvpGDDvS5W7KCH3e3S36x1hcy1
 iZlPmMWyih2/50NZ2eTeEs11/uZ5QJp/GWZ6Qhq0nOskak5BW6Xyfqy+OH8fYI4wTaz3YznQZ
 CKjSUlHprjC1sBSqyaB305fG2BYU5VQ556BlULTJsr82hcUHYOE69iQhwKWnJWxFancG7GAsZ
 l+jEguPmVMU4bpnqNDXjdSVfWXr2F82ynu2TJaCcXF7LLTc0EaWl7VICb43qtDLim0HClbiOY
 k8eLgw==
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Joseph Turner <joseph@HIDDEN> writes:

> (mkdir "/tmp/foo" t)
> (with-temp-buffer
>   (write-file "/tmp/foo/bar"))
> (setq default-directory "/tmp/foo/")
> (read-file-name "Clone into new or empty directory: " nil nil
>                 (lambda (filename)
>                   (or (not (file-exists-p filename))
>                       (directory-empty-p filename)))
>                 nil
>                 (lambda (filename)
>                   (file-directory-p filename)))
>
> The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I
> immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/"
> (which exists and is not empty) instead of saying "[Match required]".
>
> Are you able to reproduce this on your machine?

Yes, I see the same.  But I think it's expected.  AFAIU the algorithm
works like this: first it's checked whether a completion is allowed (by
checking whether it's the name of an existing file and consulting
PREDICATE when specified).  Only when it is not allowed we check whether
MUSTMATCH declares it acceptable.

This is not really explained in the docstring, however.

In your example, the default-directory is the name of an existing file,
so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
fulfilled, so it's accepted as input.

If I guess correctly I think you want something like this:

#+begin_src emacs-lisp
(let ((acceptable-p (lambda (filename)
                      (and (file-directory-p filename)
                           (directory-empty-p filename)))))
  (read-file-name "Clone into new or empty directory: " nil nil
                  (lambda (filename)
                    (if (file-exists-p filename)
                        (funcall acceptable-p filename)
                      t))
                  nil
                  acceptable-p))
#+end_src

Does that come close?


Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 25 Sep 2023 21:33:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 25 17:33:48 2023
Received: from localhost ([127.0.0.1]:46834 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qktD9-0000ls-MK
	for submit <at> debbugs.gnu.org; Mon, 25 Sep 2023 17:33:47 -0400
Received: from lists.gnu.org ([2001:470:142::17]:33330)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qktD7-0000lf-JW
 for submit <at> debbugs.gnu.org; Mon, 25 Sep 2023 17:33:46 -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 <michael_heerdegen@HIDDEN>)
 id 1qktCp-0002T0-NJ
 for bug-gnu-emacs@HIDDEN; Mon, 25 Sep 2023 17:33:27 -0400
Received: from mout.web.de ([212.227.17.12])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qktCn-0007CZ-JO
 for bug-gnu-emacs@HIDDEN; Mon, 25 Sep 2023 17:33:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695677586; x=1696282386; i=michael_heerdegen@HIDDEN;
 bh=wEVA881m+8MjEJSM8uFOgochWNhduSqHLIbqiGMkhc8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=at0pRGWr5+2/iAbR24pfAoHQPU8tFCwlp1/uH61MoVA/v/JMXLGqp6XSZAXaNcxyHOOTSZQb9s4
 S6offFhqWVri9rKINcSk0AJIYfUJm3flib2t0unwzq0DDfAxHALpyugRwu+Uhe88hXkweo9SAIV+l
 Z+3Gx50vKa+vLXvEHPqLHXoPbJq0Xxip2MpPBZbz+XO5uDfI8lg6xSOOjNbiF9MyFarPfow4Z+Nm2
 +k1PGvZh00VtAx8cM9xCTkFwVSwWrgPm9YhPAs/dCwVVBEBluVfXGFNYVBahVL7q5r9OC9kxtnmug
 OOcQ7Y90VR4+VlT3p4EMI5vS4bWeXBQ5GmQA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N1d7i-1rmR5e2JmC-011tlh; Mon, 25
 Sep 2023 23:33:06 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <875y3yx221.fsf@HIDDEN> (Joseph Turner's message of
 "Sun, 24 Sep 2023 22:12:18 -0700")
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
 <875y3yx221.fsf@HIDDEN>
Date: Mon, 25 Sep 2023 23:33:06 +0200
Message-ID: <87pm260wh9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:qLA5JiI6yrFvqrMNn+omak2nDTqz4SU6WIOFC4BdHBt31tIyLOn
 5177JOu9l2KHnzCYG1mhK4c/+GPZRmv2ph8h8Cm8MAfxQGo6KxuJHJetfYEV6T7LU8jAuw9
 D1KIPCZRSAqABPgOqpS0RBw0gYAZ5bgyvRsWOA3ad9DiD4fxuGfxVEIY1gn0KMTy1eMN7rc
 0spw79TuYCTQrmn1AgoMA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:elVqmbkcJAs=;aGC3cZIWCldaf5Ag3uphhlf3Xxl
 Qw8jv6xj2akB6u58GazwNFh7xcyFL+60f6bNVFZ8k9ppJXFJm21TeVLp79MqktBXqta/LDqvg
 /XanQmI3SWNTE7CST26sW1bkrfC5Rp2LRezc16CPvfl8gpXOBC8pyjqBoVAZ8vZqgrQCQ4E0x
 beL/JRAYLJOwdOfCcCwOPEWATtfD9i61FVn5peq6MTsuyjUGwlShKoLgCjG65iYCWki6CxfEZ
 sq8ysebUcXUIsx+XUaQB0B55r852x0iEIeEWzwTDXGJ4L8NXrsAM8//wIb2f/2cwu+5CWEJe9
 U+OWAbhw83aAmkJq8qCrifdUUbmUzcgLC+lb2F9EL9jFftLVpegD8CGKaWc+w/zJDnmg9jQWT
 AvrgxRGYZZDPZmiQNrxafw/UsIzFaDHOJ5QtNxIdGxSCxTpMAyhkHPNa1aIdNMYy0ZW7EP8yF
 ZT82kx8H/ia9OQ+1AmzCb96EAVLhgjzvE90eUduk27so6okYdx4laq6G04qLD7jbTk7ZxybL+
 MmhRkC4xn+2fArKbwGqxGVp/XVpfCwf8ORwWyMf266tOOzsN3Y6tYMErV7ly+nmot9QxZirOl
 maI8rSk4bndwCMLaOnVHPkqKHl1TOcqxnAzCby+2OkEGZmJKghewYEjUK8vf6CLfXzGJ1inEr
 XT1vKlHR3d9DwbOGhj6FlgKtcPL48jkzERh0V/o5Ksvf4BAlvpGDDvS5W7KCH3e3S36x1hcy1
 iZlPmMWyih2/50NZ2eTeEs11/uZ5QJp/GWZ6Qhq0nOskak5BW6Xyfqy+OH8fYI4wTaz3YznQZ
 CKjSUlHprjC1sBSqyaB305fG2BYU5VQ556BlULTJsr82hcUHYOE69iQhwKWnJWxFancG7GAsZ
 l+jEguPmVMU4bpnqNDXjdSVfWXr2F82ynu2TJaCcXF7LLTc0EaWl7VICb43qtDLim0HClbiOY
 k8eLgw==
Received-SPF: pass client-ip=212.227.17.12;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.0 (/)

Joseph Turner <joseph@HIDDEN> writes:

> (mkdir "/tmp/foo" t)
> (with-temp-buffer
>   (write-file "/tmp/foo/bar"))
> (setq default-directory "/tmp/foo/")
> (read-file-name "Clone into new or empty directory: " nil nil
>                 (lambda (filename)
>                   (or (not (file-exists-p filename))
>                       (directory-empty-p filename)))
>                 nil
>                 (lambda (filename)
>                   (file-directory-p filename)))
>
> The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I
> immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/"
> (which exists and is not empty) instead of saying "[Match required]".
>
> Are you able to reproduce this on your machine?

Yes, I see the same.  But I think it's expected.  AFAIU the algorithm
works like this: first it's checked whether a completion is allowed (by
checking whether it's the name of an existing file and consulting
PREDICATE when specified).  Only when it is not allowed we check whether
MUSTMATCH declares it acceptable.

This is not really explained in the docstring, however.

In your example, the default-directory is the name of an existing file,
so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
fulfilled, so it's accepted as input.

If I guess correctly I think you want something like this:

#+begin_src emacs-lisp
(let ((acceptable-p (lambda (filename)
                      (and (file-directory-p filename)
                           (directory-empty-p filename)))))
  (read-file-name "Clone into new or empty directory: " nil nil
                  (lambda (filename)
                    (if (file-exists-p filename)
                        (funcall acceptable-p filename)
                      t))
                  nil
                  acceptable-p))
#+end_src

Does that come close?


Michael.




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

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


Received: (at 66187) by debbugs.gnu.org; 25 Sep 2023 05:19:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 25 01:19:41 2023
Received: from localhost ([127.0.0.1]:43911 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qke0T-0001hT-7C
	for submit <at> debbugs.gnu.org; Mon, 25 Sep 2023 01:19:41 -0400
Received: from out-202.mta1.migadu.com ([2001:41d0:203:375::ca]:61924)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qke0Q-0001hF-68
 for 66187 <at> debbugs.gnu.org; Mon, 25 Sep 2023 01:19:39 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695619162;
 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=DpKvFXlK3Vw32LYUlt20JNit00C8Y/h3Lj5hz9CFNEM=;
 b=NfL8Va7M+ZnFXY9Zl0NjrD4eOVOCNR4tzONsXrLx4yIVhfxH5T0hIn3oU3Ol192TKXc0IH
 Ktw6LK3XIblhWOU0R7uqQ6/BU5xiwzPxf7LnCV0vXHL7o2aK8jED22vMUEpoZ/clet+A3V
 y5JMi+hpeMKdBh73FkpuKZ+JDD/ICjY=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Sun, 24 Sep 2023 22:12:18 -0700
In-reply-to: <87bkdq3nw6.fsf@HIDDEN>
Message-ID: <875y3yx221.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66187
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Thanks for your help!!

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> Would someone kindly explain the intended behavior here?
>
> I don't know, but I would expect that when the MUST-MATCH predicate
> fails the behavior is the same as with MUST-MATCH t, and when it
> succeeds, the behavior is like MUST-MATCH nil.  Quite simple I think.
> Do you see something different?

Yes. In emacs -Q:

(mkdir "/tmp/foo" t)
(with-temp-buffer
  (write-file "/tmp/foo/bar"))
(setq default-directory "/tmp/foo/")
(read-file-name "Clone into new or empty directory: " nil nil
                (lambda (filename)
                  (or (not (file-exists-p filename))
                      (directory-empty-p filename)))
                nil
                (lambda (filename)
                  (file-directory-p filename)))

The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I
immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/"
(which exists and is not empty) instead of saying "[Match required]".

Are you able to reproduce this on your machine?

> Hmm - or, maybe the confusion is about the behavior for the members of
> the collection?  With other words, whether the argument can be used to
> restrict which existing files are matched, vs. whether it can only be
> used to limit what additionally matches?  AFAIU the latter is the case -
> existing files always match.
>
>> This issue originally came up in this thread about package-vc-checkout:
>> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@HIDDEN/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf
>
> I didn't understand the "this erroneously returns the default filename"
> part.  What default filename is returned?

Does my above comment answer this question?

Thank you!!

Joseph





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

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


Received: (at submit) by debbugs.gnu.org; 25 Sep 2023 05:19:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 25 01:19:51 2023
Received: from localhost ([127.0.0.1]:43914 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qke0c-0001hq-KU
	for submit <at> debbugs.gnu.org; Mon, 25 Sep 2023 01:19:50 -0400
Received: from lists.gnu.org ([2001:470:142::17]:48020)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qke0Y-0001hR-3z
 for submit <at> debbugs.gnu.org; Mon, 25 Sep 2023 01:19:48 -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 <joseph@HIDDEN>)
 id 1qke0G-000438-2C
 for bug-gnu-emacs@HIDDEN; Mon, 25 Sep 2023 01:19:28 -0400
Received: from out-190.mta1.migadu.com ([95.215.58.190])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qke0D-0008PF-6k
 for bug-gnu-emacs@HIDDEN; Mon, 25 Sep 2023 01:19:27 -0400
References: <87r0mni6m1.fsf@HIDDEN> <87bkdq3nw6.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695619162;
 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=DpKvFXlK3Vw32LYUlt20JNit00C8Y/h3Lj5hz9CFNEM=;
 b=NfL8Va7M+ZnFXY9Zl0NjrD4eOVOCNR4tzONsXrLx4yIVhfxH5T0hIn3oU3Ol192TKXc0IH
 Ktw6LK3XIblhWOU0R7uqQ6/BU5xiwzPxf7LnCV0vXHL7o2aK8jED22vMUEpoZ/clet+A3V
 y5JMi+hpeMKdBh73FkpuKZ+JDD/ICjY=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
Date: Sun, 24 Sep 2023 22:12:18 -0700
In-reply-to: <87bkdq3nw6.fsf@HIDDEN>
Message-ID: <875y3yx221.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.190;
 envelope-from=joseph@HIDDEN; helo=out-190.mta1.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Philip Kaludercic <philipk@HIDDEN>,
 "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>, 66187 <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: -0.1 (/)

Thanks for your help!!

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> Would someone kindly explain the intended behavior here?
>
> I don't know, but I would expect that when the MUST-MATCH predicate
> fails the behavior is the same as with MUST-MATCH t, and when it
> succeeds, the behavior is like MUST-MATCH nil.  Quite simple I think.
> Do you see something different?

Yes. In emacs -Q:

(mkdir "/tmp/foo" t)
(with-temp-buffer
  (write-file "/tmp/foo/bar"))
(setq default-directory "/tmp/foo/")
(read-file-name "Clone into new or empty directory: " nil nil
                (lambda (filename)
                  (or (not (file-exists-p filename))
                      (directory-empty-p filename)))
                nil
                (lambda (filename)
                  (file-directory-p filename)))

The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I
immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/"
(which exists and is not empty) instead of saying "[Match required]".

Are you able to reproduce this on your machine?

> Hmm - or, maybe the confusion is about the behavior for the members of
> the collection?  With other words, whether the argument can be used to
> restrict which existing files are matched, vs. whether it can only be
> used to limit what additionally matches?  AFAIU the latter is the case -
> existing files always match.
>
>> This issue originally came up in this thread about package-vc-checkout:
>> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@HIDDEN/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf
>
> I didn't understand the "this erroneously returns the default filename"
> part.  What default filename is returned?

Does my above comment answer this question?

Thank you!!

Joseph





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

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


Received: (at 66187) by debbugs.gnu.org; 25 Sep 2023 03:58:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 24 23:58:28 2023
Received: from localhost ([127.0.0.1]:43836 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qkcjs-0007ti-6J
	for submit <at> debbugs.gnu.org; Sun, 24 Sep 2023 23:58:28 -0400
Received: from mout.web.de ([212.227.15.14]:50341)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qkcjm-0007tP-V9
 for 66187 <at> debbugs.gnu.org; Sun, 24 Sep 2023 23:58:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695614281; x=1696219081; i=michael_heerdegen@HIDDEN;
 bh=WqRrFJ6rEI/2isV2gdqJ9v8tGmeBpxllZHFcmZisglM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=CH+NFm6O5Y6OQpi+45WBrYbygqoCTgPWMJ6G9cf9pdMyxhFzW/ZKdodY82pbUQrXMU9bAU0zXar
 lKk7vFDnij6RdgMDIBjS9voK5MxThKpdzTXgbyTD9nWv94OHSFbMRVNrMZOF/XwzGy/t3+a4nAhG/
 xA2FiaYQCniUe/NbZ/5qMvGTd/GHkUMZq1W6+b+qUSs+tILkMJtf/j6Jskx7qRisShPPC70QwFZI4
 IUtCsGKe9OeEjpPYH6rarcVoNJqPJ18D4KqUT7LMttCXRQUBm9t60Ut2eXdIGcWzmeFab7h8vaCpX
 edPu6Ll78Kv6fPgR1dTAMact1xAHyO7X792Q==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb005
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MqqTV-1rO8QS3WLp-00mn4y; Mon, 25
 Sep 2023 05:58:01 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87r0mni6m1.fsf@HIDDEN> (Joseph Turner via's
 message of "Sun, 24 Sep 2023 14:31:28 -0700")
References: <87r0mni6m1.fsf@HIDDEN>
Date: Mon, 25 Sep 2023 05:58:01 +0200
Message-ID: <87bkdq3nw6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:VnHqYkXxoW7ZPeM0z/npbH1CGsN33jVTp0aFMzay4IH+3md9002
 q8Js0CFard9lHV2pfxhp/F/x0irFKE4/3W5oX2lqgiaudI1wCdxDzlyCAfEmWd/GqFxadHS
 WF4Q4soyfRJ6vkuNrxB3iZSK3bwWUb6xEgt5LtH2xcTojwJtc0IGXrFDF4rLjVSXSD1c5At
 9WSxAph3hZn2F4KQrdIVQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:H+5729+ENrk=;l3DvjLo7QXtSJoGWetSBNvONG2t
 +6y5U6rgp4ceD35uCKar4RuSXpr3yRxUxJs0X5VPCZUOdccHTN5yr5sa266iglQtu/9ErbOek
 qdaff52G8730Tt0hboOvgpJ+x88jSrNKtMslgkXSGIGcBHLWY6HcQwGK9Wc1K/Q6Gyu1I5EcA
 /E9js+H2yUz6v2k6DYjWHcxLt+6KYdBrieFLGl9tci0/8KtNwmQ0lzWgcCHRDrqRYTTg96EcU
 hXrQkEaBnY5QEon3/Eawu/oLTyth2ZkMv+iaj4iegkKHOe1iVPUW5ByBjkbsgpq8MvC75sBRj
 O87l7w+pTzsgLlwgLfOoKotnrAISLT9eDczUB1n3jR6Kf2JthFXq+6pp7uG3gYykpmLnSM1Pv
 lkIKdyRikuTrvSfGN1TBEBILV650a/x0IwyGrpSOUawFA2tTXIR0YWTpNENUyp0SurEt2rOUT
 rGReAPZcLpk0MlhW+wB/hD+ibpcSKV9IHhxe4fgxLIDJphBxQHIQCCOXFEQOloW8zi/+RHDds
 dnla/Oxpz8k9ZHg19ZTeT9hKCKnltk/SFCCepCLNO9cGfC2qdGA0BR2Ig00cbBC3AsLYFHpw6
 oyT7HpneUY3YzOsA4ZYUvoVysA7ZJv3hh/F9xtBIJPCHAkLjHW2LgVhl0YuEznykPb3SxOtwi
 v9erpJN0lUz8EFPxbc6SZmWtYa50eu4BgBuWfyiT3OaZ7HvOWzBMJDO6IY2cRk0ZcyQ2Fjwg2
 60hN96TUkrrhZ+XLUXw5IC+xn7QHb3GCGg3ENdf9C62J/yzYwiWwFhCctVVSEY653FKeLxjWb
 Y2un/BON0tCS29CfBTRNeeCG+77/YtXTjzB7vuAHNVRsg3W7I1gx24rVpdkxOnYGWLzJltay4
 ahlSMe7H+n2Wnm3UQCQrbvWmLWrDeZsjARY76uYN3MUEBuG6Qoo12ORmSPQCdYwxTA9cpZw7A
 2D9DmMvtBePAHz/rW12mj7gGxHg=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 66187
Cc: "Philip Kaludercic \(Emacs\)" <philipk@HIDDEN>, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@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 (-)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Would someone kindly explain the intended behavior here?

I don't know, but I would expect that when the MUST-MATCH predicate
fails the behavior is the same as with MUST-MATCH t, and when it
succeeds, the behavior is like MUST-MATCH nil.  Quite simple I think.
Do you see something different?

Hmm - or, maybe the confusion is about the behavior for the members of
the collection?  With other words, whether the argument can be used to
restrict which existing files are matched, vs. whether it can only be
used to limit what additionally matches?  AFAIU the latter is the case -
existing files always match.

> This issue originally came up in this thread about package-vc-checkout:
> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@HIDDEN/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf

I didn't understand the "this erroneously returns the default filename"
part.  What default filename is returned?

Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 25 Sep 2023 03:58:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 24 23:58:44 2023
Received: from localhost ([127.0.0.1]:43839 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qkck8-0007uD-HG
	for submit <at> debbugs.gnu.org; Sun, 24 Sep 2023 23:58:44 -0400
Received: from lists.gnu.org ([2001:470:142::17]:49290)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qkck6-0007tz-D9
 for submit <at> debbugs.gnu.org; Sun, 24 Sep 2023 23:58: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 <michael_heerdegen@HIDDEN>)
 id 1qkcjj-0006i6-Pb
 for bug-gnu-emacs@HIDDEN; Sun, 24 Sep 2023 23:58:20 -0400
Received: from mout.web.de ([212.227.15.14])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qkcjh-00089J-Si
 for bug-gnu-emacs@HIDDEN; Sun, 24 Sep 2023 23:58:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695614281; x=1696219081; i=michael_heerdegen@HIDDEN;
 bh=WqRrFJ6rEI/2isV2gdqJ9v8tGmeBpxllZHFcmZisglM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=CH+NFm6O5Y6OQpi+45WBrYbygqoCTgPWMJ6G9cf9pdMyxhFzW/ZKdodY82pbUQrXMU9bAU0zXar
 lKk7vFDnij6RdgMDIBjS9voK5MxThKpdzTXgbyTD9nWv94OHSFbMRVNrMZOF/XwzGy/t3+a4nAhG/
 xA2FiaYQCniUe/NbZ/5qMvGTd/GHkUMZq1W6+b+qUSs+tILkMJtf/j6Jskx7qRisShPPC70QwFZI4
 IUtCsGKe9OeEjpPYH6rarcVoNJqPJ18D4KqUT7LMttCXRQUBm9t60Ut2eXdIGcWzmeFab7h8vaCpX
 edPu6Ll78Kv6fPgR1dTAMact1xAHyO7X792Q==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb005
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MqqTV-1rO8QS3WLp-00mn4y; Mon, 25
 Sep 2023 05:58:01 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66187: read-file-name unexpected behavior when MUSTMATCH is
 a function
In-Reply-To: <87r0mni6m1.fsf@HIDDEN> (Joseph Turner via's
 message of "Sun, 24 Sep 2023 14:31:28 -0700")
References: <87r0mni6m1.fsf@HIDDEN>
Date: Mon, 25 Sep 2023 05:58:01 +0200
Message-ID: <87bkdq3nw6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:VnHqYkXxoW7ZPeM0z/npbH1CGsN33jVTp0aFMzay4IH+3md9002
 q8Js0CFard9lHV2pfxhp/F/x0irFKE4/3W5oX2lqgiaudI1wCdxDzlyCAfEmWd/GqFxadHS
 WF4Q4soyfRJ6vkuNrxB3iZSK3bwWUb6xEgt5LtH2xcTojwJtc0IGXrFDF4rLjVSXSD1c5At
 9WSxAph3hZn2F4KQrdIVQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:H+5729+ENrk=;l3DvjLo7QXtSJoGWetSBNvONG2t
 +6y5U6rgp4ceD35uCKar4RuSXpr3yRxUxJs0X5VPCZUOdccHTN5yr5sa266iglQtu/9ErbOek
 qdaff52G8730Tt0hboOvgpJ+x88jSrNKtMslgkXSGIGcBHLWY6HcQwGK9Wc1K/Q6Gyu1I5EcA
 /E9js+H2yUz6v2k6DYjWHcxLt+6KYdBrieFLGl9tci0/8KtNwmQ0lzWgcCHRDrqRYTTg96EcU
 hXrQkEaBnY5QEon3/Eawu/oLTyth2ZkMv+iaj4iegkKHOe1iVPUW5ByBjkbsgpq8MvC75sBRj
 O87l7w+pTzsgLlwgLfOoKotnrAISLT9eDczUB1n3jR6Kf2JthFXq+6pp7uG3gYykpmLnSM1Pv
 lkIKdyRikuTrvSfGN1TBEBILV650a/x0IwyGrpSOUawFA2tTXIR0YWTpNENUyp0SurEt2rOUT
 rGReAPZcLpk0MlhW+wB/hD+ibpcSKV9IHhxe4fgxLIDJphBxQHIQCCOXFEQOloW8zi/+RHDds
 dnla/Oxpz8k9ZHg19ZTeT9hKCKnltk/SFCCepCLNO9cGfC2qdGA0BR2Ig00cbBC3AsLYFHpw6
 oyT7HpneUY3YzOsA4ZYUvoVysA7ZJv3hh/F9xtBIJPCHAkLjHW2LgVhl0YuEznykPb3SxOtwi
 v9erpJN0lUz8EFPxbc6SZmWtYa50eu4BgBuWfyiT3OaZ7HvOWzBMJDO6IY2cRk0ZcyQ2Fjwg2
 60hN96TUkrrhZ+XLUXw5IC+xn7QHb3GCGg3ENdf9C62J/yzYwiWwFhCctVVSEY653FKeLxjWb
 Y2un/BON0tCS29CfBTRNeeCG+77/YtXTjzB7vuAHNVRsg3W7I1gx24rVpdkxOnYGWLzJltay4
 ahlSMe7H+n2Wnm3UQCQrbvWmLWrDeZsjARY76uYN3MUEBuG6Qoo12ORmSPQCdYwxTA9cpZw7A
 2D9DmMvtBePAHz/rW12mj7gGxHg=
Received-SPF: pass client-ip=212.227.15.14;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=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
Cc: "Philip Kaludercic \(Emacs\)" <philipk@HIDDEN>, 66187 <at> debbugs.gnu.org,
 Joseph Turner <joseph@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Would someone kindly explain the intended behavior here?

I don't know, but I would expect that when the MUST-MATCH predicate
fails the behavior is the same as with MUST-MATCH t, and when it
succeeds, the behavior is like MUST-MATCH nil.  Quite simple I think.
Do you see something different?

Hmm - or, maybe the confusion is about the behavior for the members of
the collection?  With other words, whether the argument can be used to
restrict which existing files are matched, vs. whether it can only be
used to limit what additionally matches?  AFAIU the latter is the case -
existing files always match.

> This issue originally came up in this thread about package-vc-checkout:
> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@HIDDEN/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf

I didn't understand the "this erroneously returns the default filename"
part.  What default filename is returned?

Michael.




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

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


Received: (at submit) by debbugs.gnu.org; 24 Sep 2023 21:50:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 24 17:50:35 2023
Received: from localhost ([127.0.0.1]:43703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qkWzr-0003lT-FG
	for submit <at> debbugs.gnu.org; Sun, 24 Sep 2023 17:50:35 -0400
Received: from lists.gnu.org ([2001:470:142::17]:40856)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qkWzm-0003lA-F3
 for submit <at> debbugs.gnu.org; Sun, 24 Sep 2023 17:50:34 -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 <joseph@HIDDEN>)
 id 1qkWzU-0001dC-Ao
 for bug-gnu-emacs@HIDDEN; Sun, 24 Sep 2023 17:50:12 -0400
Received: from out-190.mta1.migadu.com ([2001:41d0:203:375::be])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qkWzR-0002Bg-NG
 for bug-gnu-emacs@HIDDEN; Sun, 24 Sep 2023 17:50:12 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695592205;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=Ai+TW9gua7Qt5eTa1GJ1RKnGlxO/L5A2fm4IhT70MuU=;
 b=BwhT+K4S5q58vuesIg7Af5IiZsUvAvLqFgP0IHCVWAhUTteLtSK392wVHZRBDHSV/9LZi/
 UEYIPGm2tAnsSMDW3Y5G9d3zs3k/Agonpx8f3ZjswJD9NwafnxAOSdgZO72jSAirdpYshL
 Z8b+yokbgf3BvdoSLuuI2LIVsQbh1r4=
From: Joseph Turner <joseph@HIDDEN>
To: Emacs Bugs Mailing List <bug-gnu-emacs@HIDDEN>
Subject: read-file-name unexpected behavior when MUSTMATCH is a function
Date: Sun, 24 Sep 2023 14:31:28 -0700
X-Debbugs-CC: Philip Kaludercic (Emacs) <philipk@HIDDEN>
Message-ID: <87r0mni6m1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=2001:41d0:203:375::be;
 envelope-from=joseph@HIDDEN; helo=out-190.mta1.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=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 (/)

Hello!

When the MUSTMATCH argument to read-file-name is a function, I'd expect
to see a message like "[Match required]" when the function returns nil.

For example, I'd expect the following to never match:

(read-file-name "Prompt: " nil nil #'ignore)

The behavior of read-file-name is unspecified when a MUSTMATCH function
returns nil:

- a function, which will be called with the input as the
  argument.  If the function returns a non-nil value, the
  minibuffer is exited with that argument as the value.

Would someone kindly explain the intended behavior here?

This issue originally came up in this thread about package-vc-checkout:
https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@HIDDEN/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf

Thanks!

Joseph




Acknowledgement sent to Joseph Turner <joseph@HIDDEN>:
New bug report received and forwarded. Copy sent to philipk@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to philipk@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#66187; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 7 Oct 2023 15:15:01 UTC

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