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))