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: Sun, 19 Jan 2025 00:43:03 +0100

Drew Adams <[email-masked]> writes:

>> What is the reason that there are two different approaches to process
>> all marked files, i.e., dired-map-over-marks
>> vs. dired-get-marked-files?
>
> (Caveat: I'm not following this thread.)

The context is that commands like dired-do-compress which use
dired-map-over-marks can skip or double-process marked files in case the
dired buffer is reverted during the operation by auto-revert-mode (most
likely because the sorting order changes due to the suffix .gz being
removed or added).

> The doc string, and how those two are used in
> the code, tell you the answer.
>
> `dired-get-marked-files' just gives you a list
> of the marked files.  `dired-map-over-marks'
> is a macro, not a function, and it _processes_
> the files.

Ok, I should have said: why do some dired commands use
dired-get-marked-files together with some loop, and a processing
function while others use dired-map-over-marks with the processing code
as body?  I mean, both approaches do essentially the same but only the
latter is subject of the issue I've reported.

Is there some example dired command that can only work with
dired-map-over-marks and not by collecting all marked files at the
beginning?  It would need to be something where the processing code
marks files that haven't been marked before.  But I can't think of an
example where that would be desired.

Bye,
Tassilo