unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: michael_heerdegen@web.de, philipk@posteo.net,
	66187@debbugs.gnu.org, joseph@breatheoutbreathe.in
Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
Date: Sat, 07 Oct 2023 08:23:02 +0300	[thread overview]
Message-ID: <83r0m70zwp.fsf@gnu.org> (raw)
In-Reply-To: <jwva5sv4stk.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Fri, 06 Oct 2023 12:43:51 -0400)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> 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 <larsi@gnus.org>
>     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@gnus.org>
>     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?





  reply	other threads:[~2023-10-07  5:23 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-24 21:31 bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25  3:58 ` Michael Heerdegen
2023-09-25  5:12   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25 21:33     ` Michael Heerdegen
2023-09-26  8:37       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-27  0:26         ` Michael Heerdegen
2023-09-27  0:55           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-27  1:43             ` Michael Heerdegen
2023-10-03 21:18               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-03 23:00                 ` Drew Adams
2023-10-04  3:35                 ` Michael Heerdegen
2023-10-04  5:22                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05  1:12                     ` Michael Heerdegen
2023-10-04  7:03                 ` Eli Zaretskii
2023-10-05 19:34                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05 20:20                     ` Drew Adams
2023-10-06  4:47                       ` Eli Zaretskii
2023-10-06 13:05                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-06 14:08                           ` Drew Adams
2023-10-06  4:45                     ` Eli Zaretskii
2023-10-06 13:01                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-06 13:46                         ` Eli Zaretskii
2023-10-06 16:43                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-07  5:23                             ` Eli Zaretskii [this message]
2023-10-07 14:25                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-07 15:09                                 ` Eli Zaretskii
2023-10-07 15:12                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-12 21:26                                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26  6:49                                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18  0:24                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-19  2:52                                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09  8:06                                           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-25 20:53                                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-28 19:20                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-28 19:28                                                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-06  5:55                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-29 12:00             ` Eli Zaretskii
2023-10-03 20:43               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-04  6:05                 ` Eli Zaretskii
2023-10-04  6:25                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r0m70zwp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=66187@debbugs.gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).