unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38
@ 2020-10-09 21:30 semente
  2020-10-15 15:27 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: semente @ 2020-10-09 21:30 UTC (permalink / raw)
  To: 43891

 
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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38
  2020-10-09 21:30 bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38 semente
@ 2020-10-15 15:27 ` Lars Ingebrigtsen
  2020-12-28  3:10   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-15 15:27 UTC (permalink / raw)
  To: semente; +Cc: 43891, Noam Postavsky

semente <semente@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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38
  2020-10-15 15:27 ` Lars Ingebrigtsen
@ 2020-12-28  3:10   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-28  3:10 UTC (permalink / raw)
  To: semente; +Cc: 43891, Noam Postavsky

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-28  3:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09 21:30 bug#43891: 26.3; Wrong background-mode on gnome-terminal 3.38 semente
2020-10-15 15:27 ` Lars Ingebrigtsen
2020-12-28  3:10   ` Lars Ingebrigtsen

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).