diff options
| author | Dmitry Gutov | 2015-05-05 04:54:01 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-05-05 05:14:01 +0300 |
| commit | 46c94cd599374556d65daffa173e7028df69bc1c (patch) | |
| tree | a9234f6ae2c7c4fc63f76072adf0e5d1d6802f0a | |
| parent | 201f91e5ad9619d71e1dfed327f47cb6923edd16 (diff) | |
| download | emacs-46c94cd599374556d65daffa173e7028df69bc1c.tar.gz emacs-46c94cd599374556d65daffa173e7028df69bc1c.zip | |
Make sure we're inside the let bindings
* lisp/progmodes/elisp-mode.el (elisp-completion-at-point):
Make sure we're inside the let bindings.
* test/automated/elisp-mode-tests.el
(elisp-completes-functions-after-let-bindings): New test.
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 14 | ||||
| -rw-r--r-- | test/automated/elisp-mode-tests.el | 10 |
2 files changed, 16 insertions, 8 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 9b7bc219923..40561515ed2 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -544,13 +544,13 @@ It can be quoted, or be inside a quoted form." | |||
| 544 | (< (point) beg))))) | 544 | (< (point) beg))))) |
| 545 | (list t obarray | 545 | (list t obarray |
| 546 | :predicate (lambda (sym) (get sym 'error-conditions)))) | 546 | :predicate (lambda (sym) (get sym 'error-conditions)))) |
| 547 | ((or `let `let* | 547 | ((and (or ?\( `let `let*) |
| 548 | (and ?\( | 548 | (guard (save-excursion |
| 549 | (guard (save-excursion | 549 | (goto-char (1- beg)) |
| 550 | (goto-char (1- beg)) | 550 | (when (eq parent ?\() |
| 551 | (up-list -1) | 551 | (up-list -1)) |
| 552 | (forward-symbol -1) | 552 | (forward-symbol -1) |
| 553 | (looking-at "\\_<let\\*?\\_>"))))) | 553 | (looking-at "\\_<let\\*?\\_>")))) |
| 554 | (list t obarray | 554 | (list t obarray |
| 555 | :predicate #'boundp | 555 | :predicate #'boundp |
| 556 | :company-doc-buffer #'elisp--company-doc-buffer | 556 | :company-doc-buffer #'elisp--company-doc-buffer |
diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el index 26f903dbd0c..bfecfe7dc6b 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el | |||
| @@ -84,7 +84,7 @@ | |||
| 84 | (should (member "bar" comps)) | 84 | (should (member "bar" comps)) |
| 85 | (should (member "baz" comps))))) | 85 | (should (member "baz" comps))))) |
| 86 | 86 | ||
| 87 | (ert-deftest completest-variables-in-let-bindings () | 87 | (ert-deftest elisp-completest-variables-in-let-bindings () |
| 88 | (dolist (text '("(let (ba" "(let* ((ba")) | 88 | (dolist (text '("(let (ba" "(let* ((ba")) |
| 89 | (with-temp-buffer | 89 | (with-temp-buffer |
| 90 | (emacs-lisp-mode) | 90 | (emacs-lisp-mode) |
| @@ -93,5 +93,13 @@ | |||
| 93 | (should (member "backup-inhibited" comps)) | 93 | (should (member "backup-inhibited" comps)) |
| 94 | (should-not (member "backup-buffer" comps)))))) | 94 | (should-not (member "backup-buffer" comps)))))) |
| 95 | 95 | ||
| 96 | (ert-deftest elisp-completes-functions-after-let-bindings () | ||
| 97 | (with-temp-buffer | ||
| 98 | (emacs-lisp-mode) | ||
| 99 | (insert "(let ((bar 1) (baz 2)) (ba") | ||
| 100 | (let ((comps (elisp--test-completions))) | ||
| 101 | (should (member "backup-buffer" comps)) | ||
| 102 | (should-not (member "backup-inhibited" comps))))) | ||
| 103 | |||
| 96 | (provide 'elisp-mode-tests) | 104 | (provide 'elisp-mode-tests) |
| 97 | ;;; elisp-mode-tests.el ends here | 105 | ;;; elisp-mode-tests.el ends here |