Subject: Re: bug#57684: locked narrowing breaks existing code without an apparent way to repair

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 Sep 2022 09:33:06 +0300

> From: Richard Stallman <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 16 Sep 2022 23:40:19 -0400
> 
>   > It is still true.  The problem exists only with Lisp code that is run
>   > when QUITs are either intentionally disabled, or when Lisp is run from
>   > the display engine, where QUIT is caught and basically ignored.  The
>   > particular case which started this thread is of the latter variety.
> 
> I never allowed redisplay to run Lisp code -- it seemed very dangerous.
> An error there could leave redisplay data structures inconsistent.

That ship sailed a long time ago: Emacs 21 introduced jit-lock.el,
which is a way of running font-lock as part of redisplay, on the
portion of the buffer which is about to be displayed.  This is on by
default since Emacs 21.

In addition, we have several hooks, notably window-scroll-functions,
which redisplay runs when appropriate.

Search xdisp.c for "safe_call" to see where and why we call Lisp from
redisplay.  Yes, it's somewhat dangerous, and caused us nontrivial
issues over the years, but I don't think it's possible to go back to
not calling Lisp from the display code.