From: Dmitry Gutov <dgutov@yandex.ru>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Guillaume Salagnac <guillaume.salagnac@gmail.com>, 28513@debbugs.gnu.org
Subject: bug#28513: 25.1; ido insists on guessing the wrong directory
Date: Tue, 15 Dec 2020 04:23:29 +0200 [thread overview]
Message-ID: <baa28697-9c41-c0de-f8eb-f71e96b27d4a@yandex.ru> (raw)
In-Reply-To: <871rfs1gqt.fsf@gnus.org>
On 14.12.2020 18:42, Lars Ingebrigtsen wrote:
>> Okay, but why does the fallback command end up trying to overwrite the
>> original file, even though, in your scenario, input ends with /vc/?
>
> In essence, it's doing this (if we say we've navigated to "/tmp/" before
> `C-f'):
>
> (let ((default-directory "/tmp/"))
> (call-interactively 'write-file))
>
> This gives you a prompt of
>
> Write file: /tmp/
>
> If you then hit RET, then:
>
>
>
> That is, hitting RET in the `write-file' dialogue gives you
> buffer-file-name, and ignores whatever is in the prompt. This seems
> contrary to what the doc string says:
>
> ---
> Interactively, prompt for FILENAME.
> If you specify just a directory name as FILENAME, that means to write
> to a file in that directory. In this case, the base name of the file
> is the same as that of the file visited in the buffer, or the buffer
> name sans leading directories, if any, if the buffer is not already
> visiting a file.
> ---
>
> So this isn't an ido problem at all -- it's a bug in `write-file'? Or
> rather...
>
> (let ((default-directory "/tmp/")) (read-file-name "Foo: "))
>
> If you just hit RET there, it'll return `buffer-file-name'.
But there is a difference between having default-directory set to /tmp/
and typing /tmp/ yourself.
I think when the user calls the escape hatch command, they don't expect
their current input to translate to the new default-directory value.
Rather, it should be the input in the new prompt.
Might not be easy to fix, however, given that the current code in Ido
tries to do that in the most generic way:
(let ((default-directory ido-current-directory)
(read-file-name-function nil))
(setq this-command (or ido-fallback fallback 'find-file))
...
(call-interactively this-command))
And since that this feature is an escape hatch and, say, fido-mode
(which everyone will migrate to any year now) shouldn't need anything
like it, maybe it's not worth the effort fixing.
next prev parent reply other threads:[~2020-12-15 2:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 15:03 bug#28513: 25.1; ido insists on guessing the wrong directory Guillaume Salagnac
2020-12-12 12:10 ` Lars Ingebrigtsen
2020-12-13 1:11 ` Dmitry Gutov
2020-12-13 13:12 ` Lars Ingebrigtsen
2020-12-14 2:24 ` Dmitry Gutov
2020-12-14 16:42 ` Lars Ingebrigtsen
2020-12-15 2:23 ` Dmitry Gutov [this message]
2020-12-15 6:42 ` Lars Ingebrigtsen
2020-12-17 11:33 ` Lars Ingebrigtsen
2020-12-17 11:54 ` Dmitry Gutov
2021-01-01 21:51 ` bug#28513: Ryan C. Thompson
2021-01-10 23:07 ` bug#19412: bug#28513 Ryan C. Thompson
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=baa28697-9c41-c0de-f8eb-f71e96b27d4a@yandex.ru \
--to=dgutov@yandex.ru \
--cc=28513@debbugs.gnu.org \
--cc=guillaume.salagnac@gmail.com \
--cc=larsi@gnus.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).