GNU bug report logs - #43891
26.3; Wrong background-mode on gnome-terminal 3.38

Previous Next

Package: emacs;

Reported by: semente <semente <at> riseup.net>

Date: Fri, 9 Oct 2020 21:31:01 UTC

Severity: normal

Tags: fixed

Found in version 26.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43891 in the body.
You can then email your comments to 43891 AT debbugs.gnu.org in the normal way.

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#43891; Package emacs. (Fri, 09 Oct 2020 21:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to semente <semente <at> riseup.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 09 Oct 2020 21:31:01 GMT) Full text and rfc822 format available.

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

From: semente <semente <at> riseup.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; Wrong background-mode on gnome-terminal 3.38
Date: Fri, 09 Oct 2020 18:30:00 -0300
On gnome-terminal 3.38 (and possibly on 3.36, 3.34 and future 
versions as well) Emacs is setting the background-mode to light 
while I'm running a dark background. On xterm or ttys it works 
fine.   The following snippet fix this issue: 

(setq frame-background-mode 'dark) (set-background-color "black") 
(set-foreground-color "white")

This is the same bug reported in #29716[1], which was fixed for 
gnome-terminal 3.22.  A solution made by Noam Postavsky is found 
on #29716 as well. Perhaps there is a way to fix this definetely 
for gnome-terminal, I believe it affects many users.

Thank you!
semente

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%2329716



In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
of 2020-05-16, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description:	Debian GNU/Linux bullseye/sid

Configured using:
'configure --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --enable-libsystemd --with-pop=yes
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --without-gconf --with-mailutils --build
x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
--libexecdir=/usr/lib --localstatedir=/var/lib
--infodir=/usr/share/info --mandir=/usr/share/man
--enable-libsystemd --with-pop=yes
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --without-gconf --with-mailutils --with-x=yes
--with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
-fdebug-prefix-map=/build/emacs-mHAik2/emacs-26.3+1=. -fstack-protector-strong
-Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
-D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS
GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD
LCMS2
Important settings:
 value of $LC_MONETARY: pt_BR.UTF-8
 value of $LC_NUMERIC: pt_BR.UTF-8
 value of $LC_TIME: pt_BR.UTF-8
 value of $LANG: en_US.UTF-8
 value of $XMODIFIERS: @im=ibus
 locale-coding-system: utf-8-unix




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43891; Package emacs. (Thu, 15 Oct 2020 15:29:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: semente <semente <at> riseup.net>
Cc: 43891 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38
Date: Thu, 15 Oct 2020 17:27:55 +0200
semente <semente <at> riseup.net> writes:

> This is the same bug reported in #29716[1], which was fixed for
> gnome-terminal 3.22.  A solution made by Noam Postavsky is found on
> #29716 as well. Perhaps there is a way to fix this definetely for
> gnome-terminal, I believe it affects many users.

In gnome-terminal 3.38, the version string in xterm--version-handler is:

"65;6200;1"

So, just hacking blindly without any clue what this is, the following
patch fixes the issue for me.

Does anybody know whether this makes sense or not?

diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 1a727e3933..6f5fa7518b 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -710,15 +710,18 @@ xterm--version-handler
     (while (and (setq chr (xterm--read-event-for-query)) (not (equal chr ?c)))
       (setq str (concat str (string chr))))
     ;; Since xterm-280, the terminal type (NUMBER1) is now 41 instead of 0.
-    (when (string-match "\\([0-9]+\\);\\([0-9]+\\);0" str)
+    (when (string-match "\\([0-9]+\\);\\([0-9]+\\);[01]" str)
       (let ((version (string-to-number (match-string 2 str))))
-        (when (and (> version 2000) (equal (match-string 1 str) "1"))
+        (when (and (> version 2000)
+                   (or (equal (match-string 1 str) "1")
+                       (equal (match-string 1 str) "65")))
           ;; Hack attack!  bug#16988: gnome-terminal reports "1;NNNN;0"
           ;; with a large NNNN but is based on a rather old xterm code.
           ;; Gnome terminal 2.32.1 reports 1;2802;0
           ;; Gnome terminal 3.6.1 reports 1;3406;0
           ;; Gnome terminal 3.22.2 reports 1;4601;0 and *does* support
           ;; background color querying (Bug#29716).
+          ;; Gnome terminal 3.38.0 reports 65;6200;1.
           (when (> version 4000)
             (xterm--query "\e]11;?\e\\"
                           '(("\e]11;" .  xterm--report-background-handler))))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43891; Package emacs. (Mon, 28 Dec 2020 03:11:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: semente <semente <at> riseup.net>
Cc: 43891 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38
Date: Mon, 28 Dec 2020 04:10:31 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

>> This is the same bug reported in #29716[1], which was fixed for
>> gnome-terminal 3.22.  A solution made by Noam Postavsky is found on
>> #29716 as well. Perhaps there is a way to fix this definetely for
>> gnome-terminal, I believe it affects many users.
>
> In gnome-terminal 3.38, the version string in xterm--version-handler is:
>
> "65;6200;1"
>
> So, just hacking blindly without any clue what this is, the following
> patch fixes the issue for me.
>
> Does anybody know whether this makes sense or not?

Nobody had an opinion here, so I pushed this to the trunk now.  It seems
to fix the problem, and should probably not regress anything.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 28 Dec 2020 03:11:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 43891 <at> debbugs.gnu.org and semente <semente <at> riseup.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 28 Dec 2020 03:11:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 25 Jan 2021 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 90 days ago.

Previous Next


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