Fontify special forms and macros the same

* lisp/emacs-lisp/lisp-mode.el (lisp--el-match-keyword): Handle
special forms and macros the same way (bug#43265).  This makes
things like (setq a '(if a b)) be fontified correctly (i.e., not
fontified as a keyword).
This commit is contained in:
Lars Ingebrigtsen 2021-01-25 07:44:29 +01:00
parent 9503f8d96c
commit a10c74fbea
2 changed files with 3 additions and 5 deletions

View file

@ -257,10 +257,9 @@
(concat "(\\(" lisp-mode-symbol-regexp "\\)\\_>")) (concat "(\\(" lisp-mode-symbol-regexp "\\)\\_>"))
limit t) limit t)
(let ((sym (intern-soft (match-string 1)))) (let ((sym (intern-soft (match-string 1))))
(when (or (special-form-p sym) (when (and (or (special-form-p sym) (macrop sym))
(and (macrop sym) (not (get sym 'no-font-lock-keyword))
(not (get sym 'no-font-lock-keyword)) (lisp--el-funcall-position-p (match-beginning 0)))
(lisp--el-funcall-position-p (match-beginning 0))))
(throw 'found t)))))) (throw 'found t))))))
(defmacro let-when-compile (bindings &rest body) (defmacro let-when-compile (bindings &rest body)

View file

@ -871,7 +871,6 @@ to (xref-elisp-test-descr-to-target xref)."
'font-lock-keyword-face))) 'font-lock-keyword-face)))
(ert-deftest test-elisp-font-keywords-3 () (ert-deftest test-elisp-font-keywords-3 ()
:expected-result :failed ; FIXME bug#43265
(should (eq (test--font '(setq a '(if when zot)) (should (eq (test--font '(setq a '(if when zot))
"(\\(if\\)") "(\\(if\\)")
nil))) nil)))