Subject: bug#25672: Font-locking issues when font-lock-fontified is nil

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 30 Oct 2019 17:07:10 +0100

Clément Pit--Claudel <[email-masked]> writes:

> Eli remarked the following:
>
>> However, please explain why font-lock-ensure-function calls
>> font-lock-DEFAULT-fontify-buffer.  If it's supposed to be good for
>> any mode, why
>> does it call the default fontification?
>>
>> As a matter of fact, if I replace the font-lock-default-fontify-buffer
>> call with a call to font-lock-fontify-buffer, the problem described by
>> the OP goes away.  That is why I said what I said.
>
> And Stefan answered:
>
>> I haven't seen the beginning of the thread, but if that fixes the
>> problem, then I think it's a good change.
>>
>> To go back to the previous question.  I guess I used
>> font-lock-default-fontify-buffer because the whole point is to get rid
>> of all the misuses of font-lock-fontify-buffer, but I think in this case
>> it's indeed the right thing to do.

I think this was fixed last year-ish if I'm reading the change log
correctly.

Currently, font-lock-ensure calls the value of
font-lock-ensure-function, which has a default value of

  (lambda (beg end)
    (unless font-lock-fontified
      (save-excursion
        (font-lock-fontify-region beg end))))

If global-font-lock-mode is on, it's jit-lock-fontify-now.

So I think this now works better, and I'm closing this bug report.  If
this is still an issue, please reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no