]> git.eshelyaron.com Git - emacs.git/commit
Use 'unwind-protect' in more places in Eshell
authorJim Porter <jporterbugs@gmail.com>
Sat, 23 Sep 2023 01:22:34 +0000 (18:22 -0700)
committerJim Porter <jporterbugs@gmail.com>
Tue, 26 Sep 2023 19:29:52 +0000 (12:29 -0700)
commiteef32d13da58d9773d6e1889b8de42e5d1711ad5
treee1fbeb7b349b879c161c0c42533fb39b1241a142
parente88be844bf774b336ab67995e435416328b53776
Use 'unwind-protect' in more places in Eshell

This lets us simplify the logic for how we reset
'eshell-current-command' and 'eshell-last-async-procs', as well as
improving correctness of Eshell command forms in a few esoteric
scenarios.  Additionally, this helps set the stage for better support
of background commands in Eshell (bug#66164).

* lisp/eshell/esh-cmd.el (eshell-cmd-initialize): Remove addition to
'eshell-post-command-hook'; this is handled in 'eshell-resume-command'
and 'eshell-resume-eval' now.
(eshell-resume-command): Handle resetting the prompt as needed.
(eshell-resume-eval): Use 'unwind-protect' to ensure that we set
'eshell-last-async-procs' and 'eshell-current-comment' at the right
times.
(eshell-parse-command, eshell-trap-errors, eshell-manipulate): Use
'unwind-protect'.
(eshell-do-eval): Allow 'eshell-defer' to pass through
'unwind-protect' forms without actually calling the unwinding forms
(yet).

* lisp/eshell/esh-proc.el (eshell-kill-process-function)
(eshell-reset-after-proc): Make obsolete.  The behavior is now handled
in 'eshell-resume-command'.
(eshell-gather-process-output, eshell-sentinel)
(eshell-interrupt-process, eshell-kill-process, eshell-quit-process)
(eshell-stop-process, eshell-continue-process): Run 'eshell-kill-hook'
directly.

* test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/throw): New test.
lisp/eshell/esh-cmd.el
lisp/eshell/esh-proc.el
test/lisp/eshell/esh-cmd-tests.el