unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 40774@debbugs.gnu.org, larsi@gnus.org, ndame@protonmail.com
Subject: bug#40774: Error messages shouldn't be hidden when the user is idle
Date: Sun, 12 Dec 2021 22:18:29 +0200	[thread overview]
Message-ID: <86v8ztfuga.fsf@mail.linkov.net> (raw)
In-Reply-To: <83wnk9mwmx.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 12 Dec 2021 21:49:26 +0200")

>> >> +** The return value of 'clear-message-function' is not ignored anymore.
>> >> +If the function returns t, then the message is not cleared,
>> >> +with the assumption that the function cleared it itself.
>> >
>> > I could perhaps agree to this if the special new behavior was the
>> > result of a very special return value, and only that value.  Having
>> > the new behavior kick in for t is out of the question for the release
>> > branch, as it is highly likely to trip unsuspecting Lisp programs.
>>
>> What a special value would you prefer?  Maybe, a symbol 'no'?
>
> More like 'no-clear or even 'dont-clear-message, I think.

I tried to find an existing DEFSYM in syms_of_xdisp,
but it seems there is no suitable symbol, so a new symbol
'dont-clear-message' could be added to syms_of_xdisp.
This is a patch over the previous patch:

diff --git a/src/xdisp.c b/src/xdisp.c
index 9b5b7d49e5..495a84b349 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12533,7 +12533,7 @@ clear_message (bool current_p, bool last_displayed_p)
           unbind_to (count, Qnil);
         }

-      if (!EQ (preserve, Qt))
+      if (!EQ (preserve, Qdont_clear_message))
         {
           echo_area_buffer[0] = Qnil;
           message_cleared_p = true;
@@ -36235,6 +36235,7 @@ syms_of_xdisp (void)
 (which controls how error messages are displayed).  */);
   Vset_message_function = Qnil;

+  DEFSYM (Qdont_clear_message, "dont-clear-message");
   DEFVAR_LISP ("clear-message-function", Vclear_message_function,
 	       doc: /* If non-nil, function to clear echo-area messages.

>> > Btw, what does the change of the order between the call of
>> > clear-message-function and setting echo_area_buffer[0] to nil mean,
>> > compatibility-wise? won't it also produce different results, even if
>> > the return value is nil?
>>
>> When the return value is nil, it will still clear the echo area.
>
> That wasn't what I asked.  I asked whether the change in the order
> could matter.  Specifically, we now set echo_area_buffer[0] to nil
> after we run clear-message-function, not before.  Can that affect
> some customization of clear-message-function?

Actually, it should not affect customizations because such customizations
should not touch the echo-area.  It's the task of clear_message
to handle the echo-area.

>> > More generally, I fear that we are trying very hard to tweak a
>> > particular infrastructure for a job for which it was hardly meant.
>>
>> This is the most simple and thus reliable solution.
>>
>> > IOW, shouldn't we provide some completely different optional feature
>> > for this use case?  Like a special buffer that pops up or a special
>> > frame?  Echo-area is not suited for showing large chunks of text, and
>> > my gut feeling is that we will bump into problems on this path.  E.g.,
>> > what happens when there are enough accumulated messages that they can
>> > no longer be shown with the maximum allowed height of the mini-window?
>>
>> This is exactly what functions bound to clear-message-function intended to do.
>
> ??? This function is about _clearing_ the echo-area, whereas I was
> talking about the _display_ in the echo-area.  I'm saying that I'm not
> sure echo-area display is suited for the jobs that this bug wants it
> to do.  As an example, I asked what would happen when the echo-area
> can no longer be resized to accommodate all the messages that were not
> cleared.

clear-message-function can handle not only echo-area but also e.g.
the minibuffer messages.  In case of the returned value, by using
'dont-clear-message' it can sometimes tell the function clear_message
to not clear the echo-area, so there are no resizing problems.
It doesn't add more lines to the existing echo-area.





  reply	other threads:[~2021-12-12 20:18 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 16:21 bug#40774: Error messages shouldn't be hidden when the user is idle ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 16:27 ` Drew Adams
2020-04-22 16:38   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 17:08     ` Drew Adams
2020-04-22 17:35       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 16:44 ` Eli Zaretskii
2020-04-22 17:38   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 18:11     ` Eli Zaretskii
2020-04-22 18:21       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 18:26         ` Eli Zaretskii
2020-04-22 18:43           ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 18:47             ` Eli Zaretskii
2020-04-22 18:53               ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 19:06                 ` Eli Zaretskii
2020-04-22 19:10                   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-22 19:25                     ` Eli Zaretskii
2020-04-22 19:35                       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-23  5:58                       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-23 22:16                         ` Juri Linkov
2020-08-20 13:41                           ` Lars Ingebrigtsen
2021-12-05 18:54                             ` Juri Linkov
2021-12-05 19:49                               ` Eli Zaretskii
2021-12-05 20:50                               ` Lars Ingebrigtsen
2021-12-05 21:29                                 ` Juri Linkov
2021-12-06  5:49                                   ` Lars Ingebrigtsen
2021-12-06  9:31                                     ` Juri Linkov
2021-12-07 20:51                                       ` Lars Ingebrigtsen
2021-12-08 12:25                                         ` Eli Zaretskii
2021-12-08 19:21                                           ` Juri Linkov
2021-12-08 20:01                                             ` Eli Zaretskii
2021-12-12 19:19                                               ` Juri Linkov
2021-12-12 19:49                                                 ` Eli Zaretskii
2021-12-12 20:18                                                   ` Juri Linkov [this message]
2021-12-13 16:48                                                     ` Eli Zaretskii
2021-12-13 18:50                                                       ` Juri Linkov
2021-12-13 19:42                                                         ` Eli Zaretskii
2021-12-14  8:35                                                           ` Juri Linkov
2021-12-14 13:19                                                             ` Eli Zaretskii
2021-12-14 20:54                                                               ` Juri Linkov
2021-12-15 12:41                                                                 ` Eli Zaretskii
2022-04-23 15:17                                                     ` Lars Ingebrigtsen
2021-12-08 19:18                                         ` Juri Linkov
2020-04-22 22:05 ` Juri Linkov
2020-04-23  4:38   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86v8ztfuga.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=40774@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=ndame@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).