emacs: Close compilation buffer on success

This commit is contained in:
Tom Willemsen 2013-02-17 22:23:36 +01:00
parent 3e5421e79d
commit 791d7fd3a2
2 changed files with 11 additions and 0 deletions

View file

@ -271,6 +271,8 @@
'display-buffer-alist 'display-buffer-alist
'("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil)))) '("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil))))
(add-to-list 'compilation-finish-functions 'ext:comp-finish-function)
(blink-cursor-mode -1) (blink-cursor-mode -1)
(column-number-mode -1) (column-number-mode -1)
(line-number-mode -1) (line-number-mode -1)

View file

@ -38,6 +38,15 @@
buffer-file-name)))) buffer-file-name))))
(list "pycheck.sh" (list local-file)))) (list "pycheck.sh" (list local-file))))
(defun ext:comp-finish-function (buf str)
"Don't show compilation window if everything went ok"
(if (string-match "exited abnormally" str)
;; there were errors
(message "compilation errors, press C-x ` to visit")
;; no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "No compilation errors!")))
(defun ext:reload-buffer () (defun ext:reload-buffer ()
"Reload current buffer." "Reload current buffer."
(interactive) (interactive)