'eshell-eval-using-options' macro. See "Defining new built-in
commands" in the "(eshell) Built-ins" node of the Eshell manual.
+** Shell
+
+---
+*** New user option 'shell-kill-buffer-on-exit'.
+Enabling this will automatically kill a *shell* buffer as soon as the
+shell session terminates.
+
** Calc
+++
:group 'shell-directories
:version "28.1")
+(defcustom shell-kill-buffer-on-exit nil
+ "Kill a shell buffer after the shell process terminates."
+ :type 'boolean
+ :group 'shell
+ :version "29.1")
+
(defvar shell-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-f" 'shell-forward-command)
(with-temp-buffer
(insert-file-contents startfile)
(buffer-string)))))))
+ (when shell-kill-buffer-on-exit
+ (let* ((buffer (current-buffer))
+ (process (get-buffer-process buffer))
+ (sentinel (process-sentinel process)))
+ (set-process-sentinel
+ process
+ (lambda (proc event)
+ (when sentinel
+ (funcall sentinel proc event))
+ (unless (buffer-live-p proc)
+ (kill-buffer buffer))))))
buffer)
;;; Directory tracking