unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 40774@debbugs.gnu.org
Cc: ndame@protonmail.com
Subject: bug#40774: Error messages shouldn't be hidden when the user is idle
Date: Fri, 24 Apr 2020 01:16:36 +0300	[thread overview]
Message-ID: <87v9lpluez.fsf@mail.linkov.net> (raw)
In-Reply-To: <KdXRRvLEpAay9wNX8QGrXJ7jO5X23m0v5tvf8I61B_X5j0ycEVsI0C5S24wXFUTSE3SsUYLiIuZp9y-57t5XGkCMW5jbObCfwftC45clAeo=@protonmail.com> (ndame via's message of "Thu, 23 Apr 2020 05:58:01 +0000")

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

> So the only change needed is that error messages can only be cleared
> from the echo area by the user doing some command. Otherwise they
> are collected and shown.

I see now what you mean.  This can be easily implemented with the
following patch.  So you can set `clear-message-function' to a function
that returns a non-nil, and the echo area won't be cleared.

Such predicate function could contain a complex logic, but for testing
you could use just:

  (setq clear-message-function (lambda () t))


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: clear_message.patch --]
[-- Type: text/x-diff, Size: 848 bytes --]

diff --git a/src/xdisp.c b/src/xdisp.c
index 01f272033e..fb9def57ef 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11825,18 +11825,23 @@ set_message_1 (ptrdiff_t a1, Lisp_Object string)
 void
 clear_message (bool current_p, bool last_displayed_p)
 {
+  Lisp_Object preserve = Qnil;
+
   if (current_p)
     {
-      echo_area_buffer[0] = Qnil;
-      message_cleared_p = true;
-
       if (FUNCTIONP (Vclear_message_function))
         {
           ptrdiff_t count = SPECPDL_INDEX ();
           specbind (Qinhibit_quit, Qt);
-          safe_call (1, Vclear_message_function);
+          preserve = safe_call (1, Vclear_message_function);
           unbind_to (count, Qnil);
         }
+
+      if (NILP (preserve))
+        {
+          echo_area_buffer[0] = Qnil;
+          message_cleared_p = true;
+        }
     }
 
   if (last_displayed_p)

  reply	other threads:[~2020-04-23 22:16 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 [this message]
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
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=87v9lpluez.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=40774@debbugs.gnu.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).