bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ihor Radchenko
Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely
Date: Fri, 16 Sep 2022 09:17:00 +0800

Gregory Heytings <gregory@heytings.org> writes:

>> Depending on the mode being activated before Emacs decides to enable the 
>> optimization (e.g. because one of the first lines is very long, I don't 
>> know how exactly this is determined) seems very shaky.
>
> Indeed.  As I told you the proper fix is not to disable these 
> optimizations, but to adapt the code to handle locked narrowing, by 
> explicitly unlocking the locked narrowing when, and only when, it needs to 
> access a larger portion of the buffer.

I would like to point out that some fontification code may use functions
not specifically designed for the fontification. Moreover, the functions
used by fontification may depend on user-defined hooks that can potentially
contain unsuspecting (widen) calls.

While I understand why locked narrowing is needed in buffers with large
files, I would find it helpful if Emacs could throw some kind of warning
when widen is called from inside locked narrowing. It will, at least,
help with adapting the existing fontification code in the new Emacs
versions.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92





reply via email to

[Prev in Thread] Current Thread [Next in Thread]