Subject: bug#40774: Error messages shouldn't be hidden when the user is idle

From: Juri Linkov <[email-masked]>
Date: Tue, 14 Dec 2021 10:35:13 +0200

>> > Isn't there some Lisp-visible effect of that, like that the echo-area
>> > will appear empty after the assignment?  If so, then the
>> > clear-message-function was previously running with the echo-area
>> > buffer nil, but now it won't.
>>
>> clear-message-function is not intended to do anything with the echo-area.
>> Its purpose is to notify a subscriber that the message is going to be cleared,
>> so the subscriber can e.g. clear the message from the minibuffer, etc.
>> When the subscriber needs to affect the echo-area, it's the purpose
>> of the proposed return value not to clear the echo-area when the subscriber
>> asks so via the return value.
>
> So there will be some effect of this reordering, if some
> clear-message-function does something that you say it shouldn't.

Of course, when authors decide to shoot themselves in the foot,
we can't prevent this.

>> > I gave an example of how using this for that purpose could be a
>> > problem, and you responded only to that example.  But the problem that
>> > bothers me is much more general, and you are silent about that larger
>> > problem.
>> >
>> > I'm asking once again: aren't we trying to use echo-area messages or
>> > minibuffer messages displayed in the mini-window for a job that they
>> > weren't intended to do: showing large amounts of messages at the same
>> > time?
>>
>> Sorry, I still don't understand what do you mean.  What large amounts
>> of messages?  At what the same time?  This is completely unclear.
>> Maybe if you give an example, this could help to understand.
>
> This whole discussion started from a request to be able to accumulate
> messages in the echo-area so that the user who is away could see them
> all when he/she comes back from whatever took him/her away.  There
> could be quite a lot of messages accumulated during that period, and
> the request was to leave them all on display.  For which you proposed
> to use clear-message-function in a way that doesn't actually clear
> them.
>
> Is the above an accurate description and summary of what is being
> proposed here?  If so, is it now clear what kind of job I think
> display of echo-area messages was never designed to support?

Thanks for explanation, now it's clear where is the misunderstanding.

Actually, the patch for clear-message-function here is unrelated
to the feature that uses set-message-function to accumulate messages
and doesn't use clear-message-function.

The feature here is intended for users who want to always leave
the last displayed message in the echo-area, and never clear it.
It will be possible even to do this conditionally.

For example, when the user wants to leave the message
"Compilation finished" displayed in the echo area even
during navigation in the buffer or when the user types text.
Normally such message will be cleared on any key press,
and thus the user will miss it.  But with such configuration
the user won't miss the message even while using self-inserting
or navigation keys when the message is displayed:

  (setq clear-message-function
        (lambda ()
          (when (string-match-p "^Compilation" (current-message))
            'dont-clear-message)))