]> git.eshelyaron.com Git - emacs.git/commit
Make '$?' and '$$' variables more consistent in Eshell
authorJim Porter <jporterbugs@gmail.com>
Wed, 10 Aug 2022 03:09:57 +0000 (20:09 -0700)
committerJim Porter <jporterbugs@gmail.com>
Sat, 13 Aug 2022 05:07:13 +0000 (22:07 -0700)
commitf3408af0a3251a744cb0b55b5e153565bfd57ea3
tree7ea273143452b2e2041853c2e8b4c0c73145cce1
parent9d4fa4ed4b1f2b081e8ed14cbe16d9ec4b993988
Make '$?' and '$$' variables more consistent in Eshell

Previously, '$?' (last exit code) was only useful for external
commands, and '$$' (last result) was only useful for Lisp commands.

* lisp/eshell/esh-cmd.el (eshell-lisp-form-nil-is-failure): New
option.
(eshell-lisp-command): Set last exit code to 1 when the command
signals an error, and 2 if it returns nil (for Lisp forms only).

* lisp/eshell/esh-proc.el (eshell-sentinel): Set last result to t if
the command succeeded.

* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/while-loop-lisp-form, esh-cmd-test/until-loop-lisp-form)
(esh-cmd-test/if-else-statement-lisp-form)
(esh-cmd-test/if-else-statement-lisp-form-2)
(esh-cmd-test/unless-else-statement-lisp-form): New tests.

* test/lisp/eshell/esh-var-tests.el
(esh-var-test/last-status-var-lisp-command)
(esh-var-test/last-status-var-lisp-form)
(esh-var-test/last-status-var-lisp-form-2)
(esh-var-test/last-status-var-ext-cmd)
(esh-var-test/last-status-var-ext-cmd): New tests.
(esh-var-test/last-result-var2): Rename from this...
( esh-var-test/last-result-var-twice): ... to this.

* doc/misc/eshell.texi (Variables): Update documentation about '$?'
and '$$'.
(Control Flow): Mention that '(lisp forms)' can be used as
conditionals.

* etc/NEWS: Announce this change (bug#57129).
doc/misc/eshell.texi
etc/NEWS
lisp/eshell/esh-cmd.el
lisp/eshell/esh-proc.el
test/lisp/eshell/esh-cmd-tests.el
test/lisp/eshell/esh-var-tests.el