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

From: Tassilo Horn <[email-masked]>
Date: Mon, 20 Jan 2025 19:01:37 +0100

Drew Adams <[email-masked]> writes:

>> >> The macro itself should stay general & unassuming.
>> >
>> > The plan is to change dired-buffer-stale-p so that it returns nil
>> > when inhibit-read-only is bound to a non-nil value which is the
>> > case during the execution of the code generated by
>> > dired-map-over-marks and might catch other cases, too.  The macro
>> > itself stays as-is.
>> 
>> The missing part: this change hinders auto-revert-mode from reverting
>> the dired buffer during an operation on marked files.
>
> That shouldn't happen, IMO.  Too general,
> and I doubt it's needed.

This bug contains a recipe showing at least one ocassion where it is
needed.

> One might very well want to allow reversion
> during some particular operation on marked
> files.  Let's not assume otherwise.

Sure, and that's still allowed, e.g., the code given as BODY of
dired-map-over-marks could explicitly call revert-buffer if it can
handle the result.

The point is that auto-revert-mode reverts at _unpredictable_ moments
where chances are high that the dired buffer contents change in a way
that the processing logic goes wrong, e.g., a marked and not yet
processed file is now before point and will be skipped, or the other way
round, an already processed file is now after point and will be
processed again.

> An operation on marked files - which really
> means, for this macro, an operation on marked
> _lines_, CAN DO ANYTHING.  Whatever you might
> want to do to, or with, the Dired buffer
> display/listing you can do.  That is, you
> could until now, it sounds like.

I don't see what feature you think I have stolen from you.  We just
prevent auto-revert-mode from reverting the dired buffer as long as an
operation on marked files is in progress.  Progress is still visible
(SHOW-PROGRESS arg of dired-map-over-marks), i.e., the dired buffer is
periodically redisplayed showing the changes so far because that has
nothing to do with auto-revert-mode.

Bye,
Tassilo