all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
Cc: esr@thyrsus.com, emacs-devel@gnu.org
Subject: Re: Insight into the mystery hangs
Date: Tue, 13 Feb 2024 14:56:37 +0200	[thread overview]
Message-ID: <8634twr08q.fsf@gnu.org> (raw)
In-Reply-To: <871q9gg5sp.fsf@gmail.com> (message from Kévin Le Gouguec on Tue, 13 Feb 2024 08:52:06 +0100)

> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>
> Cc: "Eric S. Raymond" <esr@thyrsus.com>,  emacs-devel@gnu.org
> Date: Tue, 13 Feb 2024 08:52:06 +0100
> 
> Eli Zaretskii <eliz@gnu.org> 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.



  reply	other threads:[~2024-02-13 12:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 21:37 Insight into the mystery hangs Eric S. Raymond
2024-02-12 12:38 ` Alan Mackenzie
2024-02-12 12:52 ` Eli Zaretskii
2024-02-12 18:26   ` Eric S. Raymond
2024-02-12 19:22     ` Eli Zaretskii
2024-02-13  7:52   ` Kévin Le Gouguec
2024-02-13 12:56     ` Eli Zaretskii [this message]
2024-02-13 23:05       ` Kévin Le Gouguec

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=8634twr08q.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esr@thyrsus.com \
    --cc=kevin.legouguec@gmail.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.