Skip to content

Instantly share code, notes, and snippets.

@EricCrosson
EricCrosson / bury-compilation-buffer.el
Last active May 8, 2018 10:27
Emacs Lisp defun to bury the compilation buffer if everything compiles smoothly. No news is good news!
(defun bury-compile-buffer-if-successful (buffer string)
(when (and
(string-match "compilation" (buffer-name buffer))
(string-match "finished" string)
(not (search-forward "warning" nil t)))
(bury-buffer buffer)
(switch-to-prev-buffer (get-buffer-window buffer) 'kill)))
(add-hook 'compilation-finish-functions 'bury-compile-buffer-if-successful)