bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juri Linkov
Subject: bug#40774: Error messages shouldn't be hidden when the user is idle
Date: Fri, 24 Apr 2020 01:16:36 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> 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))

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 via email to

[Prev in Thread] Current Thread [Next in Thread]