bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66187: read-file-name unexpected behavior when MUSTMATCH is a functi


From: Eli Zaretskii
Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
Date: Wed, 04 Oct 2023 10:03:54 +0300

> Cc: philipk@posteo.net, 66187@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@gnu.org>
> 
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]