diff options
| author | Eric Abrahamsen | 2023-02-20 03:01:41 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2023-02-20 03:01:41 +0200 |
| commit | cac13e360547f95ec64d34f38003dfc7ff1a97ee (patch) | |
| tree | e546fb00ec5d2dbc2cdaa7a633becad08a68444e | |
| parent | 9e745ed3f2c53f9ca46e763c8eac66a1cf8611c6 (diff) | |
| download | emacs-cac13e360547f95ec64d34f38003dfc7ff1a97ee.tar.gz emacs-cac13e360547f95ec64d34f38003dfc7ff1a97ee.zip | |
Help Elisp xref recognize defclass parent classes
* lisp/progmodes/elisp-mode.el (elisp--xref-infer-namespace):
Handle defclass parents (bug#61640).
* test/lisp/progmodes/elisp-mode-tests.el (elisp-mode-infer-namespace):
New case in the test.
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 4 | ||||
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 5 |
2 files changed, 9 insertions, 0 deletions
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 @@ namespace but with lower confidence." | |||
| 943 | cl-defmethod cl-defgeneric))) | 943 | cl-defmethod cl-defgeneric))) |
| 944 | ;; (defun FUNC (... IDENT | 944 | ;; (defun FUNC (... IDENT |
| 945 | 'variable) | 945 | 'variable) |
| 946 | ((and (eql j 2) | ||
| 947 | (eq j-head 'defclass)) | ||
| 948 | ;; (defclass CLASS (... IDENT | ||
| 949 | 'function) | ||
| 946 | ((eq j-head 'cond) | 950 | ((eq j-head 'cond) |
| 947 | ;; (cond ... (... IDENT | 951 | ;; (cond ... (... IDENT |
| 948 | 'variable) | 952 | 'variable) |
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 57b39a49801..5b6ef88dceb 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el | |||
| @@ -1004,6 +1004,11 @@ evaluation of BODY." | |||
| 1004 | (should (equal (elisp--xref-infer-namespace p6) 'function))) | 1004 | (should (equal (elisp--xref-infer-namespace p6) 'function))) |
| 1005 | 1005 | ||
| 1006 | (elisp-mode-test--with-buffer | 1006 | (elisp-mode-test--with-buffer |
| 1007 | (concat "(defclass child-class ({p1}parent-1 {p2}parent-2))\n") | ||
| 1008 | (should (equal (elisp--xref-infer-namespace p1) 'function)) | ||
| 1009 | (should (equal (elisp--xref-infer-namespace p2) 'function))) | ||
| 1010 | |||
| 1011 | (elisp-mode-test--with-buffer | ||
| 1007 | (concat "(require '{p1}alpha)\n" | 1012 | (concat "(require '{p1}alpha)\n" |
| 1008 | "(fboundp '{p2}beta)\n" | 1013 | "(fboundp '{p2}beta)\n" |
| 1009 | "(boundp '{p3}gamma)\n" | 1014 | "(boundp '{p3}gamma)\n" |