diff options
| author | Jim Porter | 2023-01-22 13:20:46 -0800 |
|---|---|---|
| committer | Jim Porter | 2023-01-30 17:49:11 -0800 |
| commit | e7d0aa248e684a6de0d655d93bfcfee06cc8ff09 (patch) | |
| tree | 57da89cd001aa6ae1501174122eb9e55c6dec4e7 /lisp | |
| parent | cc5a2ed457eb34543bb7aaf6b39663af2599805d (diff) | |
| download | emacs-e7d0aa248e684a6de0d655d93bfcfee06cc8ff09.tar.gz emacs-e7d0aa248e684a6de0d655d93bfcfee06cc8ff09.zip | |
During completion, convert all Eshell arguments to strings
Eshell was already converting some types (numbers, nil) to strings, as
well as fixing up multiple-dot forms like ".../", so this way is more
consistent and should produce fewer problems for Pcomplete functions.
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Always
convert parsed arguments to strings.
* test/lisp/eshell/em-cmpl-tests.el (eshell-arguments-equal,
eshell-arguments-equal--equal-explainer): New functions.
(em-cmpl-test/parse-arguments/pipeline)
(em-cmpl-test/parse-arguments/multiple-dots)
(em-cmpl-test/parse-arguments/variable/numeric)
(em-cmpl-test/parse-arguments/variable/nil)
(em-cmpl-test/parse-arguments/variable/list)
(em-cmpl-test/parse-arguments/variable/splice): Use
'eshell-arguments-equal'.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index d1c7e81090a..acbf206a3c6 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -386,17 +386,19 @@ to writing a completion function." | |||
| 386 | ;; Convert arguments to forms that Pcomplete can understand. | 386 | ;; Convert arguments to forms that Pcomplete can understand. |
| 387 | (cons (mapcar | 387 | (cons (mapcar |
| 388 | (lambda (arg) | 388 | (lambda (arg) |
| 389 | (cond | 389 | (pcase arg |
| 390 | ((numberp arg) | 390 | ;; Expand ".../" etc that only Eshell understands to |
| 391 | (number-to-string arg)) | 391 | ;; the standard "../../". |
| 392 | ;; Expand ".../" etc that only Eshell understands to the | 392 | ((rx ".." (+ ".") "/") |
| 393 | ;; standard "../../". | 393 | (propertize (eshell-expand-multiple-dots arg) |
| 394 | ((and (stringp arg) (string-match "\\.\\.\\.+/" arg)) | 394 | 'pcomplete-arg-value arg)) |
| 395 | (eshell-expand-multiple-dots arg)) | 395 | ((pred stringp) |
| 396 | ((null arg) | 396 | arg) |
| 397 | "") | 397 | ('nil |
| 398 | (t | 398 | (propertize "" 'pcomplete-arg-value arg)) |
| 399 | arg))) | 399 | (_ |
| 400 | (propertize (eshell-stringify arg) | ||
| 401 | 'pcomplete-arg-value arg)))) | ||
| 400 | args) | 402 | args) |
| 401 | posns))) | 403 | posns))) |
| 402 | 404 | ||