Fix detection of directly-invokable commands in Eshell
authorJim Porter <jporterbugs@gmail.com>
Fri, 26 Jan 2024 18:17:19 +0000 (10:17 -0800)
committerJim Porter <jporterbugs@gmail.com>
Fri, 26 Jan 2024 18:17:19 +0000 (10:17 -0800)
commit047607f6e611709f89f6c93ae0e2fc97b25bf18f
treebd8f9d4d810fe627bb0b6f1c0956ae7585806bc2
parentde020255a5cef4349d786fceb19481352c49557b
Fix detection of directly-invokable commands in Eshell

I think this regressed partly due to eef32d13da58, so let's add some
regression tests to make sure that doesn't happen again.

* lisp/eshell/em-unix.el (eshell-unix-initialize): Add "compile".

* lisp/eshell/esh-cmd.el (eshell--find-subcommands): Yield the second
element of the subcommand.
(eshell--invoke-command-directly-p): Rename and account for
'eshell-with-copied-handles'.
(eshell-invoke-directly): Rename to...
(eshell-invoke-directly-p): ... this, and use 'pcase' to make the
logic clearer.

* lisp/eshell/esh-mode.el (eshell-send-input): Always queue input if
the process is running; rename some locals to be clearer.

* lisp/eshell/esh-var.el (eshell-var-initialize): Add "env" as a
complex command.

* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test--deftest-invoke-directly): New macro.
(no-args, with-args, multiple-cmds, subcmd, complex, complex-subcmd):
New test cases.
lisp/eshell/em-unix.el
lisp/eshell/esh-cmd.el
lisp/eshell/esh-mode.el
lisp/eshell/esh-var.el
test/lisp/eshell/esh-cmd-tests.el