aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell/eshell.el
diff options
context:
space:
mode:
authorJim Porter2023-09-23 11:36:11 -0700
committerJim Porter2023-10-02 20:49:41 -0700
commit498d31e9f0549189f4e9b140549419dd4e462575 (patch)
treee66ae54cfe9f53d7481df35850a066042e0b6e1d /lisp/eshell/eshell.el
parent8f2cfe15a72a0c440909faa50a9c436931dcf85e (diff)
downloademacs-498d31e9f0549189f4e9b140549419dd4e462575.tar.gz
emacs-498d31e9f0549189f4e9b140549419dd4e462575.zip
Support Eshell iterative evaluation in the background
This really just generalizes Eshell's previous support for iterative evaluation of a single current command to a list of multiple commands, of which at most one can be in the foreground (bug#66066). * lisp/eshell/esh-cmd.el (eshell-last-async-procs) (eshell-current-command): Make obsolete in favor of... (eshell-foreground-command): ... this (eshell-background-commands): New variable. (eshell-interactive-process-p): Make obsolete. (eshell-head-process, eshell-tail-process): Use 'eshell-foreground-command'. (eshell-cmd-initialize): Initialize new variables. (eshell-add-command, eshell-remove-command) (eshell-commands-for-process): New functions. (eshell-parse-command): Make 'eshell-do-subjob' the outermost call. (eshell-do-subjob): Call 'eshell-resume-eval' to split this command off from its parent forms. (eshell-eval-command): Use 'eshell-add-command'. (eshell-resume-command): Use 'eshell-commands-for-process'. (eshell-resume-eval): Take a COMMAND argument. Return ':eshell-background' form for deferred background commands. (eshell-do-eval): Remove check for 'eshell-current-subjob-p'. This is handled differently now. * lisp/eshell/eshell.el (eshell-command): Wait for all processes to exit when running synchronously. * lisp/eshell/esh-mode.el (eshell-intercept-commands) (eshell-watch-for-password-prompt): * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): * lisp/eshell/em-smart.el (eshell-smart-display-move): Use 'eshell-foreground-command'. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/background/simple-command) (esh-cmd-test/background/subcommand): New tests. (esh-cmd-test/throw): Use 'eshell-foreground-command'. * test/lisp/eshell/eshell-tests.el (eshell-test/queue-input): Use 'eshell-foreground-command'. * test/lisp/eshell/em-script-tests.el (em-script-test/source-script/background): Make the test script more complex. * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/pipeline-wait): New test. * doc/misc/eshell.texi (Bugs and ideas): Remove implemented feature.
Diffstat (limited to 'lisp/eshell/eshell.el')
-rw-r--r--lisp/eshell/eshell.el5
1 files changed, 2 insertions, 3 deletions
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index a3f80f453eb..8765ba499a1 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -315,9 +315,8 @@ argument), then insert output into the current buffer at point."
315 ;; make the output as attractive as possible, with no 315 ;; make the output as attractive as possible, with no
316 ;; extraneous newlines 316 ;; extraneous newlines
317 (when intr 317 (when intr
318 (if (eshell-interactive-process-p) 318 (apply #'eshell-wait-for-process (cadr eshell-foreground-command))
319 (eshell-wait-for-process (eshell-tail-process))) 319 (cl-assert (not eshell-foreground-command))
320 (cl-assert (not (eshell-interactive-process-p)))
321 (goto-char (point-max)) 320 (goto-char (point-max))
322 (while (and (bolp) (not (bobp))) 321 (while (and (bolp) (not (bobp)))
323 (delete-char -1))) 322 (delete-char -1)))