summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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