]> git.eshelyaron.com Git - emacs.git/commitdiff
scope.el, elisp-mode.el: Recognize EIEIO slot names.
authorEshel Yaron <me@eshelyaron.com>
Sun, 9 Feb 2025 14:39:09 +0000 (15:39 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Feb 2025 14:45:16 +0000 (15:45 +0100)
lisp/emacs-lisp/scope.el
lisp/progmodes/elisp-mode.el

index 726459a200d4b1d113b012ead24d336e80b29824..ee3e8df28df0c6ab2ad23fb7516232f5cffda96b 100644 (file)
@@ -1281,10 +1281,21 @@ a (possibly empty) list of safe macros.")
     (setq args (cddr args))))
 
 (scope-define-function-analyzer provide-theme (name &rest _)
-  (when-let ((q (scope--unqoute name)))  (scope-report-s q 'theme)))
+  (when-let ((q (scope--unqoute name))) (scope-report-s q 'theme)))
 
 (put 'custom-declare-theme 'scope-analyzer #'scope--analyze-provide-theme)
 
+(scope-define-function-analyzer eieio-oref (_obj slot)
+  (when-let ((q (scope--unqoute slot))) (scope-report-s q 'slot)))
+
+(dolist (fun '(slot-boundp slot-makeunbound slot-exists-p eieio-oref-default))
+  (put fun 'scope-analyzer #'scope--analyze-eieio-oref))
+
+(scope-define-function-analyzer eieio-oset (_obj slot _value)
+  (when-let ((q (scope--unqoute slot))) (scope-report-s q 'slot)))
+
+(put 'eieio-oset-default 'scope-analyzer #'scope--analyze-eieio-oset)
+
 (scope-define-macro-analyzer define-globalized-minor-mode (l global mode turn-on &rest body)
   (scope-report-s mode 'function)
   (scope-report-s turn-on 'function)
@@ -1353,7 +1364,7 @@ a (possibly empty) list of safe macros.")
     (scope-n l statements)))
 
 (scope-define-macro-analyzer go (_l label)
-  ;; Change to a local macro defintion induced by `cl-tagbody'.
+  ;; TODO: Change to a local macro defintion induced by `cl-tagbody'.
   (when-let ((bare (scope-sym-bare label))
              (pos (alist-get bare scope-label-alist))
              (beg (scope-sym-pos label)))
index fe0cee2b565bf5e8579f18609f4fa52661cd5c7c..2adbc85e22efae02774483b13ca2b08c9b0b069a 100644 (file)
@@ -428,6 +428,7 @@ happens in interactive invocations."
      (declaration   "Declaration")
      (rx-construct  "`rx' construct")
      (theme         "Theme")
+     (slot          "Slot")
      (widget-type   "Widget type")
      (type          "Type")
      (group         "Customization group")
@@ -454,6 +455,7 @@ happens in interactive invocations."
                          (declaration   'font-lock-variable-use-face)
                          (rx-construct  'elisp-rx)
                          (theme         'elisp-theme)
+                         (slot          'font-lock-builtin-face)
                          (widget-type   'font-lock-type-face)
                          (type          'font-lock-type-face)
                          (group         'font-lock-type-face)