diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/shell.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index 3d58519..0449be2 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -171,3 +171,20 @@ (bind-key "C-c C-s" 'comint-history-isearch shell-mode-map) (bind-key "C-c C-r" 'comint-history-isearch-backward shell-mode-map) + +;; Close the buffer upon quitting with C-d. + +(defun shell-kill-buffer-on-quit (process event) + "Called when the shell process is stopped. + +Kills the buffer when the shell program quits." + (comint-write-input-ring) + (let ((buf (process-buffer process))) + (when (buffer-live-p buf) + (with-current-buffer buf (kill-buffer))))) + +(defun add-shell-sentinel (&rest args) + (set-process-sentinel (get-buffer-process (current-buffer)) + #'shell-test-sentinel)) + +(add-hook 'shell-mode-hook #'add-shell-sentinel) |