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: Sun, 12 Dec 2021 22:18:29 +0200 Organization: LINKOV.NET Message-ID: <86v8ztfuga.fsf@mail.linkov.net> References: <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> <86wnkerjgt.fsf@mail.linkov.net> <8335n2x3w5.fsf@gnu.org> <865yrtiqb6.fsf@mail.linkov.net> <83wnk9mwmx.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="34754"; 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, larsi@gnus.org, ndame@protonmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 12 21:22:14 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 1mwVMM-0008qz-7k for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 21:22:14 +0100 Original-Received: from localhost ([::1]:39122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwVML-0006cd-5H for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 15:22:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwVMA-0006cG-S4 for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 15:22:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwVMA-0003BF-Jd for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 15:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwVMA-0002R6-FU for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 15:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Dec 2021 20:22:02 +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.16393404659298 (code B ref 40774); Sun, 12 Dec 2021 20:22:02 +0000 Original-Received: (at 40774) by debbugs.gnu.org; 12 Dec 2021 20:21:05 +0000 Original-Received: from localhost ([127.0.0.1]:53244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwVLE-0002Pu-QH for submit@debbugs.gnu.org; Sun, 12 Dec 2021 15:21:05 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:33145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwVLC-0002Ol-Qs for 40774@debbugs.gnu.org; Sun, 12 Dec 2021 15:21:03 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 3CCA4240004; Sun, 12 Dec 2021 20:20:54 +0000 (UTC) In-Reply-To: <83wnk9mwmx.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 12 Dec 2021 21:49:26 +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:222266 Archived-At: >> >> +** 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.