From a2863d5aace13c1ea1a72e3bcd63425a7d9f105d Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 9 Feb 2025 15:39:09 +0100 Subject: [PATCH] scope.el, elisp-mode.el: Recognize EIEIO slot names. --- lisp/emacs-lisp/scope.el | 15 +++++++++++++-- lisp/progmodes/elisp-mode.el | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el index 726459a200d..ee3e8df28df 100644 --- a/lisp/emacs-lisp/scope.el +++ b/lisp/emacs-lisp/scope.el @@ -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))) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index fe0cee2b565..2adbc85e22e 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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) -- 2.39.5