Subject: bug#79145: 31.0.50; doc-view-mode with auto-revert-mode emitting message when it shouldn't

From: Tassilo Horn <[email-masked]>
Date: Thu, 07 Aug 2025 20:42:19 +0200

Michael Albinus <[email-masked]> writes:

Hi chaps,

>>> If we want to have a general mechanism, we need a new variable
>>> auto-revert-buffer-in-progress-p which could be consulted by the
>>> several mode-specific revert functions implementations. Or we extend
>>> the meaning of revert-buffer-in-progress-p to the values nil, t, and
>>> `auto'. The latter indicates, that the revert process has been
>>> started by auto-revert.
>>
>> I think I'd prefer the general-mechanism solution.  Would someone
>> like to work on a patch along those lines?
>
> I could work on the general mechanism. Which variant do you prefer,
> extending revert-buffer-in-progress-p or a new
> auto-revert-buffer-in-progress-p?

I have the feeling that such a solution would be overkill.  Let me
explain:

As Jake has clarified, he's not strictly opposing all messages relating
to non-current buffers but this doc-view message is problematic
especially because it advertises a key-binding which only has the
advertised effect in a doc-view buffer.  So I guess we could simply
guard that message with something like

  (when (get-buffer-window (current-buffer) (selected-frame))
    (message ...))

or probably better

  (let ((inhibit-message (get-buffer-window
                          (current-buffer) (selected-frame))))
    (message ...))

so that it's still logged in *Messages* which would be a less drastical
change.

If we'd really like to have an option which says "don't bother me with
messages relating to buffers which are not current (or visible)", then
auto-revert is just one out of several possible causes.  Timers are
another one, e.g., messages from Gnus fetching mail.  Or modes doing
asynchronous communication.  And then one probably wants to be able to
define that certain messages are fine although the corresponding buffer
isn't current/visible ("You have 3 new mails", "The compilation of foo
has finished") but others not...

Bye,
Tassilo