GNU bug report logs - #28513
25.1; ido insists on guessing the wrong directory

Previous Next

Package: emacs;

Reported by: Guillaume Salagnac <guillaume.salagnac <at> gmail.com>

Date: Tue, 19 Sep 2017 15:29:01 UTC

Severity: minor

Tags: fixed

Found in version 25.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 28513 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Guillaume Salagnac <guillaume.salagnac <at> gmail.com>, 28513 <at> debbugs.gnu.org
Subject: Re: bug#28513: 25.1; ido insists on guessing the wrong directory
Date: Tue, 15 Dec 2020 04:23:29 +0200
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.




This bug report was last modified 4 years and 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.