Emacs: Automatically close ansi-term buffer

This commit is contained in:
Tom Willemsen 2013-03-31 01:53:06 +01:00
parent 51d1211586
commit a416fe4650

View file

@ -540,6 +540,18 @@ anyway.
(global-set-key (kbd "C-M-z") 'indent-defun) (global-set-key (kbd "C-M-z") 'indent-defun)
#+END_SRC #+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 #+BEGIN_SRC emacs-lisp
(eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) (eval-after-load "rainbow-mode" '(oni:rainbow-mode-init))
(eval-after-load "smex" '(oni:smex-init)) (eval-after-load "smex" '(oni:smex-init))