* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
@ 2017-12-14 21:43 semente
2017-12-15 1:13 ` Noam Postavsky
2017-12-15 2:47 ` Noam Postavsky
0 siblings, 2 replies; 9+ messages in thread
From: semente @ 2017-12-14 21:43 UTC (permalink / raw)
To: 29716
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org. Please check that
the From: line contains a valid email address. After a delay of
up
to one day, you should receive an acknowledgment at that address.
Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.
Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug. If you can, give a recipe
starting from 'emacs -Q':
On gnome-terminal 3.22.2 (Debian Stretch), for some reason, Emacs
is
setting the background-mode to light when I'm running a dark
background. On xterm or ttys it works fine.
The only way I found to fix this is by forcing a dark mode, as for
example:
(setq frame-background-mode 'dark)
(set-background-color "black")
(set-foreground-color "white")
Thanks,
semente
If Emacs crashed, and you have the Emacs process in the gdb
debugger,
please include the output from the following gdb commands:
'bt full' and 'xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/25.1/etc/DEBUG.
In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-09-15, modified by Debian built on trouble
System Description: Debian GNU/Linux 9.3 (stretch)
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 --with-pop=yes
--enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/loca\
l/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/loca\
l/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --with-x=yes --with-x-toolkit=gtk3
--with-toolkit-scroll-bars 'CFLAGS=-g -O2
-fdebug-prefix-map=/build/emacs25-wN2qS3/emacs25-25.1+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 GCONF
GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT
ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
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
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822
mml
mml-sec password-cache epg epg-config gnus-util mm-decode
mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils term/xterm xterm
time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd
fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame
cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak
czech
european ethiopic indian cyrillic chinese charscript case-table
epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties
overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify
dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit
x
multi-tty make-network-process emacs)
Memory information:
((conses 16 91298 7489)
(symbols 48 19941 0)
(miscs 40 46 172)
(strings 32 14764 4115)
(string-bytes 1 415527)
(vectors 16 9779)
(vector-slots 8 386436 16291)
(floats 8 166 523)
(intervals 56 251 0)
(buffers 976 20))
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2017-12-14 21:43 bug#29716: 25.1; Wrong brackground-mode on gnome-terminal semente
@ 2017-12-15 1:13 ` Noam Postavsky
2017-12-15 1:44 ` semente
2017-12-15 2:47 ` Noam Postavsky
1 sibling, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2017-12-15 1:13 UTC (permalink / raw)
To: semente; +Cc: 29716
severity 29716 minor
severity 29473 minor
quit
semente <semente@riseup.net> writes:
> On gnome-terminal 3.22.2 (Debian Stretch), for some reason, Emacs is
> setting the background-mode to light when I'm running a dark
> background. On xterm or ttys it works fine.
>
> The only way I found to fix this is by forcing a dark mode, as for
> example:
>
> (setq frame-background-mode 'dark)
> (set-background-color "black")
> (set-foreground-color "white")
What do you get from running
printf '\e[>0c'
and
printf '\e]11;?\e\'
in the shell from gnome-terminal?
See also https://debbugs.gnu.org/cgi/bugreport.cgi?users=emacs;bug=29473#11
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2017-12-15 1:13 ` Noam Postavsky
@ 2017-12-15 1:44 ` semente
0 siblings, 0 replies; 9+ messages in thread
From: semente @ 2017-12-15 1:44 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 29716
Noam Postavsky <npostavs@users.sourceforge.net> writes:
> What do you get from running
> printf '\e[>0c'
> and
> printf '\e]11;?\e\'
> in the shell from gnome-terminal?
Hi Noam, thanks for follow up!
$ printf '\e[>0c'
1;4601;0c
$ printf '\e]11;?\e\'
11;rgb:2323/2727/2929
$ echo $TERM
xterm-256color
--
semente
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2017-12-14 21:43 bug#29716: 25.1; Wrong brackground-mode on gnome-terminal semente
2017-12-15 1:13 ` Noam Postavsky
@ 2017-12-15 2:47 ` Noam Postavsky
2017-12-15 8:52 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2017-12-15 2:47 UTC (permalink / raw)
To: semente; +Cc: 29716
[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]
tags 29716 + patch
quit
semente <semente@riseup.net> writes:
> On gnome-terminal 3.22.2 (Debian Stretch), for some reason, Emacs is
> setting the background-mode to light when I'm running a dark
> background. On xterm or ttys it works fine.
> $ printf '\e[>0c'
> 1;4601;0c
>
> $ printf '\e]11;?\e\'
> 11;rgb:2323/2727/2929
>
> $ echo $TERM
> xterm-256color
I think the attached should do the trick then. There are two other
xterm features that Emacs tries to use based on version number; I'm not
sure how to test if your version of gnome-terminal supports them or not
though (so I played it safe in the patch and use the query background
feature only).
(defun xterm--version-handler ()
...
;; If version is 216 (the version when modifyOtherKeys was
;; introduced) or higher, initialize the
;; modifyOtherKeys support.
(when (>= version 216)
(xterm--init-modify-other-keys))
;; In version 203 support for accessing the X selection was
;; added. Hterm reports itself as version 256 and supports it
;; as well. gnome-terminal doesn't and is excluded by this
;; test.
(when (>= version 203)
;; Most xterms seem to have it disabled by default, and if it's
;; disabled, C-y will incur a timeout, so we only use it if the user
;; explicitly requests it.
;;(xterm--init-activate-get-selection)
(xterm--init-activate-set-selection))...)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1552 bytes --]
From 34b6835f7581fb19f67fe134eab0b536af003dfa Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 14 Dec 2017 21:42:56 -0500
Subject: [PATCH v1] Query background for gnome terminal version 3.22
(Bug#29716)
* lisp/term/xterm.el (xterm--version-handler): Use
xterm--report-background-handler for terminals reporting minor version
4000 and above.
---
lisp/term/xterm.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 4f79703833..df224757f9 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -670,9 +670,14 @@ xterm--version-handler
(when (and (> version 2000) (equal (match-string 1 str) "1"))
;; 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 3.6.1 reports 1;3406;0
;; Gnome terminal 2.32.1 reports 1;2802;0
- (setq version 200))
+ ;; Gnome terminal 3.6.1 reports 1;3406;0
+ (setq version 200)
+ ;; Gnome terminal 3.22.2 reports 1;4601;0 and *does* support
+ ;; background color querying (Bug#29716).
+ (when (> version 4000)
+ (xterm--query "\e]11;?\e\\"
+ '(("\e]11;" . xterm--report-background-handler)))))
(when (equal (match-string 1 str) "83")
;; `screen' (which returns 83;40003;0) seems to also lack support for
;; some of these (bug#17607, bug#20356).
--
2.11.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2017-12-15 2:47 ` Noam Postavsky
@ 2017-12-15 8:52 ` Eli Zaretskii
2017-12-25 18:27 ` semente
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-12-15 8:52 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 29716, semente
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Thu, 14 Dec 2017 21:47:45 -0500
> Cc: 29716@debbugs.gnu.org
>
> I think the attached should do the trick then.
Thanks, this is okay for the release branch, assuming that it fixes
the problem.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2017-12-15 8:52 ` Eli Zaretskii
@ 2017-12-25 18:27 ` semente
2018-01-01 1:19 ` Noam Postavsky
0 siblings, 1 reply; 9+ messages in thread
From: semente @ 2017-12-25 18:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29716, Noam Postavsky
Hey Eli and Noam, sorry for the delay in give you a feedback but
the patch unfortunately didn't work for me.
Thank you,
semente
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Noam Postavsky <npostavs@users.sourceforge.net>
>> Date: Thu, 14 Dec 2017 21:47:45 -0500
>> Cc: 29716@debbugs.gnu.org
>>
>> I think the attached should do the trick then.
>
> Thanks, this is okay for the release branch, assuming that it
> fixes
> the problem.
--
semente
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2017-12-25 18:27 ` semente
@ 2018-01-01 1:19 ` Noam Postavsky
2018-01-07 23:24 ` semente
0 siblings, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2018-01-01 1:19 UTC (permalink / raw)
To: semente; +Cc: 29716
semente <semente@riseup.net> writes:
> Hey Eli and Noam, sorry for the delay in give you a feedback but the
> patch unfortunately didn't work for me.
Hmm, what does the evaluating the following produce? It should pop up a
buffer *bug29716* showing something like "background: rgb:ee00/e800/d500^[".
(defun bug29716--report-background-handler ()
(let ((str "")
chr)
;; The reply should be: \e ] 11 ; rgb: NUMBER1 / NUMBER2 / NUMBER3 \e \\
(while (and (setq chr (read-event nil nil 2)) (not (equal chr ?\\)))
(setq str (concat str (string chr))))
(with-current-buffer (get-buffer-create "*bug29716*")
(insert (format "background: %s\n" str))
(display-buffer (current-buffer)))))
(xterm--query "\e]11;?\e\\"
'(("\e]11;" . bug29716--report-background-handler)))
If that works, is it possible you didn't test the patch correctly?
(e.g., maybe you applied the patch, but didn't recompile?)
If it doesn't work, I'm a bit confused, given what you reported in #13.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29716: 25.1; Wrong brackground-mode on gnome-terminal
2018-01-01 1:19 ` Noam Postavsky
@ 2018-01-07 23:24 ` semente
2018-01-08 1:30 ` Noam Postavsky
0 siblings, 1 reply; 9+ messages in thread
From: semente @ 2018-01-07 23:24 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 29716
Got this:
background: rgb:2323/2727/2929^[
Anyway, I might just have found the issue.
The patch set the version to 200 before evaluating the following
code:
(when (> version 4000)
(xterm--query "\e]11;?\e\\"
'(("\e]11;" .
xterm--report-background-handler))))
So the expression above is never evaluated.
I moved the `(setq version 200)' line to the line after the `(when
...)' expression and it is working now but don't know if it is
exactly what you would do.
Thank you once again!
Noam Postavsky <npostavs@users.sourceforge.net> writes:
> semente <semente@riseup.net> writes:
>
>> Hey Eli and Noam, sorry for the delay in give you a feedback
>> but the
>> patch unfortunately didn't work for me.
>
> Hmm, what does the evaluating the following produce? It should
> pop up a
> buffer *bug29716* showing something like "background:
> rgb:ee00/e800/d500^[".
>
> (defun bug29716--report-background-handler ()
> (let ((str "")
> chr)
> ;; The reply should be: \e ] 11 ; rgb: NUMBER1 / NUMBER2
> / NUMBER3 \e \\
> (while (and (setq chr (read-event nil nil 2)) (not
> (equal chr ?\\)))
> (setq str (concat str (string chr))))
> (with-current-buffer (get-buffer-create "*bug29716*")
> (insert (format "background: %s\n" str))
> (display-buffer (current-buffer)))))
>
> (xterm--query "\e]11;?\e\\"
> '(("\e]11;" .
> bug29716--report-background-handler)))
>
> If that works, is it possible you didn't test the patch
> correctly?
> (e.g., maybe you applied the patch, but didn't recompile?)
>
> If it doesn't work, I'm a bit confused, given what you reported
> in #13.
--
semente
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-01-08 1:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14 21:43 bug#29716: 25.1; Wrong brackground-mode on gnome-terminal semente
2017-12-15 1:13 ` Noam Postavsky
2017-12-15 1:44 ` semente
2017-12-15 2:47 ` Noam Postavsky
2017-12-15 8:52 ` Eli Zaretskii
2017-12-25 18:27 ` semente
2018-01-01 1:19 ` Noam Postavsky
2018-01-07 23:24 ` semente
2018-01-08 1:30 ` Noam Postavsky
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).