Subject: bug#45898: 27.1; wedged in redisplay again

From: Eli Zaretskii <[email-masked]>
Date: Tue, 07 Jun 2022 17:00:01 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked], Eli Zaretskii <[email-masked]>
> Date: Tue, 07 Jun 2022 15:37:08 +0200
> 
> Devon Sean McCullough <[email-masked]> writes:
> 
> > If lldb forces read_char to return Qnil or redisplay_internal to return,
> > will Emacs crash immediately or survive long enough to save all buffers
> > or better yet continue working?
> 
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
> 
> It probably won't continue working, but it's hard to say.

I think it is more important to realize that Emacs will re-enter
redisplay right away.

> > P.S.  If there exists a way to quickly and safely abort redisplay,
> > perhaps there should be a hook invoked when repeated keyboard-quit
> > has no effect, allowing experimentation into workarounds for this
> > apparently intractable redisplay problem?
> 
> I wonder whether there's been any discussion about handling `C-g' during
> redisplay.  For instance, if the user hits `C-g' six times in a row
> during redisplay, that should be an indication that perhaps Emacs should
> stop doing what it's doing -- and, for instance, switch on so-long-mode.
> 
> Eli, would it be possible to implement something like that?

Not directly from redisplay, I think, no.

We could perhaps push an event onto the input queue that would do
something Lispy when processed, like turn on some mode.  But I think
the main problem here is that we don't necessarily read the keyboard
or do QUIT processing inside redisplay, at least the parts of it which
triggered this discussion.

We also don't currently have any mechanism to quickly exit redisplay,
so we will need to develop that somehow.

Basically, each time this issue comes up, I get the impression that it
is not quite clear what (not how, but what) people would like to
happen.  They want to unwedge Emacs, that much is clear, but what to
do after that to avoid immediately wedging it again?  Because even
so-long-mode is not a guarantee of getting a responsive Emacs.