diff options
| author | Mattias EngdegÄrd | 2021-10-18 17:06:22 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2021-10-18 17:26:45 +0200 |
| commit | bb4209a5a5337f9c09c4ebb2a65415a41361d8da (patch) | |
| tree | a0d45ec5a495f364663bfe389fdcae16a0dd7a62 /test/lisp/progmodes | |
| parent | c163fd9260317adbb85a2274dab795a6a7f3061f (diff) | |
| download | emacs-bb4209a5a5337f9c09c4ebb2a65415a41361d8da.tar.gz emacs-bb4209a5a5337f9c09c4ebb2a65415a41361d8da.zip | |
Fix xref elisp identifier namespace mistake
Pressing `M-.` on ALPHA in
(let ((ALPHA BETA)) ...)
would incorrectly search for ALPHA as a function rather than a variable.
* lisp/progmodes/elisp-mode.el (elisp--xref-infer-namespace): Fix logic.
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-mode-infer-namespace): Add test case.
Diffstat (limited to 'test/lisp/progmodes')
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 400c76c187f..f887bb1dca5 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el | |||
| @@ -977,6 +977,17 @@ evaluation of BODY." | |||
| 977 | (should (equal (elisp--xref-infer-namespace p7) 'variable))) | 977 | (should (equal (elisp--xref-infer-namespace p7) 'variable))) |
| 978 | 978 | ||
| 979 | (elisp-mode-test--with-buffer | 979 | (elisp-mode-test--with-buffer |
| 980 | (concat "(let (({p1}alpha {p2}beta)\n" | ||
| 981 | " ({p3}gamma ({p4}delta {p5}epsilon)))\n" | ||
| 982 | " ({p6}zeta))\n") | ||
| 983 | (should (equal (elisp--xref-infer-namespace p1) 'variable)) | ||
| 984 | (should (equal (elisp--xref-infer-namespace p2) 'variable)) | ||
| 985 | (should (equal (elisp--xref-infer-namespace p3) 'variable)) | ||
| 986 | (should (equal (elisp--xref-infer-namespace p4) 'function)) | ||
| 987 | (should (equal (elisp--xref-infer-namespace p5) 'maybe-variable)) | ||
| 988 | (should (equal (elisp--xref-infer-namespace p6) 'function))) | ||
| 989 | |||
| 990 | (elisp-mode-test--with-buffer | ||
| 980 | (concat "(defun {p1}alpha () {p2}beta)\n" | 991 | (concat "(defun {p1}alpha () {p2}beta)\n" |
| 981 | "(defface {p3}gamma ...)\n" | 992 | "(defface {p3}gamma ...)\n" |
| 982 | "(defvar {p4}delta {p5}epsilon)\n" | 993 | "(defvar {p4}delta {p5}epsilon)\n" |