all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eric Hanchrow <eric.hanchrow@gmail.com>
Cc: 22154@debbugs.gnu.org
Subject: bug#22154: 25.0.50; emacsclient -c "breaks" 256-color display in server
Date: Sun, 13 Dec 2015 19:30:05 +0200	[thread overview]
Message-ID: <8361025k9u.fsf@gnu.org> (raw)
In-Reply-To: <CAHZoxq_z=XcuBZ2XN3GCuj54ctiAeWRPQ6vF_6VX=Ukgm9SQ-A@mail.gmail.com> (message from Eric Hanchrow on Sat, 12 Dec 2015 21:49:10 +0000)

> From: Eric Hanchrow <eric.hanchrow@gmail.com>
> 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. */





  reply	other threads:[~2015-12-13 17:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12 21:49 bug#22154: 25.0.50; emacsclient -c "breaks" 256-color display in server Eric Hanchrow
2015-12-13 17:30 ` Eli Zaretskii [this message]
2015-12-13 18:05   ` Eric Hanchrow
2015-12-13 18:17     ` Eli Zaretskii
2015-12-13 18:37       ` Eli Zaretskii
2015-12-13 18:47         ` Eric Hanchrow
2015-12-13 19:51           ` Eli Zaretskii
2015-12-13 20:26             ` Eric Hanchrow
2015-12-13 20:49               ` Eli Zaretskii
2015-12-14  6:21   ` Dan Nicolaescu
2015-12-14 15:56     ` Eli Zaretskii
2015-12-14 16:39       ` Dan Nicolaescu
2015-12-14 17:02         ` Eli Zaretskii
2015-12-15  5:46           ` Dan Nicolaescu
2015-12-15 16:05             ` Eli Zaretskii
2015-12-15 16:37               ` Eric Hanchrow
2015-12-15 16:40                 ` Eli Zaretskii
2015-12-18  4:59               ` Dan Nicolaescu
2020-09-05 14:50           ` Lars Ingebrigtsen
2020-09-05 15:31             ` Eli Zaretskii
2015-12-14  6:35   ` Dan Nicolaescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8361025k9u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=22154@debbugs.gnu.org \
    --cc=eric.hanchrow@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.