changeset 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 f714f11da40a
children 966a40e7fb54
files lisp/vc.el src/dispextern.h src/dispnew.c src/term.c
diffstat 4 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Thu Apr 20 12:37:41 2006 +0000
+++ b/lisp/vc.el	Thu Apr 20 16:09:11 2006 +0000
@@ -617,9 +617,7 @@
 
 ;; Annotate customization
 (defcustom vc-annotate-color-map
-  (if (and (not window-system)
-	   (tty-display-color-p)
-	   (<= (display-color-cells) 8))
+  (if (and (tty-display-color-p) (<= (display-color-cells) 8))
       ;; A custom sorted TTY colormap
       (let* ((colors
 	      (sort
--- a/src/dispextern.h	Thu Apr 20 12:37:41 2006 +0000
+++ b/src/dispextern.h	Thu Apr 20 16:09:11 2006 +0000
@@ -2957,7 +2957,7 @@
 extern void produce_special_glyphs P_ ((struct it *, enum display_element_type));
 extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
 extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
-extern struct terminal *get_tty_terminal P_ ((Lisp_Object terminal));
+extern struct terminal *get_tty_terminal P_ ((Lisp_Object, int));
 extern struct terminal *get_named_tty P_ ((char *));
 EXFUN (Ftty_type, 1);
 extern void create_tty_output P_ ((struct frame *));
--- a/src/dispnew.c	Thu Apr 20 12:37:41 2006 +0000
+++ b/src/dispnew.c	Thu Apr 20 16:09:11 2006 +0000
@@ -6318,7 +6318,7 @@
      Lisp_Object string;
      Lisp_Object terminal;
 {
-  struct terminal *t = get_tty_terminal (terminal);
+  struct terminal *t = get_tty_terminal (terminal, 1);
   struct tty_display_info *tty;
 
   /* ??? Perhaps we should do something special for multibyte strings here.  */
--- 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)