Subject: v2 of patch

From: [email-masked]
Date: Mon, 24 Jul 2023 20:57:30 -0400

Sorry, I left some debug logging in the patch sent with the bug
report.

>From 7784ccf8555e31485c61468ee5c18533a2331421 Mon Sep 17 00:00:00 2001
From: Neal Sidhwaney <[email-masked]>
Date: Sun, 23 Jul 2023 19:25:51 -0400
Subject: [PATCH] Add define-error to font lock keywords for emacs-lisp-mode

Also bump up test coverage for keywords to ensure they are fontified.
---
 lisp/emacs-lisp/lisp-mode.el            |  2 +-
 test/lisp/emacs-lisp/lisp-mode-tests.el | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 1990630608d..f1cacebb964 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -361,7 +361,7 @@ This will generate compile-time constants from BINDINGS."
                  "define-globalized-minor-mode" "define-skeleton"
                  "define-widget" "ert-deftest"))
      (el-vdefs '("defconst" "defcustom" "defvaralias" "defvar-local"
-                 "defface"))
+                 "defface" "define-error"))
      (el-tdefs '("defgroup" "deftheme"))
      (el-errs '("user-error"))
      ;; Common-Lisp constructs supported by EIEIO.  FIXME: namespace.
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 3e906497020..825e6b6ab80 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -355,5 +355,28 @@ Expected initialization file: `%s'\"
   ;;   (should (equal (lisp-current-defun-name) "defblarg")))
   )
 
+(ert-deftest test-font-lock-keywords ()
+  "Keywords should be fontified in `font-lock-keyword-face`."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (mapc (lambda (el-keyword)
+            (erase-buffer)
+            (insert (format "(%s some-symbol () \"hello\"" el-keyword))
+            (font-lock-ensure)
+            ;; Verify face property throughout the keyword
+            (let* ((begin (1+ (point-min)))
+                   (end (1- (+ begin (length el-keyword)))))
+              (mapc (lambda (pos)
+                      (should (equal (get-text-property pos 'face)
+                                     'font-lock-keyword-face)))
+                    (number-sequence begin end))))
+          '("defsubst" "cl-defsubst" "define-inline"
+            "define-advice" "defadvice" "defalias"
+            "define-derived-mode" "define-minor-mode"
+            "define-generic-mode" "define-global-minor-mode"
+            "define-globalized-minor-mode" "define-skeleton"
+            "define-widget" "ert-deftest" "defconst" "defcustom"
+            "defvaralias" "defvar-local" "defface" "define-error"))))
+
 (provide 'lisp-mode-tests)
 ;;; lisp-mode-tests.el ends here
-- 
2.41.0