1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

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).
This commit is contained in:
Lars Ingebrigtsen 2019-10-31 14:06:08 +01:00
parent 60ad3d63cf
commit 111a95fe6d

View File

@ -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)))