unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61640: 30.0.50; Help Elisp xref recognize defclass parent classes
@ 2023-02-19 22:08 Eric Abrahamsen
  2023-02-19 22:42 ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2023-02-19 22:08 UTC (permalink / raw)
  To: 61640

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]


In a form such as this:

(defclass ebdb-field-id (ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)
  ((label-list :initform 'ebdb-id-label-list)
   ...
   ))

All the symbols in

(ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)

should be recognized by `elisp--xref-infer-namespace' as 'function.
Right now, this is treated like a function call (ie like '(function
variable variable)).

I can't promise that the attached patch is exactly the right thing, but
it ought to be pretty close.

Thanks,
Eric


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: elispxrefdefclass.diff --]
[-- Type: text/x-patch, Size: 585 bytes --]

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 1c339d08148..f7cd9e90926 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -943,6 +943,10 @@ elisp--xref-infer-namespace
                                  cl-defmethod cl-defgeneric)))
             ;; (defun FUNC (... IDENT
             'variable)
+           ((and (eql j 2)
+                 (eq j-head 'defclass))
+            ;; (defclass CLASS (... IDENT
+            'function)
            ((eq j-head 'cond)
             ;; (cond ... (... IDENT
             'variable)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-20  1:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-19 22:08 bug#61640: 30.0.50; Help Elisp xref recognize defclass parent classes Eric Abrahamsen
2023-02-19 22:42 ` Dmitry Gutov
2023-02-19 23:45   ` Eric Abrahamsen
2023-02-20  1:05     ` Dmitry Gutov
2023-02-20  1:43       ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).