emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs -q -nw --color=never


From: Richard Stallman
Subject: Re: emacs -q -nw --color=never
Date: Wed, 24 Sep 2003 08:47:04 -0400

    I did debug this a bit.  AFAICS, this happens because this code in
    line 2130 of term.c:

      NATNUMP (color_mode)

    evaluates to zero (i.e. false) when the value of color_mode is -1.

I see you made some changes that would fix this bug, but there
are other bugs too.

What do you think of this version?

void
set_tty_color_mode (f, val)
     struct frame *f;
     Lisp_Object val;
{
  Lisp_Object color_mode_spec, current_mode_spec;
  Lisp_Object color_mode, current_mode;
  int mode, old_mode;
  extern Lisp_Object Qtty_color_mode;
  Lisp_Object tty_color_mode_alist;

  tty_color_mode_alist = Fintern_soft (build_string ("tty-color-mode-alist"),
                                       Qnil);

  if (INTEGERP (val))
    color_mode = val;
  else
    {
      if (NILP (tty_color_mode_alist))
        color_mode_spec = Qnil;
      else
        color_mode_spec = Fassq (val, XSYMBOL (tty_color_mode_alist)->value);

      if (CONSP (color_mode_spec))
        color_mode = XCDR (color_mode_spec);
      else
        color_mode = Qnil;
    }

  current_mode_spec = assq_no_quit (Qtty_color_mode, f->param_alist);

  if (CONSP (current_mode_spec))
    current_mode = XCDR (current_mode_spec);
  else
    current_mode = Qnil;

  if (INTEGERP (color_mode))
    mode = XINT (color_mode);
  else
    mode = 0;   /* meaning default */
  /* Canonicalize negative numbers to -1.  */
  if (mode < 0)
    mode = -1;

  if (INTEGERP (current_mode))
    old_mode = XINT (current_mode);
  else
    old_mode = 0;

  if (mode != old_mode)
    {
      tty_setup_colors (mode);
      /*  This recomputes all the faces given the new color
          definitions.  */
      call0 (intern ("tty-set-up-initial-frame-faces"));
      redraw_frame (f);
    }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]