summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/init.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index df12a7b..34a4634 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -546,6 +546,19 @@ related hooks."
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-filter-hook #'x-colorize-buffer)
+ ;;; Autokill Complation Buffer On Success
+(defun x--compilation-count-number-of-windows (&rest _arguments)
+ (setq x--compilation-number-of-windows (length (window-list))))
+(advice-add #'compile :before #'x--compilation-count-number-of-windows)
+
+(defun x-kill-compilation-buffer-on-success (buffer string)
+ (when (string= string "finished\n")
+ (when (> (length (window-list)) x--compilation-number-of-windows)
+ (delete-window (get-buffer-window buffer)))
+ (kill-buffer buffer)))
+
+(add-hook 'compilation-finish-functions #'x-kill-compilation-buffer-on-success)
+
;;; User Interface Themeing
(load-theme 'mango :no-confirm)
(set-fringe-style (cons 32 32))