;; ^ index K ^ index J ^ index I
(let* ((i (elisp--xref-list-index))
(i-head (looking-at-sym))
- (i-paren (and i-head (eq (char-before) ?\()
+ (i-paren (and i (eq (char-before) ?\()
(progn (backward-char) t)))
(i-quoted (and i-paren (memq (char-before) '(?\' ?`))))
(j (and i-paren (elisp--xref-list-index)))
(j-head (and j (looking-at-sym)))
- (j-paren (and j-head (eq (char-before) ?\()
+ (j-paren (and j (eq (char-before) ?\()
(progn (backward-char) t)))
(j-quoted (and j-paren (memq (char-before) '(?\' ?`))))
(k (and j-paren (elisp--xref-list-index)))
(k-head (and k (looking-at-sym)))
- (k-paren (and k-head (eq (char-before) ?\()
+ (k-paren (and k (eq (char-before) ?\()
(progn (backward-char) t)))
(k-quoted (and k-paren (memq (char-before) '(?\' ?`)))))
(cond
(should (equal (elisp--xref-infer-namespace p6) 'maybe-variable))
(should (equal (elisp--xref-infer-namespace p7) 'variable)))
+ (elisp-mode-test--with-buffer
+ (concat "(let (({p1}alpha {p2}beta)\n"
+ " ({p3}gamma ({p4}delta {p5}epsilon)))\n"
+ " ({p6}zeta))\n")
+ (should (equal (elisp--xref-infer-namespace p1) 'variable))
+ (should (equal (elisp--xref-infer-namespace p2) 'variable))
+ (should (equal (elisp--xref-infer-namespace p3) 'variable))
+ (should (equal (elisp--xref-infer-namespace p4) 'function))
+ (should (equal (elisp--xref-infer-namespace p5) 'maybe-variable))
+ (should (equal (elisp--xref-infer-namespace p6) 'function)))
+
(elisp-mode-test--with-buffer
(concat "(defun {p1}alpha () {p2}beta)\n"
"(defface {p3}gamma ...)\n"