From fe4e258b17feb529ac364daee67a5f0441f851f4 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 4 May 2015 18:50:44 +0300 Subject: [PATCH] Classify lone symbol inside let varlist as variable * lisp/progmodes/elisp-mode.el (elisp-completion-at-point): Classify lone symbol inside let varlist as variable. * test/automated/elisp-mode-tests.el (completest-variables-in-let-bindings): New test. --- lisp/progmodes/elisp-mode.el | 13 +++++++------ test/automated/elisp-mode-tests.el | 9 +++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 7c9a2d7c422..18da0762c96 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -544,12 +544,13 @@ It can be quoted, or be inside a quoted form." (< (point) beg))))) (list t obarray :predicate (lambda (sym) (get sym 'error-conditions)))) - ((and ?\( - (guard (save-excursion - (goto-char (1- beg)) - (up-list -1) - (forward-symbol -1) - (looking-at "\\_")))) + ((or `let `let* + (and ?\( + (guard (save-excursion + (goto-char (1- beg)) + (up-list -1) + (forward-symbol -1) + (looking-at "\\_"))))) (list t obarray :predicate #'boundp :company-doc-buffer #'elisp--company-doc-buffer diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el index a4148e9e5ff..26f903dbd0c 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el @@ -84,5 +84,14 @@ (should (member "bar" comps)) (should (member "baz" comps))))) +(ert-deftest completest-variables-in-let-bindings () + (dolist (text '("(let (ba" "(let* ((ba")) + (with-temp-buffer + (emacs-lisp-mode) + (insert text) + (let ((comps (elisp--test-completions))) + (should (member "backup-inhibited" comps)) + (should-not (member "backup-buffer" comps)))))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here -- 2.39.2