all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Ruffing <crypto@timruffing.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tastytea@tastytea.de, 44950@debbugs.gnu.org
Subject: bug#44950: 28.0.50; 24-bit colors not used in terminal with emacsclient
Date: Mon, 31 May 2021 18:45:38 +0200	[thread overview]
Message-ID: <ea6940e8e1695dab80c28ca64ab56547a1c2cd70.camel@timruffing.de> (raw)
In-Reply-To: <83wnre27wa.fsf@gnu.org>

For context: I'm coming from 
https://github.com/kovidgoyal/kitty/issues/1141#issuecomment-851289392
where the maintainer of kitty told me that they may be able to add a
kludge on their side but rather prefer to have it fixed on the emacs
side... And yeah, I understand both positions, noone wants to have ugly
code but I think someone needs to add it and emacs user would prefer
from this (not only in kitty but also in the rather common tmux).

But let me give you some more context. I think when emacs was changed
to support the RGB flag, it was believed that this is the right
("standard") way to do it. And this may be true if you ask ncurses but
apparently the maintainer hasn't been exactly helpful in the past [1].

The thing is that kitty had "RGB" in the terminfo but removed it again
and I think they're right. The way it's designed is just awful:
RGB is mutually exclusive with 256 color mode, so if you have RGB
applications like emacs and other applications that only support 256
colors (which exist out there), you need to set TERM depending on which
application you run. That's certainly not the idea of terminfo but
apparently this is how ncurses thinks RGB should be used and that's why
the ship with all the "-direct" terminfos [2]. But if the user needs to
set TERM anyway, what's the point of terminfos?  

So I can understand but I think the entire situation is just a big mess
and at this point some pragmatic solution is the best way forward...

By the way, it's interesting to see what others do. neovim's code in
fact has quirks for all the terminals [3]. Then "tc" sounds like the
easier option, and it's certainly a smaller hack than an env variable.

[1] https://lists.gnu.org/archive/html/bug-ncurses/2016-08/msg00036.html
[2] https://github.com/kovidgoyal/kitty/issues/1141#issuecomment-851289392
[3] https://github.com/neovim/neovim/blob/c46d9814619cee5183ea08989352d72fb9aaea5a/src/nvim/tui/tui.c#L1618

On Mon, 2021-05-31 at 19:19 +0300, Eli Zaretskii wrote:
> > From: Tim Ruffing <crypto@timruffing.de>
> > Cc: 44950@debbugs.gnu.org
> > Date: Mon, 31 May 2021 16:06:55 +0200
> > 
> > I think what tastytea is saying is that when emacs checks the env
> > variable COLORTERM, it uses the environment of the server and not the
> > one of emacsclient. And yes, that's just a bug. emacsclient should
> > read
> > that variable and pass it to server. But this requires new code
> > because
> > it breaks with the pattern of using terminfo to detect term support.
> > 
> > So the terminfo detection is currently more reliable. Would you be
> > willing to accept something like the attached patch? This will
> > improve
> > detection without relying on COLORTERM, which should make the
> > situation
> > already much better. Tc is in the terminfo of many terminals, see
> > https://gist.github.com/XVilka/8346728 .
> 
> That sounds like a kludge to me, of which we already have quite a few
> there (the COLORTERM thing is already a kludge).  Do we really have to
> add one more trick, just to paper over bad terminfo data?  Why don't
> these terminals get their act together and fix their terminfo?







  reply	other threads:[~2021-05-31 16:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 15:56 bug#44950: 28.0.50; 24-bit colors not used in terminal with emacsclient tastytea via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-29 18:47 ` Eli Zaretskii
2020-11-29 20:01   ` tastytea via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-31 14:06 ` Tim Ruffing
2021-05-31 16:19   ` Eli Zaretskii
2021-05-31 16:45     ` Tim Ruffing [this message]
2021-05-31 17:04       ` Eli Zaretskii
2021-06-06 10:36   ` Lars Ingebrigtsen
2021-07-21 12:05     ` Lars Ingebrigtsen
2021-07-21 18:39       ` Tim Ruffing
2021-10-11 12:34         ` Stefan Kangas
2021-11-11  6:15         ` Lars Ingebrigtsen
2021-11-12 19:44           ` Tim Ruffing
2021-11-13 15:10             ` Eli Zaretskii
2021-11-16 16:42               ` Tim Ruffing
2021-11-16 17:22                 ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=ea6940e8e1695dab80c28ca64ab56547a1c2cd70.camel@timruffing.de \
    --to=crypto@timruffing.de \
    --cc=44950@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=tastytea@tastytea.de \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.