Commit 76f2d19e authored by Samer Masterson's avatar Samer Masterson
Browse files

* lisp/eshell/em-term.el (eshell-term-sentinel):

No-op by default, only kills term buffer if
`eshell-destroy-buffer-when-process-dies' is non-nil.  (Bug#18108)
(eshell-destroy-buffer-when-process-dies): New custom to preserve
previous behavior.
parent e37da5a4
......@@ -681,6 +681,14 @@ buffers from eshell more convenient. Custom variable
`eshell-buffer-shorthand', which has been broken for a while, has been
*** By default, eshell "visual" program buffers (created by
`eshell-visual-commands' and similar custom vars) are no longer killed
when their processes die. This fixes issues with short-lived commands
and makes visual programs more useful in general. For example, if
"git log" is a visual command, it will always show the visual command
buffer, even if the "git log" process dies. For the old behavior,
make the new option `eshell-destroy-buffer-when-process-dies' non-nil.
** Browse-url
*** Support for the Conkeror web browser.
......@@ -132,6 +132,13 @@ character to the invoked process."
:type 'boolean
:group 'eshell-term)
(defcustom eshell-destroy-buffer-when-process-dies nil
"If non-nil, term buffers are destroyed after their processes die.
WARNING: Setting this to non-nil may result in unexpected
behavior for short-lived processes, see bug#18108."
:type 'boolean
:group 'eshell-term)
;;; Internal Variables:
(defvar eshell-parent-buffer)
......@@ -190,8 +197,12 @@ allowed."
;; Process sentinels receive two arguments.
(defun eshell-term-sentinel (proc _string)
"Destroy the buffer visiting PROC."
(defun eshell-term-sentinel (proc msg)
"Clean up the buffer visiting PROC.
If `eshell-destroy-buffer-when-process-dies' is non-nil, destroy
the buffer."
(term-sentinel proc msg) ;; First call the normal term sentinel.
(when eshell-destroy-buffer-when-process-dies
(let ((proc-buf (process-buffer proc)))
(when (and proc-buf (buffer-live-p proc-buf)
(not (eq 'run (process-status proc)))
......@@ -203,7 +214,7 @@ allowed."
(if buf
(switch-to-buffer buf))))
(kill-buffer proc-buf))))
(kill-buffer proc-buf)))))
;; jww (1999-09-17): The code below will allow Eshell to send input
;; characters directly to the currently running interactive process.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment