Hi Tassilo

Thanks for looking into this!

So Jake's request can be broadened to something like "buffer-bound modes
should suppress messages when their buffer is not visible".  I'm not
sure if I'd want that.

Is it necessary to broaden it?  I don’t think it’s a problem in general to get updates about other buffers.  It is an issue in this case because of the content of the message.

Cheers
Jake

On Sat, 2 Aug 2025 at 5:00 pm, Tassilo Horn <tsdh@gnu.org> wrote:
Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

>> When a buffer visits a file using doc-view-mode and auto-revert-mode
>> is enabled in that buffer, Emacs emits the message "Type C-c C-c to
>> toggle between editing or viewing the document."  every time the file
>> is changed.  The message is not appropriate when the major mode of
>> the current buffer is not doc-view-mode.
>>
>> >From emacs -Q:
>> 1. Visit a PDF file
>> 2. M-x auto-revert-mode
>> 3. Visit a different buffer like the scratch buffer
>> 4. Cause the PDF file to be changed
>> 5. Observe the message
>
> Tassilo, any comments or suggestions?

Jake's observation is certainly true but it's not really doc-view
specific.  A similar case is shown by this recipe:

1. open dired for /tmp and enable dired-omit-mode and auto-revert-mode
2. visit a different buffer
3. touch /tmp/foo in a terminal
4. observe the message "Omitting XX lines in /tmp"

So Jake's request can be broadened to something like "buffer-bound modes
should suppress messages when their buffer is not visible".  I'm not
sure if I'd want that.  And how to implement it.  I guess we certainly
don't want to visit each (message...) in Emacs to check if it's
appropriate to show in the "buffer not visible" case...

Bye,
Tassilo