From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Date: Sat, 07 Oct 2023 08:23:02 +0300 Message-ID: <83r0m70zwp.fsf@gnu.org> References: <87r0mni6m1.fsf@breatheoutbreathe.in> <87bkdq3nw6.fsf@web.de> <875y3yx221.fsf@breatheoutbreathe.in> <87pm260wh9.fsf@web.de> <87v8bx48ww.fsf@breatheoutbreathe.in> <87msx8sbpv.fsf@web.de> <87bkdoh1gy.fsf@breatheoutbreathe.in> <87h6ngs85e.fsf@web.de> <87ttr7nzyj.fsf@breatheoutbreathe.in> <83pm1u6f8l.fsf@gnu.org> <83fs2o2wb0.fsf@gnu.org> <83v8bj2794.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32164"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, philipk@posteo.net, 66187@debbugs.gnu.org, joseph@breatheoutbreathe.in To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 07 07:24:09 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qoznM-00088B-Qc for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Oct 2023 07:24:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qozmz-0000RP-4R; Sat, 07 Oct 2023 01:23:45 -0400 Original-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 ) id 1qozmx-0000Qu-5T for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2023 01:23:43 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qozmw-0003VQ-Tv for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2023 01:23:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoznF-00084X-P1 for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2023 01:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Oct 2023 05:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66187 X-GNU-PR-Package: emacs Original-Received: via spool by 66187-submit@debbugs.gnu.org id=B66187.169665620130961 (code B ref 66187); Sat, 07 Oct 2023 05:24:01 +0000 Original-Received: (at 66187) by debbugs.gnu.org; 7 Oct 2023 05:23:21 +0000 Original-Received: from localhost ([127.0.0.1]:53162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qozma-00083J-TY for submit@debbugs.gnu.org; Sat, 07 Oct 2023 01:23:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qozmY-000833-AM for 66187@debbugs.gnu.org; Sat, 07 Oct 2023 01:23:19 -0400 Original-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 ) 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==; In-Reply-To: (message from Stefan Monnier on Fri, 06 Oct 2023 12:43:51 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271971 Archived-At: > From: Stefan Monnier > Cc: joseph@breatheoutbreathe.in, michael_heerdegen@web.de, > philipk@posteo.net, 66187@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 > 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 > 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?