[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65308: (find-file) botches buffer-file-name in -batch mode
From: |
Konstantin Kharlamov |
Subject: |
bug#65308: (find-file) botches buffer-file-name in -batch mode |
Date: |
Tue, 15 Aug 2023 14:25:16 +0300 |
User-agent: |
Evolution 3.48.4 |
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
- bug#65308: (find-file) botches buffer-file-name in -batch mode,
Konstantin Kharlamov <=