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

From: Michael Albinus <[email-masked]>
Date: Wed, 05 Feb 2025 09:51:33 +0100

Michael Heerdegen <[email-masked]> writes:

> Hello Michael,

Hi Michael.

> Sorry for being late, have been a bit distracted.  Allow only one
> question please:
>
> | +  (defmacro inhibit-auto-revert (&rest body)
> | +    "Deactivate auto-reverting of current buffer temporarily.
> | +Run BODY."
> | +    (declare (indent 0) (debug ((form body) body)))
>
> What's the purpose of this debug spec - why not just "body"?

Cut'n'waste error. Thanks for the heads-up, I've fixed it.

> | +       (let ((buf (and (not (memq (current-buffer) inhibit-auto-revert-buffers))
> | +                       (current-buffer))))
> | +         (unwind-protect
> | +             (progn
> | +               (when buf (add-to-list 'inhibit-auto-revert-buffers buf))
> | +               ,@body)
>
> I think at least in this part where body is inserted the variable BUF
> should be uninterned for the obvious reason.  Or at least have a more
> obscure name.

Yes, I've seen such constructs somewhere else in Emacs' code. I don't
understand why a simple (lexical) let-binding of buf isn't
sufficient. The problem would exist for any macro. Could you pls show me
an example how it could go wrong?

(If you believe it is needed, you can just patch autorevert.el yourself,
with a comment in the code.)

> Michael.

Best regards, Michael.