From: Dmitry Gutov Date: Mon, 4 May 2015 15:50:44 +0000 (+0300) Subject: Classify lone symbol inside let varlist as variable X-Git-Tag: emacs-25.0.90~2218 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fe4e258b17feb529ac364daee67a5f0441f851f4;p=emacs.git 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. --- 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