Use a better compilation buffer filter

This commit is contained in:
Jeremy Dormitzer 2021-01-29 09:44:33 -05:00
parent 50ba0c8a67
commit 21bbb489c8

View File

@ -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: