Skip to content

Instantly share code, notes, and snippets.

@EricCrosson
Last active May 8, 2018 10:27
Show Gist options
  • Save EricCrosson/fa41233f327403ea2a5a to your computer and use it in GitHub Desktop.
Save EricCrosson/fa41233f327403ea2a5a to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment