From 3d922612f5423671698aee7488293c438b709851 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Mon, 12 Jun 2017 21:29:30 +0100 Subject: [PATCH] Emacs: Colorize compilation buffer --- .emacs.d/lisp/main.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.emacs.d/lisp/main.el b/.emacs.d/lisp/main.el index ada9d053..a8c8d2d3 100644 --- a/.emacs.d/lisp/main.el +++ b/.emacs.d/lisp/main.el @@ -180,6 +180,13 @@ ;; (make-variable-buffer-local 'compilation-directory) ;; (make-variable-buffer-local 'compile-history) (make-variable-buffer-local 'compile-command)) +;;; Some commands ignore that compilation-mode is a "dumb" terminal and still display colors. +;;; Thus we render those colors. +(require 'ansi-color) +(defun compilation-colorize-buffer () + (when (eq major-mode 'compilation-mode) + (ansi-color-apply-on-region compilation-filter-start (point-max)))) +(add-hook 'compilation-filter-hook 'compilation-colorize-buffer) ;;; Don't set these bindings in mickey as we might have to override them from ;;; mode hooks. (global-set-key (kbd "C-") 'compile)