[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65308: (find-file) botches buffer-file-name in -batch mode
From: |
Eli Zaretskii |
Subject: |
bug#65308: (find-file) botches buffer-file-name in -batch mode |
Date: |
Tue, 15 Aug 2023 15:26:37 +0300 |
> From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
> Cc: 65308@debbugs.gnu.org
> Date: Tue, 15 Aug 2023 15:17:00 +0300
>
> On Tue, 2023-08-15 at 15:03 +0300, Eli Zaretskii wrote:
> > There's no bug here. To get what you want, run the command-line
> > arguments through expand-file-name _before_ calling find-file.
>
> Oh, okay, thank you, I see. I settled with calling a `(kill-buffer)`
> after `(save-buffer)`, which I guess works because each time the buffer
> is killed we get back to the *scratch* buffer that has the original
> "current directory".
Yes, that will work, as will using save-current-buffer etc. But
please note that relying on the default-directory of some random
buffer when using relative file names is always fraught with surprises
in Emacs, which is why I suggested to use expand-file-name instead.
Closing.