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

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

bug#68815: Unexpected behavior with read-file-name and functional REQUIR


From: Stefan Monnier
Subject: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument
Date: Tue, 30 Jan 2024 08:08:11 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> emacs -Q on the tip of the emacs-29 branch (after commit 77f5d4d523a), run...
>
> (let ((default-directory "~/"))
>   (read-directory-name "Clone into new or empty directory: " nil nil
>                        (lambda (dir) (or (not (file-exists-p dir))
>                                     (directory-empty-p dir)))))
>
> ...then type "/tmp/" (the whole minibuffer now reads "~//tmp") then RET.
>
> Expected: Completion does not exit, instead saying "[No match]".

Ah, that good old problem about whether PRED should apply to the quoted
or to the unquoted string 🙁

I think here the bug is in `read-directory-name` (and `read-file-name`)
since their PRED arg is expected to apply to the (unquoted) file name
itself (i.e. the thing that would be returned by the function), rather
than to the quoted representation used in the minibuffer.

They should wrap PRED so as to pass the arg through
`substitute-in-file-name` (or otherwise arrange to make sure PRED is
called with an unquoted file name).


        Stefan






reply via email to

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