unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Guillaume Salagnac <guillaume.salagnac@gmail.com>, 28513@debbugs.gnu.org
Subject: bug#28513: 25.1; ido insists on guessing the wrong directory
Date: Mon, 14 Dec 2020 17:42:34 +0100	[thread overview]
Message-ID: <871rfs1gqt.fsf@gnus.org> (raw)
In-Reply-To: <b00c2b29-b8e8-d2a0-6963-00b5443c3c27@yandex.ru> (Dmitry Gutov's message of "Mon, 14 Dec 2020 04:24:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 13.12.2020 15:12, Lars Ingebrigtsen wrote:
>> So...  this is apparently a feature?  Hitting `C-f' disables ido and
>> calls the fallback command, which is `write-region' in this case.
>                                         ^ write-file, right?

Yup.

> 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:


[-- Attachment #2: Type: image/png, Size: 12708 bytes --]

[-- Attachment #3: Type: text/plain, Size: 816 bytes --]


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'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

  reply	other threads:[~2020-12-14 16:42 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 [this message]
2020-12-15  2:23           ` Dmitry Gutov
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=871rfs1gqt.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=28513@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=guillaume.salagnac@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 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).