Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely

From: Eli Zaretskii <[email-masked]>
Date: Fri, 16 Sep 2022 09:31:47 +0300

> From: Paul Pogonyshev <[email-masked]>
> Date: Thu, 15 Sep 2022 22:40:24 +0200
> Cc: Eli Zaretskii <[email-masked]>, [email-masked], Lars Ingebrigtsen <[email-masked]>
> 
> It is impossible to correctly fontify log buffers if you are
> restricted to semi-arbitrary parts of it: you need to at least see
> where the current entry starts, even if it for whatever reason
> includes a line with 100 K characters.

In buffers with very long lines, fontifications are supposed and
requested to simplify their act so as not to need access to arbitrary
portions of the buffer outside the restriction.  If such
simplification is for some reason impossible or impractical, then the
code called from fontification-functions should at least be amended
not to produce infloops when its calls to 'widen' don't widen.

This is all part of solving a long-standing problem in Emacs with
becoming completely unresponsive when displaying buffers with very
long lines.  It is understood and accepted that in some cases this
will come at a price of less accurate fontifications or minor glitches
in other features.

> > It isn't for me personally, no.  It is important for Emacs users.
> 
> How about letting Emacs users decide for themselves?

The users already can decide for themselves: they can set the
long-line-threshold variable to larger values or even to nil.

> Let Logview
> behave against your recommendations. And then, when the users discover
> how crappy and unresponsive it is, as a result, compared to everything
> else, they will just uninstall the package and use something better.

We expect package developers to cooperate with our effort of making
Emacs responsive and reasonably functional in buffers with very long
lines.