From a416fe4650b0d38f0e37e0d2489c91415a7f966a Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 31 Mar 2013 01:53:06 +0100 Subject: Emacs: Automatically close ansi-term buffer --- emacs/init.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/init.org b/emacs/init.org index 0a72b5c..db69785 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -540,6 +540,18 @@ anyway. (global-set-key (kbd "C-M-z") 'indent-defun) #+END_SRC +Kill the ~*ansi-term*~ buffer (or any term buffer) after the underlying +shell process has finished. When I quit a shell I don't want the +buffer hanging around. + +#+BEGIN_SRC emacs-lisp + (defadvice term-handle-exit (after oni:kill-buffer-after-exit activate) + "Kill the term buffer if the process finished." + (let ((msg (ad-get-arg 1))) + (when (string-equal msg "finished\n") + (kill-buffer (current-buffer))))) +#+END_SRC + #+BEGIN_SRC emacs-lisp (eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) (eval-after-load "smex" '(oni:smex-init)) -- cgit v1.2.3-54-g00ecf