From 21bbb489c84d1d89c84ef37aa682d9164d38fa43 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 29 Jan 2021 09:44:33 -0500 Subject: [PATCH] Use a better compilation buffer filter --- emacs/.emacs.d/init.org | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ed3223a..e3d0ec4 100755 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -6481,9 +6481,14 @@ A package that bundles together common code beautifying tools for many languages Enable ANSI colors in compile buffers: #+BEGIN_SRC emacs-lisp (autoload 'ansi-color-apply-on-region "ansi-color") - (defun colorize-compilation-buffer () - (ansi-color-apply-on-region compilation-filter-start (point-max))) - (add-hook 'compilation-filter-hook #'colorize-compilation-buffer) + + (defun local/postprocess-compilation-buffer () + (goto-char compilation-filter-start) + (when (looking-at "\033c") + (delete-region (point-min) (match-end 0))) + (ansi-color-apply-on-region (point) (point-max))) + + (add-hook 'compilation-filter-hook 'local/postprocess-compilation-buffer) #+END_SRC Set up some keybindings for Comint-mode compilation buffers: