Subject: Re: bug#18336: 24.4.50; When editing externally changed file, Emacs asks too many questions

From: Stefan Kangas <[email-masked]>
Date: Mon, 02 Mar 2020 09:39:14 +0100

Noam Postavsky <[email-masked]> writes:

>> I tried the current master, and I see the same as on the emacs-27
>> branch, with a file not under any VCS.
>>
>> I have no idea how you see something so different.
>
> I've tried this now too, and I see the same as Eli, even on Emacs 26.3.
> By the way, the "Save anyway?" question doesn't get logged to
> *Messages*.

OK, this is weird.  I think I'm now seeing the same as David on
current master.  Note that this is different from what I saw earlier,
when I saw exactly what Eli describes.

0. emacs -Q
1. C-x C-f /tmp/moo.txt RET
2. abc C-x C-s
3. From terminal: echo "foo" >> /tmp/moo.txt
4. type something, get these messages:
moo.txt changed on disk; really edit the buffer? (y, n, r or C-h) y
5. Answer 'y', save the file, get:
- do you really want to save? [not logged]
- moo.txt changed on disk; really edit the buffer? (y, n, r or C-h) y

I tried this several times and got the same result.

In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.13, cairo version 1.16.0)
 of 2020-03-01 built on joffe
Repository revision: d97688851bf5069430483c543032ef7cd0c9b5ef
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12007000
System Description: Debian GNU/Linux bullseye/sid

Recent messages:
(New file)
Saving file /tmp/moo.txt...
Wrote /tmp/moo.txt
moo.txt changed on disk; really edit the buffer? (y, n, r or C-h) y
File on disk now will become a backup file if you save these changes.
Saving file /tmp/moo.txt...
moo.txt changed on disk; really edit the buffer? (y, n, r or C-h) y
File on disk now will become a backup file if you save these changes.
Wrote /tmp/moo.txt

---

OK, I tried saving a file in my home directory instead, and now I
didn't see the second "changed on disk" message.  (That is, I see the
same thing that Eli described.)

Testing it a bit more, I was able to trigger the second message again,
but only once.

---

Investigating even further (on current master), I think I now have
that:

a. In my home directory, I consistently see the message.  (David's case)
b. In "/tmp" I consistently do *not* see the message.  (Eli's case)

So I guess the second message is triggered only under specific
circumstances?

(But even the above conclusion is confusing, since I also saw the
message (but only once) even when I saved in "/home".  And I don't see
why saving in a different directory should matter...)

Does anyone have any idea what could be going on here?  Have we found
ourselves a heisenbug?  Or have I thoroughly managed to confuse
myself?

Best regards,
Stefan Kangas