From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#40774: Error messages shouldn't be hidden when the user is idle Date: Wed, 08 Dec 2021 21:21:22 +0200 Organization: LINKOV.NET Message-ID: <86wnkerjgt.fsf@mail.linkov.net> References: <83blnje5ro.fsf@gnu.org> <838sine4si.fsf@gnu.org> <837dy7e3wr.fsf@gnu.org> <-ZmNQQ07JD7L0I5EpXolv4t1UhWBGc4SN0dkJml3cLbBjO6ucAMUzAqsI9Ca69xO_hzlMLfaLs6bY9vq8GAR24RUGu1LZqVoVkXhiJcFgtg=@protonmail.com> <835zdre31u.fsf@gnu.org> <87v9lpluez.fsf@mail.linkov.net> <874koxwi1t.fsf@gnus.org> <86pmqa51cz.fsf@mail.linkov.net> <87bl1uojxd.fsf@gnus.org> <86czmakaem.fsf@mail.linkov.net> <87tufmnuz6.fsf@gnus.org> <86bl1uyt8f.fsf@mail.linkov.net> <87r1aocf5p.fsf@gnus.org> <83czm7xozh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2309"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 40774@debbugs.gnu.org, Lars Ingebrigtsen , ndame@protonmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 08 20:36:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mv2jl-0000Qe-LS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Dec 2021 20:36:21 +0100 Original-Received: from localhost ([::1]:45570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mv2jk-0000zs-LL for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Dec 2021 14:36:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mv2df-0003Ra-Ij for bug-gnu-emacs@gnu.org; Wed, 08 Dec 2021 14:30:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mv2df-0003hJ-BM for bug-gnu-emacs@gnu.org; Wed, 08 Dec 2021 14:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mv2df-0004Mg-8h for bug-gnu-emacs@gnu.org; Wed, 08 Dec 2021 14:30:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Dec 2021 19:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40774 X-GNU-PR-Package: emacs Original-Received: via spool by 40774-submit@debbugs.gnu.org id=B40774.163899178516719 (code B ref 40774); Wed, 08 Dec 2021 19:30:03 +0000 Original-Received: (at 40774) by debbugs.gnu.org; 8 Dec 2021 19:29:45 +0000 Original-Received: from localhost ([127.0.0.1]:41448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv2dN-0004Lb-CD for submit@debbugs.gnu.org; Wed, 08 Dec 2021 14:29:45 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:34053) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mv2dL-0004L1-4h for 40774@debbugs.gnu.org; Wed, 08 Dec 2021 14:29:43 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id BE5F660009; Wed, 8 Dec 2021 19:29:35 +0000 (UTC) In-Reply-To: <83czm7xozh.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 08 Dec 2021 14:25:38 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221944 Archived-At: >> > 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 * 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, --