unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: 74252@debbugs.gnu.org
Subject: bug#74252: 31.0.50; multi-tty;: init_tty using getenv for COLORTERM
Date: Fri, 08 Nov 2024 11:22:18 +0100	[thread overview]
Message-ID: <m25xoy3u05.fsf@gmail.com> (raw)
In-Reply-To: <m21pzmyvz4.fsf@gmail.com> ("Gerd Möllmann"'s message of "Fri, 08 Nov 2024 09:23:59 +0100")

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

The following patch works perfectly for me (including daemon mode).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: init_tty --]
[-- Type: text/x-patch, Size: 1394 bytes --]

From 1d729a0bdeef0534c05b5f8358b19c04a814a308 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <gerd@gnu.org>
Date: Fri, 8 Nov 2024 11:05:58 +0100
Subject: [PATCH] multi-tty: fix wrong COLORTERM (bug#74252)

* src/term.c (init_tty): Use egetenv, not getenv, to pick up
emacsclient's environment.
---
 src/term.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/term.c b/src/term.c
index 66395ac6077..80a14fa1277 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4358,7 +4358,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
 
       tty->TN_max_colors = tgetnum ("Co");
 
-#ifdef TERMINFO
+#  ifdef TERMINFO
       {
 	const char *fg = tigetstr ("setf24");
 	const char *bg = tigetstr ("setb24");
@@ -4383,7 +4383,9 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
 	   (de-facto standard introduced by tmux) or if	requested by
 	   the COLORTERM environment variable.  */
 	else if ((tigetflag ("Tc") > 0)
-		 || ((bg = getenv ("COLORTERM")) != NULL
+		 /* Use egetenv, not getenv, here so that we pick up
+		    environment variables sent to us by emacsclient.  */
+		 || ((bg = egetenv ("COLORTERM")) != NULL
 		     && strcasecmp (bg, "truecolor") == 0))
 	  {
 	    tty->TS_set_foreground = "\033[%?%p1%{8}%<%t3%p1%d%e38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
-- 
2.47.0


  reply	other threads:[~2024-11-08 10:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  8:23 bug#74252: 31.0.50; multi-tty;: init_tty using getenv for COLORTERM Gerd Möllmann
2024-11-08 10:22 ` Gerd Möllmann [this message]
2024-11-08 11:47   ` bug#74252: 31.0.50; multi-tty; : " Eli Zaretskii
2024-11-08 12:00     ` bug#74252: 31.0.50; multi-tty;: " Gerd Möllmann

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=m25xoy3u05.fsf@gmail.com \
    --to=gerd.moellmann@gmail.com \
    --cc=74252@debbugs.gnu.org \
    /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).