]> git.eshelyaron.com Git - emacs.git/commitdiff
Classify lone symbol inside let varlist as variable
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 4 May 2015 15:50:44 +0000 (18:50 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 4 May 2015 15:51:48 +0000 (18:51 +0300)
* 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
test/automated/elisp-mode-tests.el

index 7c9a2d7c4227164ddaaeb48c04bb788d9d15bd5f..18da0762c96f4595ea0352e83efcd77242e0ab57 100644 (file)
@@ -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 "\\_<let\\*?\\_>"))))
+                       ((or `let `let*
+                            (and ?\(
+                                 (guard (save-excursion
+                                          (goto-char (1- beg))
+                                          (up-list -1)
+                                          (forward-symbol -1)
+                                          (looking-at "\\_<let\\*?\\_>")))))
                         (list t obarray
                               :predicate #'boundp
                               :company-doc-buffer #'elisp--company-doc-buffer
index a4148e9e5ffb5ef17eb95c774cf13774da5bc74e..26f903dbd0c6d8c21a250ea33201888c0ce042c6 100644 (file)
       (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