From 08b8e6b1c60f4df6d4dc56f9239f353c3cfd4bbedf041e430f9b3fbdb2f4c456 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 7 Jun 2021 07:06:16 +0000 Subject: [PATCH] Accepting request 896402 from home:dmacvicar:branches:editors - For terminal 24bit support, fall back to xterm+direct (semicolon version) if requested by the COLORTERM environment variable. Upstream commit 50f489b5dc. Allows 24bit color on gnome-terminal out of the box. * emacs-27.2-COLORTERM-24bit.patch OBS-URL: https://build.opensuse.org/request/show/896402 OBS-URL: https://build.opensuse.org/package/show/editors/emacs?expand=0&rev=307 --- emacs-27.2-COLORTERM-24bit.patch | 35 ++++++++++++++++++++++++++++++++ emacs.changes | 9 ++++++++ emacs.spec | 4 ++++ 3 files changed, 48 insertions(+) create mode 100644 emacs-27.2-COLORTERM-24bit.patch diff --git a/emacs-27.2-COLORTERM-24bit.patch b/emacs-27.2-COLORTERM-24bit.patch new file mode 100644 index 0000000..35c3325 --- /dev/null +++ b/emacs-27.2-COLORTERM-24bit.patch @@ -0,0 +1,35 @@ +diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi +index f5f01848f77f..8f7ed715b523 100644 +--- a/doc/misc/efaq.texi ++++ b/doc/misc/efaq.texi +@@ -1595,6 +1595,10 @@ xterm-direct2 xterm with direct-color indexing (old) + xterm-direct xterm with direct-color indexing + @end example + ++If Terminfo database is not available, but 24-bit direct color mode is ++supported, it can still be enabled by defining the environment ++variable @env{COLORTERM} to @samp{truecolor}. ++ + Terminals with @samp{RGB} capability treat pixels #000001 - #000007 as + indexed colors to maintain backward compatibility with applications + that are unaware of direct color mode. Therefore the seven darkest +diff --git a/src/term.c b/src/term.c +index 94bf013f4a07..5cbb092ad177 100644 +--- a/src/term.c ++++ b/src/term.c +@@ -4168,6 +4168,15 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ + could return 32767. */ + tty->TN_max_colors = 16777216; + } ++ /* Fall back to xterm+direct (semicolon version) if requested ++ by the COLORTERM environment variable. */ ++ else if ((bg = getenv("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"; ++ tty->TS_set_background = "\033[%?%p1%{8}%<%t4%p1%d%e48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m"; ++ tty->TN_max_colors = 16777216; ++ } + } + #endif + diff --git a/emacs.changes b/emacs.changes index 8e3795e..add04d7 100644 --- a/emacs.changes +++ b/emacs.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon May 31 05:49:58 UTC 2021 - Duncan Mac-Vicar P + +- For terminal 24bit support, fall back to xterm+direct + (semicolon version) if requested by the COLORTERM environment variable. + Upstream commit 50f489b5dc. + Allows 24bit color on gnome-terminal out of the box. + * emacs-27.2-COLORTERM-24bit.patch + ------------------------------------------------------------------- Wed May 26 13:31:49 UTC 2021 - Dr. Werner Fink diff --git a/emacs.spec b/emacs.spec index 871bdc7..935bfde 100644 --- a/emacs.spec +++ b/emacs.spec @@ -178,6 +178,9 @@ Patch24: emacs-25.2-ImageMagick7.patch Patch25: emacs-26.1-xft4x11.patch Patch26: emacs-27.1-pdftex.patch Patch29: emacs-27.1-Xauthority4server.patch +# This patch allows vte based terminals like gnome-terminal to get 24bit colors +# without setting a custom terminfo, honouring COLORTERM=truecolor +Patch30: emacs-27.2-COLORTERM-24bit.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %{expand: %%global include_info %(test -s /usr/share/info/info.info* && echo 0 || echo 1)} @@ -294,6 +297,7 @@ and most assembler-like syntaxes. %patch25 -p0 -b .xft %patch26 -p0 -b .fmt %patch29 -p0 -b .xauth +%patch30 -p1 -b .colorterm %patch -p0 -b .0 %if %{without tex4pdf} pushd etc/refcards/