diff options
| author | Alan Third | 2019-12-05 13:14:00 +0000 |
|---|---|---|
| committer | Alan Third | 2019-12-10 20:38:21 +0000 |
| commit | 33a37360defdc08a5d8eeabffef96f8571d3b608 (patch) | |
| tree | 6fe807ff4f3c2cdc644d836f58df228145606b36 /test | |
| parent | fbf9fea4fdad467429058077b8087dbd0758b964 (diff) | |
| download | emacs-33a37360defdc08a5d8eeabffef96f8571d3b608.tar.gz emacs-33a37360defdc08a5d8eeabffef96f8571d3b608.zip | |
Fix dabbrev-completion (bug#17899)
* lisp/dabbrev.el (dabbrev--check-all-buffers): Add new variable.
(dabbrev-completion): Lexical scoping means we can't use let to
override global variables, so use setq.
(dabbrev--reset-global-variables): Reset new variable.
(dabbrev--make-friend-buffer-list): Use new variable.
* test/lisp/dabbrev-tests.el (dabbrev-completion-test):
(dabbrev-completion-test-with-argument): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/dabbrev-tests.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/lisp/dabbrev-tests.el b/test/lisp/dabbrev-tests.el index a6ab2e7201f..d26362db3d4 100644 --- a/test/lisp/dabbrev-tests.el +++ b/test/lisp/dabbrev-tests.el | |||
| @@ -40,3 +40,33 @@ first expansion being replaced rather than the destination." | |||
| 40 | ;; M-/ SPC M-/ M-/ | 40 | ;; M-/ SPC M-/ M-/ |
| 41 | (execute-kbd-macro "\257 \257\257")) | 41 | (execute-kbd-macro "\257 \257\257")) |
| 42 | (should (string= (buffer-string) "ab x\nab y\nab y")))) | 42 | (should (string= (buffer-string) "ab x\nab y\nab y")))) |
| 43 | |||
| 44 | (ert-deftest dabbrev-completion-test () | ||
| 45 | "Test for bug#17899. | ||
| 46 | dabbrev-completion should not look for expansions in other | ||
| 47 | buffers unless a prefix argument is used." | ||
| 48 | (with-temp-buffer | ||
| 49 | (insert "axy") | ||
| 50 | (with-temp-buffer | ||
| 51 | (insert "abc\na") | ||
| 52 | (goto-char 6) | ||
| 53 | (save-window-excursion | ||
| 54 | (set-window-buffer nil (current-buffer)) | ||
| 55 | ;; C-M-/ | ||
| 56 | (execute-kbd-macro [201326639])) | ||
| 57 | (should (string= (buffer-string) "abc\nabc"))))) | ||
| 58 | |||
| 59 | (ert-deftest dabbrev-completion-test-with-argument () | ||
| 60 | "Test for bug#17899. | ||
| 61 | dabbrev-completion should not complete because it has found | ||
| 62 | multiple expansions." | ||
| 63 | (with-temp-buffer | ||
| 64 | (insert "axy") | ||
| 65 | (with-temp-buffer | ||
| 66 | (insert "abc\na") | ||
| 67 | (goto-char 6) | ||
| 68 | (save-window-excursion | ||
| 69 | (set-window-buffer nil (current-buffer)) | ||
| 70 | ;; C-u C-u C-M-/ | ||
| 71 | (execute-kbd-macro [21 21 201326639])) | ||
| 72 | (should (string= (buffer-string) "abc\na"))))) | ||