From 5e02514a54cb407d51dace48b6f9cb326039ff99 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 10 Sep 2024 22:47:56 +0200 Subject: emacs: Refactor --- .config/emacs/init.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to '.config') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 34a4634..4326bed 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -551,13 +551,14 @@ related hooks." (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) +(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) + (with-current-buffer buffer + (when (> (length (window-list)) + x--compilation-number-of-windows) + (delete-window (get-buffer-window))) + (kill-buffer)))) +(add-hook 'compilation-finish-functions #'x--kill-compilation-buffer-on-success) ;;; User Interface Themeing (load-theme 'mango :no-confirm) -- cgit v1.2.3