From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Insight into the mystery hangs Date: Tue, 13 Feb 2024 14:56:37 +0200 Message-ID: <8634twr08q.fsf@gnu.org> References: <20240211213737.3A38C18A1647@snark.thyrsus.com> <868r3psv2s.fsf@gnu.org> <871q9gg5sp.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19800"; mail-complaints-to="usenet@ciao.gmane.io" Cc: esr@thyrsus.com, emacs-devel@gnu.org To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 13 13:57:29 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rZsLn-0004uc-Uh for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Feb 2024 13:57:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZsL6-0006E6-DF; Tue, 13 Feb 2024 07:56:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZsL4-0006Dn-9V for emacs-devel@gnu.org; Tue, 13 Feb 2024 07:56:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZsL3-0004UL-O4; Tue, 13 Feb 2024 07:56:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=sWxol9QQds8sRXGOFkKmmMmWdSA+2BWY/9Kkdd0da5s=; b=o21H43B1OMPTril8ndSU RltQb4ALCp6kOcJBueBJDqgNIh8ewMrFSAZZZNZKZuEX+pOElm0/IiacUnJVKLwQw8b4gQkEyHmNO czY2amn/kjj86HbUIzdj55ugh2WKKdUSJ65uNOf4/tm2D0jKU8lgknpgPuZpx43fVYF+5n9Ljh6y/ L9oU7N7Y3UNt04qKktH5UW8O4acTvBYk8CnssVW1DydEmQL9QXbpz/WeRVUNunt72PCXk49y6LTIE FlBs2H9J4YU31hTJBXiNyJSvybP57ZPM4PXlPhsh1M0fLzC4XXEfZhVqawvM4kkygQPncE1wa/6hU 6coqrLWom7ObKg==; In-Reply-To: <871q9gg5sp.fsf@gmail.com> (message from =?utf-8?Q?K=C3=A9vin?= Le Gouguec on Tue, 13 Feb 2024 08:52:06 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316172 Archived-At: > From: Kévin Le Gouguec > Cc: "Eric S. Raymond" , emacs-devel@gnu.org > Date: Tue, 13 Feb 2024 08:52:06 +0100 > > Eli Zaretskii writes: > > > Isn't that call issued from the mode-line display? If so, that is > > done from redisplay, and redisplay cannot enter debugger, so it > > catches all errors. If you want to produce Lisp backtraces from Lisp > > code called by redisplay, you need to use the facilities documented in > > the node "Debugging Redisplay" in the ELisp Reference manual. > > Tangential, not so much about debugging errors during redisplay, than > merely noticing them: I do periodically forget that these errors are > caught, so every couple of months I find myself frowning at code > (font-locking, usually) that misbehaves yet fails to throw an error for > about five minutes, before remembering to check *Messages* for any > "Error during redisplay". Yes, something to keep in mind. > 1. "For Science", I just did… > > (setq mode-line-format '(:eval (error "argh"))) > > … and I am surprised that this *Messages* diagnostic… > > > Error during redisplay: (eval (error "argh") t) signaled (error "argh") > > … never seems to make its way to the echo area? It's a small thing > (I'll probably have *Messages* open when debugging so I'll notice > eventually) but it is somewhat surprising that these warnings can > pile up in *Messages* yet the echo area remains blank. Question: what happens when a message is shown in the echo-area? Answer: Emacs triggers redisplay. Question: what happens in redisplay which was triggered by error message shown in the echo-area because of error during redisplay? Answer: the same error during redisplay will happen again, as part of the new redisplay cycle. Question: what will this do to Emacs? Answer: a never-ending sequence of error, displaying an error message, which causes another error, which displays the same error message, which causes the same error, etc. etc., ad nauseam. Question: what will the user see? Answer: a never-ending sequence of rapidly blinking windows, and an Emacs session that is unusable. > 2. It's neat that… > > (setq mode-line-format '("foo " (:eval (error "argh")) " bar")) > > … will be "robust" enough to display "foo bar" in the mode-line; > combined with the lack of echo-area reporting it does make it hard to > ever know something went wrong though. Where ignoring the problematic result can help us recover (at a price of botching the trouble-making Lisp), we do that. > Might it make sense to (have an option to) substitute a signaling > :eval form with some "[redisplay error]" placeholder? You mean, display the error on the mode line or something? We actually do that in some simple cases, but the problem is that the mode line has too little real-estate to show enough information without catastrophically wiping everything else. But if you want to work on a feature whereby a redisplay error adds some button on the mode line which, if pressed, will show the *Messages* buffer with the details, feel free. Just be aware of the following gotcha: changing how the mode line looks will also trigger a kind of redisplay.