summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Romero <blake@blkrom.com>2025-07-11 18:37:00 +0100
committerBlake Romero <blake@blkrom.com>2025-07-11 18:37:00 +0100
commit576b7c77ce3d17a51ab5513f738d2b3fe2d145d9 (patch)
tree6ca137c38708b2ce90fce975c26a8aa325594021
parent4f21d1c1855cc90ac8e9ddc33b91cc026f661245 (diff)
Add compilation settings
-rw-r--r--emacs-config.org33
1 files changed, 33 insertions, 0 deletions
diff --git a/emacs-config.org b/emacs-config.org
index 68256c4..30efc17 100644
--- a/emacs-config.org
+++ b/emacs-config.org
@@ -1178,6 +1178,39 @@ Set flymake keybindings.
(keymap-set flymake-mode-map "M-# M-[" #'flymake-goto-prev-error))
#+end_src
+** Compilation
+Set make command and scroll output.
+#+begin_src elisp
+ (with-eval-after-load 'compile
+ (setq-default compile-command "make"
+ compilation-scroll-output t))
+#+end_src
+
+Truncate lines in compilation buffer.
+#+begin_src elisp
+ (with-eval-after-load 'compile
+ (add-hook 'compilation-mode-hook
+ (lambda () (toggle-truncate-lines 1))))
+#+end_src
+
+Auto-close compilation buffer when there are no errors or warnings.
+#+begin_src elisp
+ (with-eval-after-load 'compile
+ (add-hook 'compilation-finish-functions
+ (lambda (buffer string)
+ "Bury a compilation buffer if succeeded without warnings "
+ (require 'winner)
+ (when (and
+ (buffer-live-p buffer)
+ (string-match "compilation" (buffer-name buffer))
+ (string-match "finished" string)
+ (eq 0 compilation-num-warnings-found)
+ (eq 0 compilation-num-errors-found))
+ (run-with-timer 1 nil (lambda ()
+ (winner-undo)
+ (message "Compilation successful")))))))
+#+end_src
+
* Keybindings
Unlock previously unusable keybinding.
#+begin_src elisp