Hi!

I have given some thought to the other end of the problem (if we should allow shrinking regions) -- how should font-lock behave when there are functions that pull in different directions (and it will also handle the case when a single function returns non-nil without changing the region).

The loop could keep track of which regions it has stared with. When a functions change the region, the new region it is recorded and the loop restarts. When the region is resized into something that has already been seen it doesn't restart. This would allow the region to shrink and grow, without hanging.

When having conflicting functions, the result is somewhat arbitrary. Effectively, functions later i the list take precedence over earlier, but picking one result is better than a hanging Emacs.

    -- Anders


On Thu, May 28, 2020 at 9:15 PM Tom Tromey <tom@tromey.com> wrote:
>> You can enlarge (or even reduce) the region to refontify by setting
>> the following variable:

Dmitry> This is about font-lock-extend-after-change-region-function, though,
Dmitry> isn't it?

Wow, I totally misread that.  Yeah, I agree.

Dmitry> If we don't find good examples, though, and if we agree that the
Dmitry> design seems sound, we can turn it off on master and see if anyone
Dmitry> complains.

I think it would be better to try it a bit first.

Tom