From b51eeff933a95cbe483442c18598e98586123eca Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 19 Apr 2014 10:29:14 +0300 Subject: [PATCH] Colorize compilation buffers out-of-the-box --- core/prelude-editor.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 8368287..e849eaa 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -374,6 +374,28 @@ indent yanked text (with prefix arg don't indent)." (setq semanticdb-default-save-directory (expand-file-name "semanticdb" prelude-savefile-dir)) +;; Compilation from Emacs +(defun prelude-colorize-compilation-buffer () + "Colorize a compilation mode buffer." + (interactive) + ;; we don't want to mess with child modes such as grep-mode, ack, ag, etc + (when (eq major-mode 'compilation-mode) + (let ((inhibit-read-only t)) + (ansi-color-apply-on-region (point-min) (point-max))))) + +(require 'compile) +(setq compilation-ask-about-save nil ; Just save before compiling + compilation-always-kill t ; Just kill old compile processes before + ; starting the new one + compilation-scroll-output 'first-error ; Automatically scroll to first + ; error + ) + +;; Colorize output of Compilation Mode, see +;; http://stackoverflow.com/a/3072831/355252 +(require 'ansi-color) +(add-hook 'compilation-filter-hook #'prelude-colorize-compilation-buffer) + ;; enable Prelude's keybindings (prelude-global-mode t)