From 2a60405ac28c12ec63fac2032b8f87599ebfc6b6 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 3 May 2026 17:39:10 -0500 Subject: chore(prog-general): disable auto-close of *compilation* window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I commented out the global `compilation-finish-functions' hook that closed the *compilation* window 1.5 seconds after a successful compile. With the F6 test runner now landing test output in *compilation*, I want the buffer to stay open afterward so I can read the results, not have it slide out from under me. The block stays in the file as a commented-out reference so I can flip it back on later if I want. A prog-mode-only variant is noted in the comment for the day I want the auto-close back for non-prog compiles (org-export, etc.) — that needs advice on `compile' to capture the originating buffer's `major-mode' at compile-start, since the hook fires after `compilation-mode' has already taken over the current buffer. Skipped for now per the simpler path. --- modules/prog-general.el | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'modules') diff --git a/modules/prog-general.el b/modules/prog-general.el index 46599cc9..45b83ca7 100644 --- a/modules/prog-general.el +++ b/modules/prog-general.el @@ -376,16 +376,21 @@ If no such file exists there, display a message." (lsp-ui-peek-show-directory t)) ;; ----------------- Auto-Close Successful Compilation Windows ----------------- -;; close compilation windows when successful. from 'enberg' on #emacs - -(add-hook 'compilation-finish-functions - (lambda (_buf str) - (if (null (string-match ".*exited abnormally.*" str)) - ;;no errors, make the compilation window go away in a few seconds - (progn - (run-at-time - "1.5 sec" nil 'delete-windows-on - (get-buffer-create "*compilation*")))))) +;; Disabled: when test results land in *compilation* (F6 / projectile-test- +;; project), I want to read the output afterward, not have the window close +;; under me 1.5 s later. To re-enable globally, uncomment the block below. +;; A prog-mode-only variant would need to capture the originating buffer's +;; major-mode at compile-start (via advice on `compile') and gate the hook +;; on it — left out for now per the simpler comment-out path. +;; +;; (add-hook 'compilation-finish-functions +;; (lambda (_buf str) +;; (if (null (string-match ".*exited abnormally.*" str)) +;; ;;no errors, make the compilation window go away in a few seconds +;; (progn +;; (run-at-time +;; "1.5 sec" nil 'delete-windows-on +;; (get-buffer-create "*compilation*")))))) ;; which-key labels (with-eval-after-load 'which-key -- cgit v1.2.3