From: Lars Ingebrigtsen Date: Mon, 24 Jan 2022 10:55:57 +0000 (+0100) Subject: Make `font-lock-add-keywords' work in derived modes X-Git-Tag: emacs-29.0.90~2800 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=77b72f77b3a5d13fc6e71746dee2cf68305057e2;p=emacs.git Make `font-lock-add-keywords' work in derived modes * lisp/font-lock.el (font-lock-set-defaults): Make `font-lock-add-keywords' work in derived modes (bug#24176). --- diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 083bfb8626b..d8a1fe399b6 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1906,8 +1906,9 @@ preserve `hi-lock-mode' highlighting patterns." Sets various variables using `font-lock-defaults' and `font-lock-maximum-decoration'." ;; Set fontification defaults if not previously set for correct major mode. - (unless (and font-lock-set-defaults - (eq font-lock-major-mode major-mode)) + (when (or (not font-lock-set-defaults) + (not font-lock-major-mode) + (not (derived-mode-p font-lock-major-mode))) (setq font-lock-major-mode major-mode) (setq font-lock-set-defaults t) (let* ((defaults font-lock-defaults)