]> git.eshelyaron.com Git - emacs.git/commitdiff
scope.el,elisp-mode.el: Recognize some more definition types
authorEshel Yaron <me@eshelyaron.com>
Sat, 18 Jan 2025 17:43:50 +0000 (18:43 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 18 Jan 2025 17:43:50 +0000 (18:43 +0100)
lisp/emacs-lisp/scope.el
lisp/progmodes/elisp-mode.el

index 970fc99f62cdce6b5851f4913f377817b3236855..87920831384776a6bdd4250128490808171dbd00 100644 (file)
@@ -804,7 +804,39 @@ a (possibly empty) list of safe macros.")
                          (prnt (cadr prnt-form))
                          (beg (scope-sym-pos prnt))
                          (bare (scope-sym-bare prnt)))
-               (funcall scope-callback 'widget-type beg (length (symbol-name bare)) nil))))
+               (funcall scope-callback 'widget-type beg (length (symbol-name bare)) nil)))
+            ((define-error)
+             (when-let* ((name-form (car forms))
+                         ((memq (scope-sym-bare (car-safe name-form)) '(quote \`)))
+                         (name (cadr name-form))
+                         (beg (scope-sym-pos name))
+                         (bare (scope-sym-bare name)))
+               (funcall scope-callback 'condition beg (length (symbol-name bare)) nil))
+             (when-let* ((prnt-form (caddr forms))
+                         ((memq (scope-sym-bare (car-safe prnt-form)) '(quote \`))))
+               (dolist (prnt (ensure-list (cadr prnt-form)))
+                 (when-let* ((beg (scope-sym-pos prnt)) (bare (scope-sym-bare prnt)))
+                   (funcall scope-callback 'condition beg (length (symbol-name bare)) nil)))))
+            ((provide-theme custom-declare-theme)
+             (when-let* ((name-form (car forms))
+                         ((memq (scope-sym-bare (car-safe name-form)) '(quote \`)))
+                         (name (cadr name-form))
+                         (beg (scope-sym-pos name))
+                         (bare (scope-sym-bare name)))
+               (funcall scope-callback 'theme beg (length (symbol-name bare)) nil)))
+            ((defvaralias)
+             (when-let* ((new-form (car forms))
+                         ((memq (scope-sym-bare (car-safe new-form)) '(quote \`)))
+                         (name (cadr new-form))
+                         (beg (scope-sym-pos name))
+                         (bare (scope-sym-bare name)))
+               (funcall scope-callback 'defvar beg (length (symbol-name bare)) nil))
+             (when-let* ((base-form (cadr forms))
+                         ((memq (scope-sym-bare (car-safe base-form)) '(quote \`)))
+                         (name (cadr base-form))
+                         (beg (scope-sym-pos name))
+                         (bare (scope-sym-bare name)))
+               (funcall scope-callback 'variable beg (length (symbol-name bare)) nil))))
           (when (symbol-with-pos-p f)
             (funcall scope-callback 'function
                      (symbol-with-pos-pos f) (length (symbol-name bare))
index 83f5cf6d9a0bfd5ef45a66ae0650f86a92a1e2cf..f2fd5722413d44c7067013e6a445c6d04ad9446f 100644 (file)
@@ -359,6 +359,10 @@ happens in interactive invocations."
   "Face for highlighting feature names in Emacs Lisp code."
   :group 'lisp)
 
+(defface elisp-theme '((t :inherit font-lock-constant-face))
+  "Face for highlighting custom theme names in Emacs Lisp code."
+  :group 'lisp)
+
 (defface elisp-binding-variable
   '((t :slant italic :inherit font-lock-variable-name-face))
   "Face for highlighting binding occurrences of variables in Emacs Lisp code."
@@ -426,6 +430,7 @@ happens in interactive invocations."
      (special-form  "Special form")
      (throw-tag     "`throw'/`catch' tag")
      (feature       "Feature")
+     (theme         "Theme")
      (widget-type   "Widget type")
      (type          "Type")
      (group         "Customization group")
@@ -448,6 +453,7 @@ happens in interactive invocations."
                          (special-form  'elisp-special-form)
                          (throw-tag     'elisp-throw-tag)
                          (feature       'elisp-feature)
+                         (theme         'elisp-theme)
                          (widget-type   'font-lock-type-face)
                          (type          'font-lock-type-face)
                          (group         'font-lock-type-face)