Subject: Re: 26.1; mhtml-mode fails to capture font-lock-keywords-case-fold-search

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 30 Oct 2019 20:26:44 +0100

Leo Liu <[email-masked]> writes:

> In mhtml-mode moving into <script>...</script> doesn't set up
> font-lock-keywords-case-fold-search properly, which still has the value
> carried over from html-mode.
>
> The reason is font-lock doesn't make font-lock-keywords-case-fold-search
> buffer-local when its value is nil thus it is skipped by
> mhtml--construct-submode.

This is due to

commit 558ca3c1225f6035442733d5d3fb5fd4c40a0a45
Author: Stefan Monnier <[email-masked]>
Date:   Tue Feb 12 16:49:21 2008 +0000

    (font-lock-set-defaults): Unset previously set variables when needed.

which does this with many of the font-lock variables:

       ;; Case fold during regexp fontification?
-      (when (nth 2 defaults)
-	(set (make-local-variable 'font-lock-keywords-case-fold-search) t))
+      (if (nth 2 defaults)
+          (set (make-local-variable 'font-lock-keywords-case-fold-search) t)
+        (kill-local-variable 'font-lock-keywords-case-fold-search))

It's slightly puzzling -- font-lock-keywords-case-fold-search is
permanently buffer-local, but I guess that puzzlement was there before
this patch, but the kill-local-variable thing is what makes mhtlm not
work.

Stefan, do you remember the reason for this change?

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