GNU bug report logs - #57804
An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Wed, 14 Sep 2022 15:07:01 UTC

Severity: normal

Tags: wontfix

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #153 received at 57804 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> gmail.com>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, Eli Zaretskii <eliz <at> gnu.org>,
 57804 <at> debbugs.gnu.org, Paul Pogonyshev <pogonyshev <at> gmail.com>
Subject: Re: 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 <at> 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




This bug report was last modified 2 years and 230 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.