all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 40774@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>,
	ndame@protonmail.com
Subject: bug#40774: Error messages shouldn't be hidden when the user is idle
Date: Wed, 08 Dec 2021 21:21:22 +0200	[thread overview]
Message-ID: <86wnkerjgt.fsf@mail.linkov.net> (raw)
In-Reply-To: <83czm7xozh.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 08 Dec 2021 14:25:38 +0200")

>> > I can't find it on Github, and this is understandable - it's a new variable
>> > with quite limited usefulness.  I hoped that even if someone used it,
>> > mentioning it in the Incompatible Lisp Changes of NEWS would be sufficient
>> > as in case of all other incompatible changes.
>>
>> OK; then I'm OK with changing the semantics in Emacs 29 (and noting this
>> in the NEWS in Emacs 28), but perhaps Eli has an opinion here.  Eli?
>
> This is a long discussion, and I chimed in at least twice.  What
> exactly is the proposal for which you want my opinion?  Is there some
> patch I could study, perhaps?

The updated patch is here:

diff --git a/etc/NEWS b/etc/NEWS
index 55e3216e41..8a92a0dcaa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -718,6 +718,11 @@ Emacs buffers, like indentation and the like.  The new ert function
 \f
 * Incompatible Lisp Changes in Emacs 29.1
 
+---
+** 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.
+
 ** User option 'mail-source-ignore-errors' is now obsolete.
 The whole mechanism for prompting users to continue in case of
 mail-source errors has been removed, so this option is no longer
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 28bd1df59a..d8db8898f1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -864,7 +945,11 @@ clear-minibuffer-message
       (setq minibuffer-message-timer nil))
     (when (overlayp minibuffer-message-overlay)
       (delete-overlay minibuffer-message-overlay)
-      (setq minibuffer-message-overlay nil))))
+      (setq minibuffer-message-overlay nil)))
+
+  ;; Return nil telling the caller that the message
+  ;; should be also handled by the caller.
+  nil)
 
 (setq clear-message-function 'clear-minibuffer-message)
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 0ff6286af7..c79168b1be 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12521,18 +12521,23 @@ set_message_1 (void *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 (!EQ (preserve, Qt))
+        {
+          echo_area_buffer[0] = Qnil;
+          message_cleared_p = true;
+        }
     }
 
   if (last_displayed_p)
@@ -36232,9 +36237,13 @@ syms_of_xdisp (void)
   DEFVAR_LISP ("clear-message-function", Vclear_message_function,
 	       doc: /* If non-nil, function to clear echo-area messages.
 Usually this function is called when the next input event arrives.
-The function is called without arguments.  It is expected to clear the
-message displayed by its counterpart function specified by
-`set-message-function'.  */);
+It is expected to clear the message displayed by its counterpart
+function specified by `set-message-function'.
+The function is called without arguments.
+If this function returns a non-t value, the message is cleared
+from the echo area as usual.  If this function returns t,
+this means that the message was already handled, and the original
+message text will not be cleared from the echo area.  */);
   Vclear_message_function = Qnil;
 
   DEFVAR_LISP ("redisplay--all-windows-cause", Vredisplay__all_windows_cause,
-- 





  reply	other threads:[~2021-12-08 19:21 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 [this message]
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

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

  git send-email \
    --in-reply-to=86wnkerjgt.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.