diff options
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 6 | ||||
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 10a37942571..9522055670d 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -877,17 +877,17 @@ namespace but with lower confidence." | |||
| 877 | ;; ^ index K ^ index J ^ index I | 877 | ;; ^ index K ^ index J ^ index I |
| 878 | (let* ((i (elisp--xref-list-index)) | 878 | (let* ((i (elisp--xref-list-index)) |
| 879 | (i-head (looking-at-sym)) | 879 | (i-head (looking-at-sym)) |
| 880 | (i-paren (and i-head (eq (char-before) ?\() | 880 | (i-paren (and i (eq (char-before) ?\() |
| 881 | (progn (backward-char) t))) | 881 | (progn (backward-char) t))) |
| 882 | (i-quoted (and i-paren (memq (char-before) '(?\' ?`)))) | 882 | (i-quoted (and i-paren (memq (char-before) '(?\' ?`)))) |
| 883 | (j (and i-paren (elisp--xref-list-index))) | 883 | (j (and i-paren (elisp--xref-list-index))) |
| 884 | (j-head (and j (looking-at-sym))) | 884 | (j-head (and j (looking-at-sym))) |
| 885 | (j-paren (and j-head (eq (char-before) ?\() | 885 | (j-paren (and j (eq (char-before) ?\() |
| 886 | (progn (backward-char) t))) | 886 | (progn (backward-char) t))) |
| 887 | (j-quoted (and j-paren (memq (char-before) '(?\' ?`)))) | 887 | (j-quoted (and j-paren (memq (char-before) '(?\' ?`)))) |
| 888 | (k (and j-paren (elisp--xref-list-index))) | 888 | (k (and j-paren (elisp--xref-list-index))) |
| 889 | (k-head (and k (looking-at-sym))) | 889 | (k-head (and k (looking-at-sym))) |
| 890 | (k-paren (and k-head (eq (char-before) ?\() | 890 | (k-paren (and k (eq (char-before) ?\() |
| 891 | (progn (backward-char) t))) | 891 | (progn (backward-char) t))) |
| 892 | (k-quoted (and k-paren (memq (char-before) '(?\' ?`))))) | 892 | (k-quoted (and k-paren (memq (char-before) '(?\' ?`))))) |
| 893 | (cond | 893 | (cond |
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" |