Improve handling of local variable settings in Eshell
authorJim Porter <jporterbugs@gmail.com>
Fri, 26 Jan 2024 01:54:13 +0000 (17:54 -0800)
committerJim Porter <jporterbugs@gmail.com>
Fri, 26 Jan 2024 01:54:13 +0000 (17:54 -0800)
commit65829b27ca4898ff0905a8124980243977a1382f
tree24a029b92c6b570710675ec07ee8a28c9f338722
parent4834be0949e13a728b69ab97ac9c8a0dbec65f3a
Improve handling of local variable settings in Eshell

This ensures that these commands work the same as normal commands,
aside from making environment variable settings local to that command.
Among other things, this means that "VAR=value cd dir/" now changes
the directory correctly.

* lisp/eshell/esh-var.el (eshell-in-local-scope-p)
(eshell-local-variable-bindings): New variables.
(eshell-var-initialize, eshell-set-variable): Use
'eshell-local-variable-bindings'.
(eshell-handle-local-variables): Don't use 'eshell-as-subcommand'.

* test/lisp/eshell/esh-var-tests.el (esh-var-test/local-variables/cd):
New test.
lisp/eshell/esh-var.el
test/lisp/eshell/esh-var-tests.el