Subject: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang

From: Tom Tromey <[email-masked]>
Date: Thu, 28 May 2020 10:13:39 -0600

Anders> Hi!To me it&#39;s obviously a bug. First, the name of the
Anders> function contains "extend", not "change".

Yes, but the manual says:

   You can enlarge (or even reduce) the region to refontify by setting
the following variable:

See (info "(elisp) Region to Refontify")

Anders> Without having a deep knowledge of this, I don&#39;t think this
Anders> do the correct thing when font-lock-beg is at the end of a line
Anders> (as it is when the line is empty). The problem is that the code
Anders> move forward one character (the newline) and then search
Anders> backward with line-beginning-position (i.e. the beginning of the
Anders> line following the original font-lock-beg) as limit, effectively
Anders> shrinking the region.

IIRC this weird thing was needed to correctly find the spot where the
property change really occurred, without having trouble when starting
exactly on the boundary.

I don't remember the test case.  Not sure if the self-tests cover this;
maybe it's archived in a bug somewhere though.

Tom