fix(emacs): close compilation buffer on 0-status exit
Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
parent
1d323ff80c
commit
7e8f372744
1 changed files with 16 additions and 0 deletions
|
@ -115,5 +115,21 @@
|
|||
(global-unset-key (kbd "C-z"))
|
||||
(global-unset-key (kbd "C-x C-z"))
|
||||
|
||||
;; From https://stackoverflow.com/questions/8309769/how-can-i-prevent-emacs-from-opening-new-window-for-compilation-output
|
||||
|
||||
;; Helper for compilation. Close the compilation window if
|
||||
;; there was no error at all. (emacs wiki)
|
||||
(defun compilation-exit-autoclose (status code msg)
|
||||
;; If M-x compile exists with a 0
|
||||
(when (and (eq status 'exit) (zerop code))
|
||||
;; then bury the *compilation* buffer, so that C-x b doesn't go there
|
||||
(bury-buffer)
|
||||
;; and delete the *compilation* window
|
||||
(delete-window (get-buffer-window (get-buffer "*compilation*"))))
|
||||
;; Always return the anticipated result of compilation-exit-message-function
|
||||
(cons msg code))
|
||||
;; Specify my function (maybe I should have done a lambda function)
|
||||
(setq compilation-exit-message-function 'compilation-exit-autoclose)
|
||||
|
||||
(provide 'general)
|
||||
;;; general.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue