Emacs: Colorize compilation buffer

master
Pierre Neidhardt 2017-06-12 21:29:30 +01:00
parent 23f989f3f9
commit 3d922612f5
1 changed files with 7 additions and 0 deletions

View File

@ -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-<f10>") 'compile)