From 111a95fe6d209aff6e7f26cb6777fbdf02aae15d Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 31 Oct 2019 14:06:08 +0100 Subject: [PATCH] Ensure that font-local variables are buffer-local * lisp/font-lock.el (font-lock-set-defaults): Ensure that the font lock variables are buffer-local even when nil, so that they're copied correctly by mhtml mode when changing sub-modes (bug#33937). --- lisp/font-lock.el | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4eb7bb8c2d4..875f5b0592d 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1902,18 +1902,13 @@ Sets various variables using `font-lock-defaults' and (removed-keywords (cdr-safe (assq major-mode font-lock-removed-keywords-alist)))) ;; Syntactic fontification? - (if (nth 1 defaults) - (set (make-local-variable 'font-lock-keywords-only) t) - (kill-local-variable 'font-lock-keywords-only)) + (setq-local font-lock-keywords-only (nth 1 defaults)) ;; Case fold during regexp fontification? - (if (nth 2 defaults) - (set (make-local-variable 'font-lock-keywords-case-fold-search) t) - (kill-local-variable 'font-lock-keywords-case-fold-search)) + (setq-local font-lock-keywords-case-fold-search (nth 2 defaults)) ;; Syntax table for regexp and syntactic fontification? (if (null (nth 3 defaults)) - (kill-local-variable 'font-lock-syntax-table) - (set (make-local-variable 'font-lock-syntax-table) - (copy-syntax-table (syntax-table))) + (setq-local font-lock-syntax-table nil) + (setq-local font-lock-syntax-table (copy-syntax-table (syntax-table))) (dolist (selem (nth 3 defaults)) ;; The character to modify may be a single CHAR or a STRING. (let ((syntax (cdr selem))) -- 2.39.5