Subject: Re: bug#75626: 31.0.50; Dired misses or double-processes files when auto-revert-mode is enabled

From: Tassilo Horn <[email-masked]>
Date: Mon, 27 Jan 2025 14:17:09 +0100

Michael Albinus <[email-masked]> writes:

Hi Michael,

> Sorry for being late to the party, but last week I wasn't in the mood
> for any party. And honestly, it isn't much better now. But so what.

I'm sorry to hear.  I hope it gets better soon.

>> Could be.  One would need to look at each command.  Basically, the
>> issue of the two bugs can occur when auto-revert may happen which is
>> when Emacs is waiting for a process to finish (like in this bug) or
>> when waiting for user-input (like the confirmation prompt in
>> bug#71264).
>
> Auto-revert is triggered either by timers (polling) or by events (file
> notification). So yes, it is applied when either timers or event
> reading is in place.
>
> I believe it is good to have a mechanism like inhibit-auto-revert or
> dired--inhibit-auto-revert, in order to suppress auto-reverting
> temporarily. The problem is, that as now they have a nil-or-t value,
> which means that other auto-reverts are blocked also during this time,
> although they are not related.

That's not completely true in this case.  dired--inhibit-auto-revert is
buffer-local and won't disable other auto-reverts (even not of other
dired buffers).

(The idea with a inhibit-auto-revert variable has been canceled for the
time being.)

> No problem in case of polling (the next poll will do the auto-revert),
> but in case of file notifications the information is lost.

That's true.  But I think this is not a new issue.  I mean, that has
always happened when a buffer's buffer-stale-function returned nil for
whatever reason, e.g., in dired when wdired was active and thus
buffer-read-only was nil.

And is there a way to set up auto-revert in such a way that it *only*
uses file notifications and no polling at all?  Looking at the code, it
seems to me that file notifications just produce a quicker auto-revert
than polling (auto-revert-interval).  I'd assume that
auto-revert-interval seconds after inhibition (buffer-stale-function
saying "no" due to whatever reasons), the next auto-revert chance from
polling comes.

Bye,
Tassilo