`eshell-buffer-shorthand', which has been broken for a while, has been
removed.
+*** 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.
: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)
nil)
;; Process sentinels receive two arguments.
-(defun eshell-term-sentinel (proc _string)
- "Destroy the buffer visiting PROC."
- (let ((proc-buf (process-buffer proc)))
- (when (and proc-buf (buffer-live-p proc-buf)
- (not (eq 'run (process-status proc)))
- (= (process-exit-status proc) 0))
- (if (eq (current-buffer) proc-buf)
- (let ((buf (and (boundp 'eshell-parent-buffer)
- eshell-parent-buffer
- (buffer-live-p eshell-parent-buffer)
- eshell-parent-buffer)))
- (if buf
- (switch-to-buffer buf))))
- (kill-buffer proc-buf))))
+(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)))
+ (= (process-exit-status proc) 0))
+ (if (eq (current-buffer) proc-buf)
+ (let ((buf (and (boundp 'eshell-parent-buffer)
+ eshell-parent-buffer
+ (buffer-live-p eshell-parent-buffer)
+ eshell-parent-buffer)))
+ (if buf
+ (switch-to-buffer 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.