unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Cc: 65308-done@debbugs.gnu.org
Subject: bug#65308: (find-file) botches buffer-file-name in -batch mode
Date: Tue, 15 Aug 2023 15:26:37 +0300	[thread overview]
Message-ID: <83jztwa3uq.fsf@gnu.org> (raw)
In-Reply-To: <b73e40b25662f6a6738f1a7159e848475cec0f20.camel@yandex.ru> (message from Konstantin Kharlamov on Tue, 15 Aug 2023 15:17:00 +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.





      reply	other threads:[~2023-08-15 12:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 11:25 bug#65308: (find-file) botches buffer-file-name in -batch mode Konstantin Kharlamov
2023-08-15 12:03 ` Eli Zaretskii
2023-08-15 12:17   ` Konstantin Kharlamov
2023-08-15 12:26     ` Eli Zaretskii [this message]

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=83jztwa3uq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=65308-done@debbugs.gnu.org \
    --cc=Hi-Angel@yandex.ru \
    /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).