Subject: 27.1; Meaning of interactive specifier "f" unexpectedly depends on visited file

From: Markus Triska <[email-masked]>
Date: Sat, 21 Aug 2021 10:40:18 +0200

Let ~/f.el consist of:

    (defun f (file)
      (interactive "fFile:")
      (message "The file is: %s" file))

When I start Emacs with:

    $ cd
    $ emacs -Q -l f.el

And then, in Emacs, do:

    M-x f RET RET

Then the echo area shows, as expected:

    The file is: ~/

In contrast, when I start Emacs with:

    $ emacs -Q -l f.el f.el

And then perform the same steps as above, i.e.,

    M-x f RET RET

then the echo area unexpectedly shows:

    The file is: ~/f.el

This is unexpected, since the minibuffer prompt when doing M-x f RET
shows: "File:~/" (as before), indicating that pressing RET would yield
"~/", also as before, not "~/f.el".

The key difference between the two cases is that in the second
invocation, f.el is visited, and in the first case it is not visited.

I noticed this difference when testing cdvdmacs, visiting cdvdmacs.el
and then trying to add the directory in which cdvdmacs.el resides to the
list of files and directories I want to archive, and unexpectedly adding
only the file itself (cdvdmacs.el) instead of the entire directory:

    https://www.metalevel.at/cdvdmacs/

Thank you and all the best,
Markus

In GNU Emacs 27.1 (build 1, x86_64-apple-darwin15.3.0, X toolkit, Xaw scroll bars)
 of 2020-12-12 built on mt-macbook
Windowing system distributor 'The X.Org Foundation', version 11.0.11502000
System Description:  Mac OS X 10.11.3