emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

write-region bug ?


From: Jean-Christophe Helary
Subject: write-region bug ?
Date: Fri, 3 Jan 2020 01:54:17 +0900

I mentioned that in a mail sent on the 18th of December:

> On Dec 18, 2019, at 23:10, Stefan Monnier <address@hidden> wrote:
> 
>> The code is a most simple one liner variation on the following:
>> 
>> (write-region "stuff" nil "path/to/my/file/test.txt" nil t nil t).
>> 
>> Sometimes the whole *line* above (contained in file "test.el") would be
>> copied to the file "test.txt" and I have no idea why.
> 
> Very curious.  If you can come up with a recipe to reproduce it
> somewhat-reliably, then please `M-x report-emacs-bug`.

And I found a trivial way to reproduce the issue. Which may or may not be an 
issue, depending on my understanding of the command, hence my asking here for 
confirmation whether this is a bug or not...

1) create a foo.el file with only this content:
(write-region "" nil "~/Desktop/bar.txt" nil t nil t)

"~/Desktop/" can be anything that works on your system, the path just needs to 
point at a file that does not exist.

2) open the file and evaluate the expression

→ you should have an empty "bar.txt" at the location of your choice

3) modify foo.el, by adding a line for ex

4) save-buffer

→  foo.el changed on disk; really edit the buffer? (y, n, r or C-h)

→ for some reason, the foo.el buffer is now associated to bar.txt, if you hit 
"y", bar.txt now contains (write-region "" nil "~/Desktop/bar.txt" nil t nil t)

Am I missing something ?

Jean-Christophe Helary 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]