From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#29716: 25.1; Wrong brackground-mode on gnome-terminal Date: Thu, 14 Dec 2017 21:47:45 -0500 Message-ID: <87y3m4btbi.fsf@users.sourceforge.net> References: <87shcd56jv.fsf@cafe.lan> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1513306106 1756 195.159.176.226 (15 Dec 2017 02:48:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 02:48:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29716@debbugs.gnu.org To: semente Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 15 03:48:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePg2r-0007uX-7f for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 Dec 2017 03:48:17 +0100 Original-Received: from localhost ([::1]:43901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePg2r-0001cN-C3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Dec 2017 21:48:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePg2i-0001cE-Ub for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2017 21:48:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePg2c-0003u9-PS for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2017 21:48:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePg2c-0003tG-HD for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2017 21:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ePg2c-0008F8-7A for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2017 21:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Dec 2017 02:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29716 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29716-submit@debbugs.gnu.org id=B29716.151330607831675 (code B ref 29716); Fri, 15 Dec 2017 02:48:02 +0000 Original-Received: (at 29716) by debbugs.gnu.org; 15 Dec 2017 02:47:58 +0000 Original-Received: from localhost ([127.0.0.1]:34398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePg2Y-0008Ek-D4 for submit@debbugs.gnu.org; Thu, 14 Dec 2017 21:47:58 -0500 Original-Received: from mail-it0-f45.google.com ([209.85.214.45]:33553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePg2T-0008EQ-PV; Thu, 14 Dec 2017 21:47:55 -0500 Original-Received: by mail-it0-f45.google.com with SMTP id o130so27737118itg.0; Thu, 14 Dec 2017 18:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=LPorvf1yCTS3F3P/6x2QzvJF0icvRhdEUTDs8IVjugc=; b=O4uSpapMjVJ7HKUhsBeJvQHzjtW+iNzBDYw0sFtZzKdUx787tr8y/ap/g5yATGHatt Zh0VHVR/3TGhyD+EQnIvSiVmVtyJLvGDOiQlnfsvEVEKidL91WzLu9YOrz4lZ3BsnjbP CuMDmyxCigLQ5SV4EuLdu2E6ffFwf/yOY/1R3nDrsN0e475rqg+odtx6KiBneSMmDfDk hHFbvQ7t4UoD72KpiH432eMCCywxGo9C7x7vaCVNTYGbRkk0JHNjJIVuDhJ1NB9+nceO CDt8YQIg82DN3y1ht0gtWrk5O0bpt9JbWRIdhLFvIjc5yZIG5RjIpVqnDQz+sMJnKmg8 2zuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=LPorvf1yCTS3F3P/6x2QzvJF0icvRhdEUTDs8IVjugc=; b=FhJWE0qp45m4MHD1VXNBzL606UJeogrL6lIYdil2ETDfCnqxnQdaPxF45IjMwxeiJc 3W8Dg7FmPpQ3Z23XhS0Cvd94uNXilEit4225rsDALIuP9VlzOUAo4QkyxM3eY91UOJdy kFOFjIvqJvjldDW44qqafem5/EQrIpAmvg+7Fb1uUSfxrHdl1NukltYeONy1cKvWLDlD 91b91mWOqrTbOGspGWWMwC7kKK5X4DC84OYgOq6ZoxcgUjYI2G2bHJn7L+Re5zuGa/al j4FdQYH5P0zja/UTb8B++k6beK41t04yFZuNR9/ZUoBCLtROk+5JfWvZTs8fLq/kb/gW gkmQ== X-Gm-Message-State: AKGB3mID0z/yQugCG9yfZXXu3MzziLXQUkEmyJrQylkDFpPuWgASjMbj 3XdmKj1kCjU/EOGUnbpf5F6cjQ== X-Google-Smtp-Source: ACJfBosQXG/mnKOw1eeMm0yVWGi0EzXuDmw1NuFMtikI93mxuig13NqWLyyd5s7Q4uSUTDxzoU/nVA== X-Received: by 10.107.11.91 with SMTP id v88mr10339279ioi.179.1513306067896; Thu, 14 Dec 2017 18:47:47 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 139sm8799113itm.2.2017.12.14.18.47.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 18:47:46 -0800 (PST) In-Reply-To: <87shcd56jv.fsf@cafe.lan> (semente's message of "Thu, 14 Dec 2017 19:43:48 -0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141087 Archived-At: --=-=-= Content-Type: text/plain tags 29716 + patch quit semente 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))...) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Query-background-for-gnome-terminal-version-3.22-.patch Content-Description: patch >From 34b6835f7581fb19f67fe134eab0b536af003dfa Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--