unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>,
	Thierry Volpiatto <thievol@posteo.net>
Cc: 54774@debbugs.gnu.org
Subject: bug#54774: 28.1; ansi-color with no colors in Emacs-28
Date: Fri, 8 Apr 2022 11:23:41 -0700	[thread overview]
Message-ID: <5f2525c7-bfc3-cac7-7dda-a10b11c6592d@gmail.com> (raw)
In-Reply-To: <87tub37lqe.fsf@gnus.org>

On 4/8/2022 6:23 AM, Lars Ingebrigtsen wrote:
> Thierry Volpiatto <thievol@posteo.net> writes:
> 
>> it seems using ansi-color-apply in Emacs-28 is not working properly,
>> there is no colors.  In Emacs-29 it is working properly (very nice)
>> without needing a workaround used previously in emacs-27 (code commented).
>> See code below to reproduce and Screenshots attached.
> 
> I'm not sure I understand this bug report.  Are you asking for the code
> in ansi-color in Emacs 29 to be backported to Emacs 28.2?

I think the issue is that there were some changes in Emacs 28.1 (by me, 
see commit ceb9da3b7125fbdf0da04a3b158ac1e792c87f4f) to add support for 
ANSI "bright" colors. In 29, Miha added support for 256-color and 24-bit 
ANSI colors as well (see 0fa2279b90bf5a638d8377032b71135e1374e8fb).

I've verified that Emacs 28.1 properly handles normal and bright ANSI 
colors in shell output. Bold/italic/etc works correctly as well, even 
though I added an unnecessary quote to the face definitions - that's 
been fixed in Emacs 29, and could be backported to 28, though I don't 
think it causes any serious problems.

That said, it looks like Thierry had written some code for Emacs 27 that 
scans the output of a command that uses ANSI 256-color sequences and 
then translates those sequences into ANSI 8-color sequences that 
ansi-color.el will understand. However, that code no longer works in 
Emacs 28, possibly due to my changes to support ANSI bright colors. I'm 
not sure this is actually a bug in Emacs; it may just mean that 
Thierry's workaround needs to be updated to account for the 
ansi-color.el changes I made.

I'm a little unclear about what actually broke though, and haven't had a 
chance to dig deeper. Some basic testing of `ansi-color-apply' shows 
that it does what I expect. From "emacs -Q":

   (require 'ansi-color)
   (ansi-color-apply "\033[44mfoo\033[0m")
     -> #("foo" 0 3 (font-lock-face (:background "blue2")))
   (ansi-color-apply "\033[44;33mfoo\033[0m")
     -> #("foo" 0 3 (font-lock-face ((:foreground "yellow3") 
(:background "blue2"))))

That's the same behavior as Emacs 27.2 with some trivial differences 
(Emacs 27.2 uses `foreground-color' instead of `:foreground').





  parent reply	other threads:[~2022-04-08 18:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 19:49 bug#54774: 28.1; ansi-color with no colors in Emacs-28 Thierry Volpiatto
2022-04-07 20:10 ` Thierry Volpiatto
2022-04-07 20:24   ` Thierry Volpiatto
2022-04-08 13:23 ` Lars Ingebrigtsen
2022-04-08 17:48   ` Thierry Volpiatto
2022-04-08 18:23   ` Jim Porter [this message]
2022-04-09  7:25     ` Thierry Volpiatto
2022-04-09 17:31       ` Jim Porter
2022-04-09 18:18         ` Thierry Volpiatto
2022-04-10 12:01           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f2525c7-bfc3-cac7-7dda-a10b11c6592d@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=54774@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=thievol@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).