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

From: Gregory Heytings <[email-masked]>
Date: Thu, 15 Sep 2022 22:16:36 +0000

>
> I don't know why, this is a hypothetical, but fairly realistic 
> situation, right?
>

Discussing hypothetical issues leads nowhere, according to my experience. 
Let's focus on actual issues.

>
> Now, let's say function `logview-do-bla-bla-bla' cannot work with 
> narrowed buffer (half of functions in Logview cannot).
>

You said I'm not allowed to tell you that your code could do things 
differently, but that doesn't mean it isn't true.  It is for example 
possible to parse the buffer outside of fontification-functions and to use 
the result of that parsing inside fontification-functions.  Yet another 
method would be to use a simpler fontification method in buffers with too 
long lines.  Yet another method would be to turn font locking off in 
buffers with too long lines.  Yet another method would be to truncate too 
long lines.  I also cannot understand why it is necessary, in log files in 
which all lines are independent, to move beyond the beginning and end of a 
line to decide how it must be fontified.

> 
> Will I be able to lift locked narrowing restrictions without knowing the 
> tag?
>

This is akin to a security mechanism, there is no reason to make it 
possible to turn it off "too easily".