GNU bug report logs - #65513
29.1; Ansi colors do not work in compilation buffers

Previous Next

Package: emacs;

Reported by: Daniel Zurawski <djzurawski <at> gmail.com>

Date: Fri, 25 Aug 2023 05:16:02 UTC

Severity: normal

Found in version 29.1

Full log


Message #11 received at 65513 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Daniel Zurawski <djzurawski <at> gmail.com>
Cc: 65513 <at> debbugs.gnu.org
Subject: Re: bug#65513: 29.1; Ansi colors do not work in compilation buffers
Date: Fri, 25 Aug 2023 09:09:24 -0700
On 8/24/2023 11:29 PM, Eli Zaretskii wrote:
>> From: Daniel Zurawski <djzurawski <at> gmail.com>
>> Date: Thu, 24 Aug 2023 14:30:31 -0600
>>
>> Colors arent rendered in compiation buffers, the ansi color code text is displayed.
>> I have resolved the issue but adding these lines to my init.el
>>
>> (require 'ansi-color)
>> (add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
> 
> AFAIU, this is exactly what you need to do if you want the ANSI color
> sequences to be supported in compilation buffers.  Emacs currently
> supports that automatically only in Grep buffers (set
> grep-highlight-matches to t to activate).

Yeah, I think this isn't a bug: since compilation mode adds its own 
highlighting to buttonize errors and such, it could be confusing if you 
also saw the ANSI colors in the same block of text. The hook mentioned 
above is the way for users to opt into this potentially-confusing behavior.

For Grep buffers, I think that option is a bit different: to get the 
matched region from Grep output, you need to examine the ANSI sequences 
in the output. The Emacs Grep code then uses that to add our *own* 
fontification, and then we strip out the ANSI sequences (see 'grep-filter').




This bug report was last modified 2 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.