1 files changed, 4 insertions(+), 10 deletions(-)
M init.org
M init.org => init.org +4 -10
@@ 587,22 587,16 @@ Close compilation buffer after it is successful.
#+begin_src elisp
(defun bury-compile-buffer-if-successful (buffer string)
- "Bury a compilation buffer if succeeded without warnings "
- (if (and
- (buffer-live-p buffer)
- (string-match "compilation" (buffer-name buffer))
- (string-match "finished" string)
- (not
- (with-current-buffer buffer
- (goto-char (point-min))
- (search-forward "warning" nil t))))
+ "Bury a compilation buffer if succeeded, move to the first error otherwise"
+ (if (and (= compilation-num-errors-found 0)
+ (= compilation-num-warnings-found 0))
(run-with-timer 1 nil
(lambda (buf)
(bury-buffer buf)
(delete-windows-on buf))
buffer)
(progn
- (windmove-down)
+ (switch-to-buffer-other-window buffer)
(compilation-next-error 1)
(recenter-top-bottom 2))))