diff options
| author | Jim Porter | 2023-02-24 21:49:54 -0800 |
|---|---|---|
| committer | Jim Porter | 2023-02-25 20:38:55 -0800 |
| commit | 9565e34762af6e0db51e9ae01683eb5d4c97ff3d (patch) | |
| tree | 9f9a1a3a3d0e0d3ddc86adc8bf4d8831283e35b4 /test | |
| parent | 2baf08683fcf4b6b1ad65a6dc239b889d78a74b2 (diff) | |
| download | emacs-9565e34762af6e0db51e9ae01683eb5d4c97ff3d.tar.gz emacs-9565e34762af6e0db51e9ae01683eb5d4c97ff3d.zip | |
Be more cautious in completing Eshell variable assignments
Previously, Eshell treated cases like the second argument in "tar
--directory=dir" as a variable assignment, but that prevented
'pcomplete/tar' from implementing its own completion for that
argument (bug#61778).
* lisp/eshell/esh-var.el (eshell-complete-variable-assignment): Only
handle completion when all initial arguments are variable assignments.
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/variable-assign-completion/non-assignment): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/em-cmpl-tests.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-cmpl-tests.el b/test/lisp/eshell/em-cmpl-tests.el index ecab7332822..be2199c0464 100644 --- a/test/lisp/eshell/em-cmpl-tests.el +++ b/test/lisp/eshell/em-cmpl-tests.el | |||
| @@ -217,6 +217,20 @@ See <lisp/eshell/esh-var.el>." | |||
| 217 | (should (equal (eshell-insert-and-complete "VAR=f") | 217 | (should (equal (eshell-insert-and-complete "VAR=f") |
| 218 | "VAR=file.txt "))))) | 218 | "VAR=file.txt "))))) |
| 219 | 219 | ||
| 220 | (ert-deftest em-cmpl-test/variable-assign-completion/non-assignment () | ||
| 221 | "Test completion of things that look like variable assignment, but aren't. | ||
| 222 | For example, the second argument in \"tar --directory=dir\" looks | ||
| 223 | like it could be a variable assignment, but it's not. We should | ||
| 224 | let `pcomplete-tar' handle it instead. | ||
| 225 | |||
| 226 | See <lisp/eshell/esh-var.el>." | ||
| 227 | (with-temp-eshell | ||
| 228 | (ert-with-temp-directory default-directory | ||
| 229 | (write-region nil nil (expand-file-name "file.txt")) | ||
| 230 | (make-directory "dir") | ||
| 231 | (should (equal (eshell-insert-and-complete "tar --directory=") | ||
| 232 | "tar --directory=dir/"))))) | ||
| 233 | |||
| 220 | (ert-deftest em-cmpl-test/user-ref-completion () | 234 | (ert-deftest em-cmpl-test/user-ref-completion () |
| 221 | "Test completion of user references like \"~user\". | 235 | "Test completion of user references like \"~user\". |
| 222 | See <lisp/eshell/em-dirs.el>." | 236 | See <lisp/eshell/em-dirs.el>." |