Subject: read-file-name unexpected behavior when MUSTMATCH is a function

From: Joseph Turner <[email-masked]>
Date: Sun, 24 Sep 2023 14:31:28 -0700

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/[email-masked]/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf

Thanks!

Joseph