From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22154: 25.0.50; emacsclient -c "breaks" 256-color display in server Date: Tue, 15 Dec 2015 18:05:11 +0200 Message-ID: <83h9jj3dfs.fsf@gnu.org> References: <8361025k9u.fsf@gnu.org> <83a8pd3txg.fsf@gnu.org> <834mfl3qvp.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1450195594 21101 80.91.229.3 (15 Dec 2015 16:06:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Dec 2015 16:06:34 +0000 (UTC) Cc: eric.hanchrow@gmail.com, 22154@debbugs.gnu.org To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 15 17:06:23 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a8s7J-0007W1-8d for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Dec 2015 17:06:21 +0100 Original-Received: from localhost ([::1]:37731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8s7D-0005sW-G0 for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Dec 2015 11:06:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8s76-0005n8-Db for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2015 11:06:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8s70-0007j9-FM for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2015 11:06:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8s70-0007j1-CM for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2015 11:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1a8s70-0006Y8-4t for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2015 11:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Dec 2015 16:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22154 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22154-submit@debbugs.gnu.org id=B22154.145019551525116 (code B ref 22154); Tue, 15 Dec 2015 16:06:02 +0000 Original-Received: (at 22154) by debbugs.gnu.org; 15 Dec 2015 16:05:15 +0000 Original-Received: from localhost ([127.0.0.1]:52825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8s6B-0006Wy-Ip for submit@debbugs.gnu.org; Tue, 15 Dec 2015 11:05:15 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53447) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8s66-0006WO-Ga for 22154@debbugs.gnu.org; Tue, 15 Dec 2015 11:05:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8s5x-0007SQ-46 for 22154@debbugs.gnu.org; Tue, 15 Dec 2015 11:05:01 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8s5x-0007SM-0y; Tue, 15 Dec 2015 11:04:57 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2883 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1a8s5w-00019w-7H; Tue, 15 Dec 2015 11:04:56 -0500 In-reply-to: (message from Dan Nicolaescu on Tue, 15 Dec 2015 00:46:08 -0500) 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:110023 Archived-At: > From: Dan Nicolaescu > Cc: eric.hanchrow@gmail.com, 22154@debbugs.gnu.org > Date: Tue, 15 Dec 2015 00:46:08 -0500 > > >> What exactly is the problem that your patch fixes? > > > > The fact that the default escape sequences for turning colors on or > > off are stored in global variables that get overwritten each time > > another tty is initialized. > > Can you describe a behavior that is incorrect? It was described in the original report of this bug, see http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-12/msg00420.html http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22154#5 > > And I don't understand how could what you describe work when there's > > only one global value of tty-defined-color-alist. Can you explain how > > that worked, given that each terminal's initialization overwrites that > > list? > > Sorry, I don't remember the details, but it did work > In fact I just tried on emacs 24.5 with 3 terminals: xterm > with TERM=vt100, rxvt -fg black -bg white and rxvt -fg white -bg black. > emacsclient -t connected to the same emacs daemon That's not the same use case. The one you should indeed works, because the foreground and background colors are recorded separately for each frame. IOW, this is not related to the issue at hand. The issue at hand is how a TTY frame interprets a color specified either by its name, like "LavenderBlush", or by an RGB value, like #FF12EC. As you certainly remember, we look for the best match in the list returned by tty-color-alist, then use the numeric value of that best match to send the corresponding escape sequence to the TTY device. The problem I alluded to has 2 facets: . the list which we need to find the best matching supported color is overwritten every time we initialize another tty, because that list is maintained as a single global variable . the escape sequences and the number of supported colors are also overwritten, because they are restored from a single static variable My patch solves the 2nd part, but the first also needs to be solved. > Unfortunately I don't have a more recent emacs version on this machine... I don't think you need a newer Emacs, the same problem should exist in 24.5. Just do what the OP did with an Emacs running under a 256-color xterm and a client frame started under an 8-color xterm. If this works in Emacs 24.5, I'm probably missing something very important. Eric, can you test your scenario with Emacs 24.5, please?