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

To reply to this bug, email your comments to 65513 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65513; Package emacs. (Fri, 25 Aug 2023 05:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Zurawski <djzurawski <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 25 Aug 2023 05:16:02 GMT) Full text and rfc822 format available.

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

From: Daniel Zurawski <djzurawski <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; Ansi colors do not work in compilation buffers
Date: Thu, 24 Aug 2023 14:30:31 -0600
[Message part 1 (text/plain, inline)]
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)


In GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
 cairo version 1.16.0) of 2023-08-09 built on workstation2
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --with-native-compilation --without-compress-install
 --with-json 'CFLAGS=-O3 -march=znver3' 'CXXFLAGS=-O3 -march=znver3''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  paredit-mode: t
  override-global-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  global-company-mode: t
  company-mode: t
  pyvenv-mode: t
  global-auto-revert-mode: t
  xterm-mouse-mode: t
  xclip-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/dan/.emacs.d/straight/build/s/s-autoloads hides
/home/dan/.emacs.d/elpa/s-20220902.1511/s-autoloads
/home/dan/.emacs.d/straight/build/s/s hides
/home/dan/.emacs.d/elpa/s-20220902.1511/s
/home/dan/.emacs.d/straight/build/dash/dash hides
/home/dan/.emacs.d/elpa/dash-20230714.723/dash
/home/dan/.emacs.d/straight/build/jsonrpc/jsonrpc hides
/usr/local/share/emacs/29.1/lisp/jsonrpc
/home/dan/.emacs.d/elpa/transient-20230723.1411/transient hides
/usr/local/share/emacs/29.1/lisp/transient

Features:
(shadow sort mail-extr emacsbug message yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils time-date comp comp-cstr term/xterm xterm paredit
edmacro kmacro company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-cmake company-semantic company-template
company-bbdb monokai-theme copilot copilot-balancer editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch dash
jsonrpc copilot-autoloads jsonrpc-autoloads editorconfig-autoloads
dash-autoloads use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key use-package-core
straight-autoloads straight cl-extra yasnippet highlight-indentation
flymake-proc flymake warnings thingatpt company-capf company help-fns
radix-tree help-mode elpy advice elpy-rpc pyvenv eshell esh-cmd esh-ext
esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
elpy-shell elpy-profile elpy-django s elpy-refactor diff-mode easy-mmode
python rx compat pcase treesit ido hideshow grep compile
text-property-search comint ansi-osc files-x etags fileloop generator
xref project ring cus-edit pp cus-load icons wid-edit autorevert
filenotify xt-mouse xclip ansi-color finder-inf display-line-numbers
cider-autoloads clojure-mode-autoloads elpy-autoloads company-autoloads
flycheck-autoloads highlight-indentation-autoloads lsp-mode-autoloads
f-autoloads markdown-mode-autoloads monokai-pro-theme-autoloads
monokai-theme-autoloads parseedn-autoloads parseclj-autoloads
pkg-info-autoloads epl-autoloads pyvenv-autoloads queue-autoloads
sesman-autoloads smartparens-autoloads spinner-autoloads
transient-autoloads compat-autoloads treemacs-autoloads cfrs-autoloads
posframe-autoloads ht-autoloads hydra-autoloads lv-autoloads
pfuture-autoloads ace-window-autoloads avy-autoloads s-autoloads info
xclip-autoloads yasnippet-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 448297 147916)
 (symbols 48 26308 97)
 (strings 32 127299 14185)
 (string-bytes 1 3562848)
 (vectors 16 46412)
 (vector-slots 8 1485471 200074)
 (floats 8 130 603)
 (intervals 56 478 216)
 (buffers 976 16))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65513; Package emacs. (Fri, 25 Aug 2023 06:30:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: 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:29:30 +0300
> 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).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65513; Package emacs. (Fri, 25 Aug 2023 16:10:01 GMT) Full text and rfc822 format available.

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 1 year and 94 days ago.

Previous Next


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