From 5213a6674b0546e5d2d5899f8a06d8e54b3b93bc Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 15 Aug 2023 12:48:27 +0200 Subject: emacs: Auto-kill successful compilation buffers --- .config/emacs/config.org | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to '.config/emacs') diff --git a/.config/emacs/config.org b/.config/emacs/config.org index 13647ee..31c3250 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -705,6 +705,23 @@ This mode is super useful for writing HTML. It lets me expand something like #+END_SRC +*** Compilation Buffer + +Emacs allows you to compile your project with =C-x p c= which is cool and all, +but it annoyingly creates a compilation buffer that I need to manually close +every time. I would like to have this buffer, but only when things go wrong. + +#+BEGIN_SRC elisp + + (add-hook 'compilation-finish-functions + (lambda (buffer _) + (with-current-buffer buffer + (unless (or (> compilation-num-warnings-found 0) + (> compilation-num-errors-found 0)) + (kill-buffer buffer))))) + +#+END_SRC + ** User Interface The default Emacs UI is fucking atrocious — we need to make it better. -- cgit v1.2.3