summaryrefslogtreecommitdiff
path: root/lisp/eshell/esh-cmd.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2024-07-09 10:45:35 -0700
committerJim Porter <jporterbugs@gmail.com>2024-07-11 16:39:35 -0700
commit0de0056fd6b3b70dde54884db5d9ffc013c49efc (patch)
tree0763897ad6af5c2f90ec066be7e1dc4c4730a02a /lisp/eshell/esh-cmd.el
parentec1e300a215504bb9905a31145924d7f3d2cb9ab (diff)
downloademacs-0de0056fd6b3b70dde54884db5d9ffc013c49efc.tar.gz
emacs-0de0056fd6b3b70dde54884db5d9ffc013c49efc.tar.bz2
emacs-0de0056fd6b3b70dde54884db5d9ffc013c49efc.zip
Don't emit a prompt in Eshell when a background command is killed
* lisp/eshell/esh-cmd.el (eshell-resume-command): Check for background-ness before resetting the prompt. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/background/simple-command): Make the regexp a bit stricter. (esh-cmd-test/background/kill): New test.
Diffstat (limited to 'lisp/eshell/esh-cmd.el')
-rw-r--r--lisp/eshell/esh-cmd.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 0b3137127d2..e97e4f6d067 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1030,6 +1030,9 @@ process(es) in a cons cell like:
PROC is the process that invoked this from its sentinel, and
STATUS is its status."
(when proc
+ ;; Iterate over all the commands associated with this process. Each
+ ;; element is a list of the form (BACKGROUND FORM PROCESSES) (see
+ ;; `eshell-add-command').
(dolist (command (eshell-commands-for-process proc))
(unless (seq-some #'eshell-process-active-p (nth 2 command))
(setf (nth 2 command) nil) ; Clear processes from command.
@@ -1040,8 +1043,12 @@ STATUS is its status."
(not (string-match eshell-reset-signals status)))
(eshell-resume-eval command)
(eshell-remove-command command)
- (declare-function eshell-reset "esh-mode" (&optional no-hooks))
- (eshell-reset))))))
+ ;; Check if the command we just aborted is marked as a
+ ;; background command. If not, we need to reset the prompt so
+ ;; the user can enter another command.
+ (unless (car command)
+ (declare-function eshell-reset "esh-mode" (&optional no-hooks))
+ (eshell-reset)))))))
(defun eshell-resume-eval (command)
"Destructively evaluate a COMMAND which may need to be deferred.