Improve compilation buffer closing implementation
This commit is contained in:
parent
bd063ca02b
commit
52d48f4375
23
config.el
23
config.el
|
@ -37,14 +37,21 @@
|
||||||
(add-hook! 'csv-mode-hook 'csv-align-mode)
|
(add-hook! 'csv-mode-hook 'csv-align-mode)
|
||||||
(add-hook! 'csv-mode-hook 'csv-header-line)
|
(add-hook! 'csv-mode-hook 'csv-header-line)
|
||||||
;; Close compilation buffer if successful
|
;; Close compilation buffer if successful
|
||||||
(setq compilation-finish-functions
|
(defun close-compilation-buffer-if-successful (buffer string)
|
||||||
(lambda (buf str)
|
"Bury a compilation buffer if succeeded without warnings "
|
||||||
(if (null (string-match ".*exited abnormally.*" str))
|
(when (and (eq major-mode 'compilation-mode)
|
||||||
(progn
|
(string-match "finished" string)
|
||||||
(run-at-time
|
(not
|
||||||
"0.5 sec" nil 'delete-windows-on
|
(with-current-buffer buffer
|
||||||
(get-buffer-create "*compilation*"))
|
(search-forward "warning" nil t))))
|
||||||
(message "No Compilation Errors!")))))
|
(run-with-timer 1 nil
|
||||||
|
(lambda (buf)
|
||||||
|
(let ((window (get-buffer-window buf)))
|
||||||
|
(when (and (window-live-p window)
|
||||||
|
(eq buf (window-buffer window)))
|
||||||
|
(delete-window window))))
|
||||||
|
buffer)))
|
||||||
|
(add-hook 'compilation-finish-functions #'close-compilation-buffer-if-successful)
|
||||||
;; Map leader key for major mode to ,
|
;; Map leader key for major mode to ,
|
||||||
(setq evil-snipe-override-evil-repeat-keys nil)
|
(setq evil-snipe-override-evil-repeat-keys nil)
|
||||||
(setq doom-localleader-key ",")
|
(setq doom-localleader-key ",")
|
||||||
|
|
Loading…
Reference in New Issue