If I understand you correctly, you're running the normal "M-x compile" command and the output is destined for the "*compilation*" buffer. In that case, I think you want something like the following:
(require 'ansi-color)
(add-hook 'compilation-filter-hook (lambda () (ansi-color-apply-on-region compilation-filter-start (point))))
If you're running Emacs 28.1 or newer, there is 'ansi-color-compilation-filter' which can be used instead of the lambda.
Troy.
I call 'alr build' as compile command. That does not look pretty at all,
the escape sequences are shown and not translated. So I called 'alr
--no-color build'. But that looks boring. After some research I added
the following two lines to my .emacs:
(require 'ansi-color)
(add-hook 'compilation-mode-hook 'ansi-color-for-comint-mode-on)
But that does not work neither.
Has anybody tried that before and has a solution?
Regards
Rolf