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: Mon, 14 Dec 2015 17:56:43 +0200 Message-ID: <83a8pd3txg.fsf@gnu.org> References: <8361025k9u.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1450108648 9991 80.91.229.3 (14 Dec 2015 15:57:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Dec 2015 15:57:28 +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 Mon Dec 14 16:57:15 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 1a8VUt-000871-1C for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Dec 2015 16:57:11 +0100 Original-Received: from localhost ([::1]:60678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VUs-0001XS-Fg for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Dec 2015 10:57:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VUo-0001VP-0N for bug-gnu-emacs@gnu.org; Mon, 14 Dec 2015 10:57:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8VUk-0003k8-Qs for bug-gnu-emacs@gnu.org; Mon, 14 Dec 2015 10:57:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44127) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VUk-0003k0-O4 for bug-gnu-emacs@gnu.org; Mon, 14 Dec 2015 10:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1a8VUk-0001mz-GX for bug-gnu-emacs@gnu.org; Mon, 14 Dec 2015 10:57: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: Mon, 14 Dec 2015 15:57: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.14501086036854 (code B ref 22154); Mon, 14 Dec 2015 15:57:02 +0000 Original-Received: (at 22154) by debbugs.gnu.org; 14 Dec 2015 15:56:43 +0000 Original-Received: from localhost ([127.0.0.1]:51729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8VUQ-0001mR-GW for submit@debbugs.gnu.org; Mon, 14 Dec 2015 10:56:42 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52503) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8VUO-0001mF-Qv for 22154@debbugs.gnu.org; Mon, 14 Dec 2015 10:56:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8VUG-0003eh-Nc for 22154@debbugs.gnu.org; Mon, 14 Dec 2015 10:56:35 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VUG-0003eb-KA; Mon, 14 Dec 2015 10:56:32 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4923 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1a8VUF-0008Mh-IT; Mon, 14 Dec 2015 10:56:31 -0500 In-reply-to: (message from Dan Nicolaescu on Mon, 14 Dec 2015 01:21:26 -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:109973 Archived-At: > From: Dan Nicolaescu > Cc: Eric Hanchrow , 22154@debbugs.gnu.org > Gcc: nnml+archive:sent-mail-2015 > Date: Mon, 14 Dec 2015 01:21:26 -0500 > > Using different number of colors on different ttys should work. > I just tried it briefly, and it works fine on my Fedora machine with > 24.5. > I don't have a very recent version compiled. > > You can try it with > $ emacs -Q -f server-start& > Then from an xterm: emacsclient -t > And then from a different one: env TERM=vt100 emacsclient -t > > The frame in the first xterm should display some colors, the one in the > second should be b&w... This simple use case indeed (almost) works. (To have it work better, you need the patch I posted here.) But in general, the current implementation doesn't support this, AFAICT, for 2 reasons: . The default escape sequences sent to the terminal for turning colors on and off are stored in a single global set of values (the default_* variables in term.c). So every time set_tty_color_mode is called, and the frame's parameters don't include the tty-color-mode parameter (which is what happens usually) the escape sequences get overwritten by the ones of the last tty we initialized. It so happens that the display calls set_tty_color_mode each time you switch to a different frame on a TTY, so the risk of this happening is quite high, especially if some frames do have the tty-color-mode parameter. The patch I sent solves this part. . The value of tty-defined-color-alist is global, so every call to a terminal-specific FOO-register-default-colors will modify that global value with its own colors, and those of the previous tty will be lost. For example, the initialization of xterm-256 fills tty-defined-color-alist with colors whose names are "color-0", "color-1", etc., but if you later initialize an 8-color xterm, these get nuked, and only the 8 or 16 standard colors remain there. The second part problem could only be fixed by making tty-defined-color-alist a terminal-local variable. Am I missing something?