Subject: bug#51490: Show an indicator when Emacs is busy somewhere in the Emacs window

From: Eli Zaretskii <[email-masked]>
Date: Wed, 21 Sep 2022 16:05:17 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 21 Sep 2022 14:01:13 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Mode line is drawn in C, not in Lisp.
> >
> > And if the problem is that we cannot run the display code, either,
> > then how would it help to poke the glyph?  It won't be shown on the
> > glass, because redisplay cannot run.  Right?  Or what am I missing?
> 
> Redisplay can run, but we can't run any Lisp code, and the normal
> formatting of a mode line does (potentially) run lots of Lisp code,
> doesn't it?

That's true, but if Lisp cannot run, neither can redisplay.  They both
access the internal Emacs state: buffers, variables, etc.  Even to
replace a single glyph, you'd need to access faces, right?

Also, poking a single glyph on a GUI frame is unsafe, because no one
can be sure the new glyph will have the same metrics as the old one.

So I think if we want some kind of feature that displays progress
indicator while Emacs is busy, we'd need to develop it.
hourglass-cursor just raises a flag and does it only once, so it can
run from an atimer.  Anything more complex will probably need another
Lisp thread, and calls to synchronization functions (sit-for,
thread-yield, etc.) from the main thread.  Or something.

Or maybe we can run some async subprocess which will display some
animation?