From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bug-gnu-emacs@gnu.org (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#4234: marked as done (allow xterm to detect the background color) Date: Sun, 20 Dec 2009 16:01:02 +0000 Message-ID: References: <200912201600.nBKG073w021776@godzilla.ics.uci.edu> <200908221715.n7MHFCVA002498@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1261324862-26013-0" X-Trace: ger.gmane.org 1261375582 26981 80.91.229.12 (21 Dec 2009 06:06:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Dec 2009 06:06:22 +0000 (UTC) To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 21 07:06:15 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NMbPJ-0000Io-Ty for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Dec 2009 07:06:14 +0100 Original-Received: from localhost ([127.0.0.1]:45085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMbPJ-0007ae-UM for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Dec 2009 01:06:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMOMV-0001tK-Ez for bug-gnu-emacs@gnu.org; Sun, 20 Dec 2009 11:10:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMOMQ-0001qR-QQ for bug-gnu-emacs@gnu.org; Sun, 20 Dec 2009 11:10:26 -0500 Original-Received: from [199.232.76.173] (port=44026 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMOML-0001n3-4t; Sun, 20 Dec 2009 11:10:17 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43096) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NMOMK-0006sq-Pu; Sun, 20 Dec 2009 11:10:17 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NMODO-0006lb-A5; Sun, 20 Dec 2009 11:01:02 -0500 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: closed 4234 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Mon, 21 Dec 2009 01:01:59 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:33708 Archived-At: This is a multi-part message in MIME format... ------------=_1261324862-26013-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Sun, 20 Dec 2009 08:00:07 -0800 (PST) with message-id <200912201600.nBKG073w021776@godzilla.ics.uci.edu> and subject line Re: bug#4234: allow xterm to detect the background color has caused the Emacs bug report #4234, regarding allow xterm to detect the background color to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org immediately.) --=20 4234: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D4234 Emacs Bug Tracking System Contact bug-gnu-emacs@gnu.org with problems ------------=_1261324862-26013-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 22 Aug 2009 17:17:09 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.7 required=4.0 tests=AWL,IMPRONONCABLE_2, MURPHY_DRUGS_REL8,X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7MHH7fp011830 for ; Sat, 22 Aug 2009 10:17:08 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeuDC-0007zP-Ss for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2009 13:17:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeuD6-0007tX-S6 for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2009 13:17:06 -0400 Received: from [199.232.76.173] (port=50985 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeuD6-0007tP-P1 for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2009 13:17:00 -0400 Received: from sallyv2.ics.uci.edu ([128.195.1.120]:60987) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1MeuD6-0001Lv-At for bug-gnu-emacs@gnu.org; Sat, 22 Aug 2009 13:17:00 -0400 Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by sallyv2.ics.uci.edu (8.13.8+Sun/8.13.8) with ESMTP id n7MHFCff004350 for ; Sat, 22 Aug 2009 10:15:12 -0700 (PDT) Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id n7MHFCVA002498; Sat, 22 Aug 2009 10:15:12 -0700 (PDT) Date: Sat, 22 Aug 2009 10:15:12 -0700 (PDT) Message-Id: <200908221715.n7MHFCVA002498@godzilla.ics.uci.edu> From: Dan Nicolaescu To: bug-gnu-emacs Subject: allow xterm to detect the background color X-Debbugs-No-Ack: yes Lines: 80 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: n7MHFCff004350 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) emacs/emacsclient -nw running in an xterm set the frame background mode to 'light. Not all users use the default white background, so they get the wrong face colors. Newer xterms can tell what the background color is (see http://permalink.gmane.org/gmane.emacs.devel/111270) This patch implements reads the background color from xterm (iff it supports the feature) and sets the background mode accordingly. --- xterm.el.~1.62.~ 2009-01-08 14:24:21.000000000 -0800 +++ xterm.el 2009-08-22 10:12:38.000000000 -0700 @@ -462,8 +462,6 @@ (set-keymap-parent input-decode-map map))) (xterm-register-default-colors) - ;; This recomputes all the default faces given the colors we've just set up. - (tty-set-up-initial-frame-faces) ;; Try to turn on the modifyOtherKeys feature on modern xterms. ;; When it is turned on many more key bindings work: things like @@ -472,7 +470,8 @@ ;; modifyOtherKeys. At this time only xterm does. (let ((coding-system-for-read 'binary) (chr nil) - (str nil)) + (str nil) + version) ;; Pending input can be mistakenly returned by the calls to ;; read-event below. Discard it. (discard-input) @@ -494,8 +493,23 @@ ;; NUMBER2 is the xterm version number, look for something ;; greater than 216, the version when modifyOtherKeys was ;; introduced. - (when (>= (string-to-number - (substring str (match-beginning 1) (match-end 1))) 216) + (setq version (string-to-number + (substring str (match-beginning 1) (match-end 1)))) + ;; xterm version 242 supports reporting the background + ;; color, maybe earlier versions do too... + (when (>= version 242) + (send-string-to-terminal "\e]11;?\e\\") + (when (equal (read-event nil nil 2) ?\e) + (when (equal (read-event nil nil 2) ?\]) + (setq str "") + (while (not (equal (setq chr (read-event nil nil 2)) ?\\)) + (setq str (concat str (string chr)))) + (when (string-match "11;rgb:\\([a-f0-9]+\\)/\\([a-f0-9]+\\)/\\([a-f0-9]+\\)" str) + (xterm-set-background-mode + (string-to-number (match-string 1 str) 16) + (string-to-number (match-string 2 str) 16) + (string-to-number (match-string 3 str) 16)))))) + (when (>= version 216) ;; Make sure that the modifyOtherKeys state is restored when ;; suspending, resuming and exiting. (add-hook 'suspend-hook 'xterm-turn-off-modify-other-keys) @@ -508,6 +522,9 @@ xterm-modify-other-keys-terminal-list) (xterm-turn-on-modify-other-keys)))))) + ;; This recomputes all the default faces given the colors we've just set up. + (tty-set-up-initial-frame-faces) + (run-hooks 'terminal-init-xterm-hook)) ;; Set up colors, for those versions of xterm that support it. @@ -649,5 +666,11 @@ versions of xterm." (delq terminal xterm-modify-other-keys-terminal-list)) (send-string-to-terminal "\e[>4m" terminal))) +(defun xterm-set-background-mode (redc greenc bluec) + ;; Use the heuristic in `frame-set-background-mode' to decide if a + ;; frame is dark. + (when (< (+ redc greenc bluec) (* .6 (+ 65535 65535 65535))) + (set-terminal-parameter nil 'background-mode 'dark))) + ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a ;;; xterm.el ends here ------------=_1261324862-26013-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 4234-done) by debbugs.gnu.org; 20 Dec 2009 16:00:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NMOCi-0006hg-Cc for submit@debbugs.gnu.org; Sun, 20 Dec 2009 11:00:20 -0500 Received: from paul-mcgann-v0.ics.uci.edu ([128.195.1.147]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NMOCg-0006Ve-0c for 4234-done@emacsbugs.donarmstrong.com; Sun, 20 Dec 2009 11:00:18 -0500 Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by paul-mcgann-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id nBKG08WN010250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <4234-done@emacsbugs.donarmstrong.com>; Sun, 20 Dec 2009 08:00:08 -0800 Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id nBKG073w021776; Sun, 20 Dec 2009 08:00:07 -0800 (PST) Date: Sun, 20 Dec 2009 08:00:07 -0800 (PST) Message-Id: <200912201600.nBKG073w021776@godzilla.ics.uci.edu> From: Dan Nicolaescu To: 4234-done@emacsbugs.donarmstrong.com Subject: Re: bug#4234: allow xterm to detect the background color References: <200908221715.n7MHFCVA002498@godzilla.ics.uci.edu> X-Debbugs-No-Ack: yes In-Reply-To: <200908221715.n7MHFCVA002498@godzilla.ics.uci.edu> (Dan Nicolaescu's message of "Sat, 22 Aug 2009 10:15:12 -0700 (PDT)") Lines: 1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: nBKG08WN010250 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-Spam-Status: No X-Debbugs-Envelope-To: 4234-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Patch is in. ------------=_1261324862-26013-0--