From: Eshel Yaron Date: Mon, 9 Jun 2025 06:22:56 +0000 (+0200) Subject: scope.el: Handle oclosure--define X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c955ccd6203adefd4121541f86768dd88700a21b;p=emacs.git scope.el: Handle oclosure--define --- diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el index f56b75669b0..bfd83935f34 100644 --- a/lisp/emacs-lisp/scope.el +++ b/lisp/emacs-lisp/scope.el @@ -335,6 +335,27 @@ :imenu "Icon" :namespace 'icon) +(scope-define-symbol-type oclosure () + :doc "oclosure type names." + :face 'font-lock-type-face + :help (lambda (beg end _def) + (if-let ((sym (intern (buffer-substring-no-properties beg end)))) + (lambda (&rest _) + (if-let ((doc (oclosure--class-docstring (get sym 'cl--class)))) + (format "OClosure type `%S'.\n\n%s" sym doc) + "OClosure type")) + "OClosure type")) + :completion (constantly (lambda (sym) + (oclosure--class-p (get sym 'cl--class)))) + :namespace 'oclosure) + +(scope-define-symbol-type defoclosure () + :doc "oclosure type definitions." + :face 'font-lock-type-face + :help (constantly "OClosure type definition") + :imenu "OClosure type" + :namespace 'oclosure) + (defvar scope-counter nil) (defvar scope-local-functions nil) @@ -1500,6 +1521,20 @@ a (possibly empty) list of safe macros.") (scope-define-function-analyzer defalias (sym _def &optional _docstring) (when-let ((quoted (scope--unqoute sym))) (scope-report-s quoted 'defun))) +(scope-define-function-analyzer oclosure--define + (&optional name _docstring parent-names _slots &rest props) + (when-let ((quoted (scope--unqoute name))) (scope-report-s quoted 'defoclosure)) + (dolist (parent parent-names) + (when-let ((quoted (scope--unqoute parent))) (scope-report-s quoted 'oclosure))) + (while-let ((kw (car-safe props)) + (bkw (scope-sym-bare kw)) + ((keywordp bkw))) + (scope-report-s kw 'constant) + (case bkw + (:predicate + (when-let ((q (scope--unqoute (cadr props)))) (scope-report-s q 'defun)))) + (setq props (cddr props)))) + (scope-define-function-analyzer thing-at-point (thing &optional _) (when-let ((quoted (scope--unqoute thing))) (scope-report-s quoted 'thing)))