From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#32072: 27.0.50; clear-face-cache in an X frame breaks tty colors Date: Thu, 19 Jul 2018 16:20:06 +0300 Message-ID: <83lga72whl.fsf@gnu.org> References: <87r2k06m1q.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1532006346 4601 195.159.176.226 (19 Jul 2018 13:19:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Jul 2018 13:19:06 +0000 (UTC) Cc: mi-ebugs@kismala.com, 32072@debbugs.gnu.org, rami.ylimaki@vincit.fi To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 19 15:19:01 2018 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 1fg8ph-000145-2v for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Jul 2018 15:19:01 +0200 Original-Received: from localhost ([::1]:42801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg8rn-00031g-VJ for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Jul 2018 09:21:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg8ri-00031a-2Y for bug-gnu-emacs@gnu.org; Thu, 19 Jul 2018 09:21:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg8re-0003uG-RI for bug-gnu-emacs@gnu.org; Thu, 19 Jul 2018 09:21:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fg8re-0003uA-Mx for bug-gnu-emacs@gnu.org; Thu, 19 Jul 2018 09:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fg8re-0004UW-HQ for bug-gnu-emacs@gnu.org; Thu, 19 Jul 2018 09:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Jul 2018 13:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32072 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 32072-submit@debbugs.gnu.org id=B32072.153200642417195 (code B ref 32072); Thu, 19 Jul 2018 13:21:02 +0000 Original-Received: (at 32072) by debbugs.gnu.org; 19 Jul 2018 13:20:24 +0000 Original-Received: from localhost ([127.0.0.1]:47649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fg8r2-0004TH-21 for submit@debbugs.gnu.org; Thu, 19 Jul 2018 09:20:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56987) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fg8qz-0004T4-HG for 32072@debbugs.gnu.org; Thu, 19 Jul 2018 09:20:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg8qt-0003av-J7 for 32072@debbugs.gnu.org; Thu, 19 Jul 2018 09:20:16 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg8qm-0003XG-Pf; Thu, 19 Jul 2018 09:20:08 -0400 Original-Received: from [176.228.60.248] (port=4665 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fg8qm-0005Sv-7M; Thu, 19 Jul 2018 09:20:08 -0400 In-reply-to: <87r2k06m1q.fsf@gmail.com> (message from Noam Postavsky on Wed, 18 Jul 2018 21:39:45 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:148668 Archived-At: > From: Noam Postavsky > Date: Wed, 18 Jul 2018 21:39:45 -0400 > Cc: 32072@debbugs.gnu.org, > Rami Ylimäki > > > I have done some more testing and found that 24-bit terminal frames are > > not affected, their colors remain intact after doing (clear-face-cache) > > in the X11 frame. > > Hmm, interesting, I've bisected the problem to [1: e463e5762b]. > > [1: e463e5762b]: 2017-02-18 13:04:55 +0200 > Support 24-bit direct colors on text terminals > https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e463e5762bbe628be3d15da066a90f079a8468b3 Thanks. Just stabbing in the dark here, but does the patch below help? diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el index ab9149e..a776c83 100644 --- a/lisp/term/tty-colors.el +++ b/lisp/term/tty-colors.el @@ -824,10 +824,12 @@ tty-color-canonicalize (replace-regexp-in-string " +" "" (downcase color)) color))) -(defun tty-color-24bit (rgb) - "Return pixel value on 24-bit terminals. Return nil if RGB is -nil or not on 24-bit terminal." - (when (and rgb (= (display-color-cells) 16777216)) +(defun tty-color-24bit (rgb &optional display) + "Return 24-bit color pixel value for RGB value on DISPLAY. +DISPLAY can be a display name or a frame, and defaults to the +selected frame's display. +If DISPLAY is not on a 24-but TTY terminal, return nil." + (when (and rgb (= (display-color-cells display) 16777216)) (let ((r (lsh (car rgb) -8)) (g (lsh (cadr rgb) -8)) (b (lsh (nth 2 rgb) -8))) @@ -850,7 +852,7 @@ tty-color-define (error "Invalid specification for tty color \"%s\"" name)) (tty-modify-color-alist (append (list (tty-color-canonicalize name) - (or (tty-color-24bit rgb) index)) + (or (tty-color-24bit rgb frame) index)) rgb) frame)) @@ -1026,7 +1028,7 @@ tty-color-desc (or (assoc color (tty-color-alist frame)) (let ((rgb (tty-color-standard-values color))) (and rgb - (let ((pixel (tty-color-24bit rgb))) + (let ((pixel (tty-color-24bit rgb frame))) (or (and pixel (cons color (cons pixel rgb))) (tty-color-approximate rgb frame)))))))))