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: Sun, 13 Dec 2015 19:30:05 +0200 Message-ID: <8361025k9u.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1450027883 4163 80.91.229.3 (13 Dec 2015 17:31:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Dec 2015 17:31:23 +0000 (UTC) Cc: 22154@debbugs.gnu.org To: Eric Hanchrow Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 13 18:31:12 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 1a8AUH-0006uT-Fx for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Dec 2015 18:31:09 +0100 Original-Received: from localhost ([::1]:56021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8AUG-0005Gz-T4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Dec 2015 12:31:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8AUD-0005Gh-E9 for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2015 12:31:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8AUA-0003Yv-7J for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2015 12:31:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8AUA-0003Yr-4L for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2015 12:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1a8AUA-0007md-0P for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2015 12:31: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: Sun, 13 Dec 2015 17:31:01 +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.145002780629852 (code B ref 22154); Sun, 13 Dec 2015 17:31:01 +0000 Original-Received: (at 22154) by debbugs.gnu.org; 13 Dec 2015 17:30:06 +0000 Original-Received: from localhost ([127.0.0.1]:50353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8ATF-0007lQ-Uc for submit@debbugs.gnu.org; Sun, 13 Dec 2015 12:30:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59560) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8ATE-0007jk-8Z for 22154@debbugs.gnu.org; Sun, 13 Dec 2015 12:30:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8AT6-0003Mh-3a for 22154@debbugs.gnu.org; Sun, 13 Dec 2015 12:29:59 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8AT5-0003Md-WB; Sun, 13 Dec 2015 12:29:56 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3133 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1a8AT5-0003zY-7X; Sun, 13 Dec 2015 12:29:55 -0500 In-reply-to: (message from Eric Hanchrow on Sat, 12 Dec 2015 21:49:10 +0000) 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:109933 Archived-At: > From: Eric Hanchrow > Date: Sat, 12 Dec 2015 21:49:10 +0000 > > I have TERM set to 'xterm-256color'. > > I started emacs with `/mnt/emacs-25/src/emacs -Q` > > I confirmed that 256 colors "worked" by doing M-x list-colors-display > RET, and noting that there were about 256 lines of output, with plenty > of different colors. > > I typed M-x server-start RET. > > In another terminal on the same machine, I typed `TERM=xterm > /mnt/emacs-25/lib-src/emacsclient -c`. That displayed a *scratch* > buffer, as I'd expected. Out of curiosity: why would you want to downgrade the number of colors in the client frames wrt the number supported by the server? > In that new frame, I typed `M-x list-colors-display RET`. I noticed > that now there were only eight lines of output. > > I did C-x 5 0 to delete the new frame, then back in the original frame > again typed `M-x list-colors-display RET`, and noted that there were > still only eight lines of output. This was never supported, we always assumed that the number of colors on all tty frames is the same. Does the patch below fix the problem? diff --git a/src/term.c b/src/term.c index 6ab611d..b7d9d5c 100644 --- a/src/term.c +++ b/src/term.c @@ -2041,16 +2041,6 @@ TERMINAL does not refer to a text terminal. */) #ifndef DOS_NT -/* Declare here rather than in the function, as in the rest of Emacs, - to work around an HPUX compiler bug (?). See - http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00410.html */ -static int default_max_colors; -static int default_max_pairs; -static int default_no_color_video; -static char *default_orig_pair; -static char *default_set_foreground; -static char *default_set_background; - /* Save or restore the default color-related capabilities of this terminal. */ static void @@ -2059,21 +2049,21 @@ tty_default_color_capabilities (struct tty_display_info *tty, bool save) if (save) { - dupstring (&default_orig_pair, tty->TS_orig_pair); - dupstring (&default_set_foreground, tty->TS_set_foreground); - dupstring (&default_set_background, tty->TS_set_background); - default_max_colors = tty->TN_max_colors; - default_max_pairs = tty->TN_max_pairs; - default_no_color_video = tty->TN_no_color_video; + dupstring (&tty->default_orig_pair, tty->TS_orig_pair); + dupstring (&tty->default_set_foreground, tty->TS_set_foreground); + dupstring (&tty->default_set_background, tty->TS_set_background); + tty->default_max_colors = tty->TN_max_colors; + tty->default_max_pairs = tty->TN_max_pairs; + tty->default_no_color_video = tty->TN_no_color_video; } else { - tty->TS_orig_pair = default_orig_pair; - tty->TS_set_foreground = default_set_foreground; - tty->TS_set_background = default_set_background; - tty->TN_max_colors = default_max_colors; - tty->TN_max_pairs = default_max_pairs; - tty->TN_no_color_video = default_no_color_video; + tty->TS_orig_pair = tty->default_orig_pair; + tty->TS_set_foreground = tty->default_set_foreground; + tty->TS_set_background = tty->default_set_background; + tty->TN_max_colors = tty->default_max_colors; + tty->TN_max_pairs = tty->default_max_pairs; + tty->TN_no_color_video = tty->default_no_color_video; } } @@ -4131,6 +4121,7 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ } tty_default_color_capabilities (tty, 1); + tty->previous_color_mode = -1; MagicWrap (tty) = tgetflag ("xn"); /* Since we make MagicWrap terminals look like AutoWrap, we need to have @@ -4496,12 +4487,6 @@ bigger, or it may make it blink, or it may do nothing at all. */); defsubr (&Sgpm_mouse_stop); #endif /* HAVE_GPM */ -#ifndef DOS_NT - default_orig_pair = NULL; - default_set_foreground = NULL; - default_set_background = NULL; -#endif /* !DOS_NT */ - encode_terminal_src = NULL; encode_terminal_dst = NULL; diff --git a/src/termchar.h b/src/termchar.h index 06c0427..b07b78f 100644 --- a/src/termchar.h +++ b/src/termchar.h @@ -161,6 +161,14 @@ struct tty_display_info const char *TS_set_foreground; const char *TS_set_background; + /* Default values recorded when the tty was initialized. */ + char *default_orig_pair; + char *default_set_foreground; + char *default_set_background; + int default_max_colors; + int default_max_pairs; + int default_no_color_video; + int TF_hazeltine; /* termcap hz flag. */ int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */ int TF_standout_motion; /* termcap mi flag: can move while in standout mode. */