[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32274: (interactive "F") silently expands a directory to the current
From: |
Noam Postavsky |
Subject: |
bug#32274: (interactive "F") silently expands a directory to the current buffer's path |
Date: |
Wed, 25 Jul 2018 18:49:14 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Andrea Cardaci <cyrus.and@gmail.com> writes:
> The value returned by (interactive "F") is not the one provided by the user.
>
> 1. Create a file, say /tmp/foo.el:
>
> (defun foo (path)
> (interactive "F")
> (message path))
>
> 2. M-x evaluate-buffer
>
> 3. M-x foo and chose /tmp/.
>
> The value presented in the echo area is /tmp/foo.el, this is undesirable and
> very dangerous IMHO. It happens with both Emacs 24 and 26.
>
> Is this a bug or I'm overlooking something?
"F" calls read-file-name, passing nil for all args:
DEFAULT-FILENAME specifies the default file name to return if the
user exits the minibuffer with the same non-empty string inserted
by this function [...] If DEFAULT-FILENAME is omitted or
nil [...] if the current buffer is visiting a file,
that file serves as the default [...]
So it seems to be on purpose.