]> git.eshelyaron.com Git - emacs.git/commit
Improve correctness of Eshell sub-forms
authorJim Porter <jporterbugs@gmail.com>
Sat, 5 Oct 2024 04:45:04 +0000 (21:45 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 17 Oct 2024 18:51:25 +0000 (20:51 +0200)
commita78204c24c7c0db442735480bd06bceca0a342c2
tree836a044f798c7e5f9180dcc73a0de2f584415849
parentc328be5eba4a5771276cea8f6baa937bd8a9e849
Improve correctness of Eshell sub-forms

This makes sure that we treat Eshell sub-forms (whether Lisp or command
forms) as values when appropriate, or as regular invocations.  This
requires a bit more explicit work, but helps to resolve some of the
surprising differences between Lisp and command forms in complex Eshell
statements.

* lisp/eshell/esh-cmd.el (eshell-subcommand-arg-values): Make obsolete.
(eshell-parse-lisp-argument): Don't add 'eshell-command-to-value' here.
(eshell-rewrite-sexp-command): Don't check for 'eshell-command-to-value
here'; instead check for 'eshell-lisp-command'.
(eshell-structure-basic-command): Check for 'eshell-lisp-command'.
(eshell-term-as-value): New function...
(eshell-rewrite-named-command, eshell-rewrite-for-command): ... call it.

* lisp/eshell/esh-arg.el (eshell-parse-special-reference):
* lisp/eshell/esh-io.el (eshell-strip-redirections):
* lisp/eshell/esh-var.el (eshell-prepare-indices): Call
'eshell-term-as-value'.

* test/lisp/eshell/esh-arg-tests.el
(esh-arg-test/special-reference/command-form):
* test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/for-loop-lisp-body)
(esh-cmd-test/while-loop-lisp-body)
(esh-cmd-test/if-else-statement-lisp-body): New tests.

* test/lisp/eshell/esh-var-tests.el
(esh-var-test/interp-var-indices-subcommand): Add another command to
test.

* doc/misc/eshell.texi (Control Flow): Update documentation.

(cherry picked from commit 40ffacb34b194aa82273539ab7a5be2f485a706f)
doc/misc/eshell.texi
lisp/eshell/esh-arg.el
lisp/eshell/esh-cmd.el
lisp/eshell/esh-io.el
lisp/eshell/esh-var.el
test/lisp/eshell/esh-arg-tests.el
test/lisp/eshell/esh-cmd-tests.el
test/lisp/eshell/esh-var-tests.el