Be more careful about applying spliced arguments
Previously, this could 'nonc' to a list that shouldn't be modified. * lisp/eshell/esh-cmd.el (eshell-rewrite-named-command): Use 'append' instead of 'nconc'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-splice): (esh-var-test/quoted-interp-var-splice): New tests.
This commit is contained in:
parent
75fa0cc1ae
commit
183c5efc0f
2 changed files with 5 additions and 3 deletions
|
@ -488,7 +488,7 @@ command hooks should be run before and after the command."
|
|||
(grouped-terms (eshell-prepare-splice terms)))
|
||||
(cond
|
||||
(grouped-terms
|
||||
`(let ((new-terms (nconc ,@grouped-terms)))
|
||||
`(let ((new-terms (append ,@grouped-terms)))
|
||||
(,sym (car new-terms) (cdr new-terms))))
|
||||
;; If no terms are spliced, use a simpler command form.
|
||||
((cdr terms)
|
||||
|
|
|
@ -217,7 +217,8 @@ nil, use FUNCTION instead."
|
|||
"Splice-interpolate list variable."
|
||||
(let ((eshell-test-value '(1 2 3)))
|
||||
(eshell-command-result-equal "echo a $@eshell-test-value z"
|
||||
'("a" 1 2 3 "z"))))
|
||||
'("a" 1 2 3 "z"))
|
||||
(should (equal eshell-test-value '(1 2 3)))))
|
||||
|
||||
(ert-deftest esh-var-test/interp-var-splice-concat ()
|
||||
"Splice-interpolate and concat list variable."
|
||||
|
@ -428,7 +429,8 @@ nil, use FUNCTION instead."
|
|||
"Splice-interpolate list variable inside double-quotes."
|
||||
(let ((eshell-test-value '(1 2 3)))
|
||||
(eshell-command-result-equal "echo a \"$@eshell-test-value\" z"
|
||||
'("a" "1 2 3" "z"))))
|
||||
'("a" "1 2 3" "z"))
|
||||
(should (equal eshell-test-value '(1 2 3)))))
|
||||
|
||||
(ert-deftest esh-var-test/quoted-interp-var-splice-concat ()
|
||||
"Splice-interpolate and concat list variable inside double-quotes"
|
||||
|
|
Loading…
Add table
Reference in a new issue