all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
To: 65308@debbugs.gnu.org
Subject: bug#65308: (find-file) botches buffer-file-name in -batch mode
Date: Tue, 15 Aug 2023 14:25:16 +0300	[thread overview]
Message-ID: <5a188f33a3580e9046a28ba6bd527ff20d54366d.camel@yandex.ru> (raw)

This was found while trying to use Emacs in `-batch` mode to regexp-
replace many files in a project. Turns out calling `(save-buffer)` will
make it say that directory does not exist, and the reason for that is
that `buffer-file-name` gets mangled filename.

# Steps to reproduce

	$ mkdir dir && touch dir/1 dir/2
	$ emacs -batch --eval '(progn (dolist (file command-line-args-left) (find-file file) (print buffer-file-name))))' dir/1 dir/2                                    

	"/tmp/dir/1"

	"/tmp/dir/dir/2"

## Expected

Second print would say `/tmp/dir/2`

## Actual

Second print refers to non-existing `/tmp/dir/dir/2`.

# Versions tested

Reproducible with stable 29.1 and somewhat old master as of commit
04710bd01b2





             reply	other threads:[~2023-08-15 11:25 UTC|newest]

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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a188f33a3580e9046a28ba6bd527ff20d54366d.camel@yandex.ru \
    --to=hi-angel@yandex.ru \
    --cc=65308@debbugs.gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.