diff src/term.c @ 83512:5d328dadd0f4

Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.) * lisp/vc.el (vc-annotate-color-map): Undo previous change. * src/dispnew.c (Fsend_string_to_terminal): Update call to `get_tty_terminal'. * src/term.c (Fsuspend_tty, Fresume_tty): Update call to `get_tty_terminal'. (get_tty_terminal): Add throw parameter. (Ftty_display_color_p, Ftty_display_color_cells): Don't throw errors on X frames. * src/dispextern.h (get_tty_terminal): Update prototype. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-552
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 20 Apr 2006 16:09:11 +0000
parents c1e013e3dc0e
children 40a5d8a15056
line wrap: on
line diff
--- a/src/term.c	Thu Apr 20 12:37:41 2006 +0000
+++ b/src/term.c	Thu Apr 20 16:09:11 2006 +0000
@@ -1842,7 +1842,7 @@
      (terminal)
      Lisp_Object terminal;
 {
-  struct terminal *t = get_tty_terminal (terminal);
+  struct terminal *t = get_tty_terminal (terminal, 0);
   if (!t)
     return Qnil;
   else
@@ -1855,12 +1855,12 @@
        doc: /* Return the number of colors supported by the tty device TERMINAL.
 
 TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal).  This function always returns nil if TERMINAL
+frame's terminal).  This function always returns 0 if TERMINAL
 is not on a tty device.  */)
      (terminal)
      Lisp_Object terminal;
 {
-  struct terminal *t = get_tty_terminal (terminal);
+  struct terminal *t = get_tty_terminal (terminal, 0);
   if (!t)
     return make_number (0);
   else
@@ -2009,15 +2009,20 @@
 /* Return the tty display object specified by TERMINAL. */
 
 struct terminal *
-get_tty_terminal (Lisp_Object terminal)
+get_tty_terminal (Lisp_Object terminal, int throw)
 {
-  struct terminal *t = get_terminal (terminal, 0);
+  struct terminal *t = get_terminal (terminal, throw);
 
   if (t && t->type == output_initial)
-    t = NULL;
+    return NULL;
 
   if (t && t->type != output_termcap)
-    error ("Device %d is not a termcap terminal device", t->id);
+    {
+      if (throw)
+        error ("Device %d is not a termcap terminal device", t->id);
+      else
+        return NULL;
+    }
 
   return t;
 }
@@ -2128,7 +2133,7 @@
      (tty)
      Lisp_Object tty;
 {
-  struct terminal *t = get_tty_terminal (tty);
+  struct terminal *t = get_tty_terminal (tty, 1);
   FILE *f;
   
   if (!t)
@@ -2185,7 +2190,7 @@
      (tty)
      Lisp_Object tty;
 {
-  struct terminal *t = get_tty_terminal (tty);
+  struct terminal *t = get_tty_terminal (tty, 1);
   int fd;
 
   if (!t)