emacs-devel
[Top][All Lists]
Advanced

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

Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes


From: Dmitry Gutov
Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049.
Date: Sat, 16 Nov 2019 00:43:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 13.11.2019 23:19, Alan Mackenzie wrote:
     (ii) This latter function uses vertical-motion to count the lines.
     (iii) vertical-motion triggers jit-lock fontification.
     (iv) This calls (eventually) c-font-lock-fontify-region.

By the way, I had a thought.

Like, normally font-lock does widen the buffer before fontifying anything. So I was wondering, why doesn't this happen between steps iii and iv somewhere?

Turns out, the (unless font-lock-dont-widen (widen)) calls are performed inside the default values of font-lock-fontify-region-function and font-lock-fontify-buffer-function.

But CC Mode sets font-lock-fontify-region-function to a different value, and that specific function doesn't include this piece of code. Or rather, didn't. The new commit added an unconditional (widen) call.

I think if you simply wrap it in (unless font-lock-dont-widen ...), it will improve compatibility with mmm-mode already (without adverse effects, I imagine). After that, you could audit if the other (widen) calls spread across CC Mode are still necessary. Maybe they're used in indentation code (that's also solvable). Maybe also by some other commands.



reply via email to

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