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

From: Tassilo Horn <[email-masked]>
Date: Sat, 02 Aug 2025 09:30:13 +0200

Eli Zaretskii <[email-masked]> 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