From a962ee4d14445688e34165598e351b2afe39f5fb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 28 May 2025 15:23:21 -0400 Subject: Fix compilation window auto-close function --- emacs/.emacs.d/init.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index f16d1ea..ed1a017 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -299,12 +299,13 @@ (defun compile-autoclose (buffer string) "Close compilation window on success" - (cond ((and (string-match "compilation" (buffer-name buffer)) - (string-match "finished" string)) - (bury-buffer "*compilation*") - (message "Build successful.")) - (t - (message "Compilation exited abnormally: %s" string)))) + (if (and (string-match "compilation" (buffer-name buffer)) + (string-match "finished" string)) + (progn + (switch-to-prev-buffer (get-buffer-window buffer) 'bury) + (bury-buffer buffer) + (message "Compilation successful")) + (message "Compilation exited abnormally: %s" string))) (defun rotate-windows () "Rotate windows" -- cgit v1.2.1