all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Andrea Cardaci <cyrus.and@gmail.com>
Cc: 32274@debbugs.gnu.org
Subject: bug#32274: (interactive "F") silently expands a directory to the current buffer's path
Date: Wed, 25 Jul 2018 18:49:14 -0400	[thread overview]
Message-ID: <877elj3p91.fsf@gmail.com> (raw)
In-Reply-To: <CACMsj9O8cNDSHy0jUmpMTELNdQUcFvt4sFZfc1KuY_3VN8WoRg@mail.gmail.com> (Andrea Cardaci's message of "Thu, 26 Jul 2018 00:26:17 +0200")

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.






  reply	other threads:[~2018-07-25 22:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 22:26 bug#32274: (interactive "F") silently expands a directory to the current buffer's path Andrea Cardaci
2018-07-25 22:49 ` Noam Postavsky [this message]
2018-07-25 23:39   ` Andrea Cardaci
2018-07-26  0:46     ` Noam Postavsky
2018-07-26 11:46       ` Andrea Cardaci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877elj3p91.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=32274@debbugs.gnu.org \
    --cc=cyrus.and@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.