ada-mode-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: colorize the alr output in Emacs' compilation buffer


From: Rolf Ebert
Subject: Re: colorize the alr output in Emacs' compilation buffer
Date: Thu, 27 Oct 2022 08:36:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0

Thank you, Troy, for the hint, and thank you for understanding my problem description. Unfortunately your proposal does not work. I get the message "Marker does not point anywhere" even before the compile command (alr build) was started. That seems strange as the documentation of compilation-filter-hook states that it is run after a string was inserted into the buffer.

I came up now with the following workaround:

(require 'ansi-color)
(defun colorize-compilation-buffer ()
  (goto-char compilation-filter-start)
  (ansi-color-apply-on-region (point) (point-max)))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)

I am using emacs 27.1 on Debian Bullseye, btw.

Rolf

On 27/10/2022 04:25, Troy Brown wrote:
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.

On Wed, Oct 26, 2022 at 1:56 PM Rolf Ebert <rolf.ebert.emacs@gmx.de> wrote:
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]