changeset 25301:2042c4a224ad

(add_to_log): Renamed from display_message. Don't display messages in echo area.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 17 Aug 1999 00:38:21 +0000
parents 096b78b6cc2e
children 0f10c1eaf8fb
files src/xfaces.c
diffstat 1 files changed, 34 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Tue Aug 17 00:38:14 1999 +0000
+++ b/src/xfaces.c	Tue Aug 17 00:38:21 1999 +0000
@@ -396,7 +396,7 @@
 static char *xstrdup P_ ((char *));
 static unsigned char *xstrlwr P_ ((unsigned char *));
 static void signal_error P_ ((char *, Lisp_Object));
-static void display_message P_ ((struct frame *, char *, Lisp_Object, Lisp_Object));
+static void add_to_log P_ ((struct frame *, char *, Lisp_Object, Lisp_Object));
 static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int));
 static void load_face_font_or_fontset P_ ((struct frame *, struct face *, char *, int));
 static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *));
@@ -590,13 +590,15 @@
    otherwise also end in an infinite recursion.  */
 
 static void
-display_message (f, format, arg1, arg2)
+add_to_log (f, format, arg1, arg2)
      struct frame *f;
      char *format;
      Lisp_Object arg1, arg2;
 {
   Lisp_Object args[3];
   Lisp_Object nargs;
+  Lisp_Object msg;
+  char *buffer;
   extern int waiting_for_input;
 
   /* Function note_mouse_highlight calls face_at_buffer_position which
@@ -610,15 +612,12 @@
   args[0] = build_string (format);
   args[1] = arg1;
   args[2] = arg2;
-  
-  if (f->face_cache->used >= BASIC_FACE_ID_SENTINEL)
-    Fmessage (nargs, args);
-  else
-    {
-      Lisp_Object msg = Fformat (nargs, args);
-      char *buffer = LSTRDUPA (msg);
-      message_dolog (buffer, strlen (buffer), 1, 0);
-    }
+  msg = Fformat (nargs, args);
+
+  /* Log the error, but don't display it in the echo area.  This
+     proves to be annoying in many cases.  */
+  buffer = LSTRDUPA (msg);
+  message_dolog (buffer, strlen (buffer), 1, 0);
 }
 
 
@@ -941,7 +940,7 @@
 
   if (bitmap_id < 0)
     {
-      display_message (f, "Invalid or undefined bitmap %s", name, Qnil);
+      add_to_log (f, "Invalid or undefined bitmap %s", name, Qnil);
       bitmap_id = 0;
 
       if (w_ptr)
@@ -1059,11 +1058,11 @@
 	}
     }
   else if (fontset >= 0)
-    display_message (f, "Unable to load ASCII font of fontset %d",
-		     make_number (fontset), Qnil);
+    add_to_log (f, "Unable to load ASCII font of fontset %d",
+		make_number (fontset), Qnil);
   else if (font_name)
-    display_message (f, "Unable to load font %s",
-		     build_string (font_name), Qnil);
+    add_to_log (f, "Unable to load font %s",
+		build_string (font_name), Qnil);
 }
 
 #endif /* HAVE_X_WINDOWS */
@@ -1184,7 +1183,7 @@
      to the values in an existing cell. */
   if (!defined_color (f, XSTRING (name)->data, &color, 1))
     {
-      display_message (f, "Unable to load color %s", name, Qnil);
+      add_to_log (f, "Unable to load color %s", name, Qnil);
       
       switch (target_index)
 	{
@@ -1405,7 +1404,7 @@
       if (INTEGERP (color))
 	return (unsigned long)XINT (color);
 
-      display_message (f, "Unable to load color %s", name, Qnil);
+      add_to_log (f, "Unable to load color %s", name, Qnil);
       
       switch (target_index)
 	{
@@ -2831,7 +2830,7 @@
 		to[LFACE_BACKGROUND_INDEX] = color_name;
 	    }
 	  else
-	    display_message (f, "Invalid face color", color_name, Qnil);
+	    add_to_log (f, "Invalid face color", color_name, Qnil);
 	}
       else if (SYMBOLP (first)
 	       && *XSYMBOL (first)->name->data == ':')
@@ -2847,16 +2846,14 @@
 		  if (STRINGP (value))
 		    to[LFACE_FAMILY_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face font family",
-				     value, Qnil);
+		    add_to_log (f, "Illegal face font family", value, Qnil);
 		}
 	      else if (EQ (keyword, QCheight))
 		{
 		  if (INTEGERP (value))
 		    to[LFACE_HEIGHT_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face font height",
-				     value, Qnil);
+		    add_to_log (f, "Illegal face font height", value, Qnil);
 		}
 	      else if (EQ (keyword, QCweight))
 		{
@@ -2864,7 +2861,7 @@
 		      && face_numeric_weight (value) >= 0)
 		    to[LFACE_WEIGHT_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face weight", value, Qnil);
+		    add_to_log (f, "Illegal face weight", value, Qnil);
 		}
 	      else if (EQ (keyword, QCslant))
 		{
@@ -2872,7 +2869,7 @@
 		      && face_numeric_slant (value) >= 0)
 		    to[LFACE_SLANT_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face slant", value, Qnil);
+		    add_to_log (f, "Illegal face slant", value, Qnil);
 		}
 	      else if (EQ (keyword, QCunderline))
 		{
@@ -2881,7 +2878,7 @@
 		      || STRINGP (value))
 		    to[LFACE_UNDERLINE_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face underline", value, Qnil);
+		    add_to_log (f, "Illegal face underline", value, Qnil);
 		}
 	      else if (EQ (keyword, QCoverline))
 		{
@@ -2890,7 +2887,7 @@
 		      || STRINGP (value))
 		    to[LFACE_OVERLINE_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face overline", value, Qnil);
+		    add_to_log (f, "Illegal face overline", value, Qnil);
 		}
 	      else if (EQ (keyword, QCstrike_through))
 		{
@@ -2899,8 +2896,7 @@
 		      || STRINGP (value))
 		    to[LFACE_STRIKE_THROUGH_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face strike-through",
-				     value, Qnil);
+		    add_to_log (f, "Illegal face strike-through", value, Qnil);
 		}
 	      else if (EQ (keyword, QCbox))
 		{
@@ -2912,7 +2908,7 @@
 		      || NILP (value))
 		    to[LFACE_BOX_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face box", value, Qnil);
+		    add_to_log (f, "Illegal face box", value, Qnil);
 		}
 	      else if (EQ (keyword, QCinverse_video)
 		       || EQ (keyword, QCreverse_video))
@@ -2920,24 +2916,21 @@
 		  if (EQ (value, Qt) || NILP (value))
 		    to[LFACE_INVERSE_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face inverse-video",
-				     value, Qnil);
+		    add_to_log (f, "Illegal face inverse-video", value, Qnil);
 		}
 	      else if (EQ (keyword, QCforeground))
 		{
 		  if (STRINGP (value))
 		    to[LFACE_FOREGROUND_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face foreground",
-				     value, Qnil);
+		    add_to_log (f, "Illegal face foreground", value, Qnil);
 		}
 	      else if (EQ (keyword, QCbackground))
 		{
 		  if (STRINGP (value))
 		    to[LFACE_BACKGROUND_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face background",
-				     value, Qnil);
+		    add_to_log (f, "Illegal face background", value, Qnil);
 		}
 	      else if (EQ (keyword, QCstipple))
 		{
@@ -2946,7 +2939,7 @@
 		  if (!NILP (pixmap_p))
 		    to[LFACE_STIPPLE_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face stipple", value, Qnil);
+		    add_to_log (f, "Illegal face stipple", value, Qnil);
 #endif
 		}
 	      else if (EQ (keyword, QCwidth))
@@ -2955,11 +2948,11 @@
 		      && face_numeric_swidth (value) >= 0)
 		    to[LFACE_SWIDTH_INDEX] = value;
 		  else
-		    display_message (f, "Illegal face width", value, Qnil);
+		    add_to_log (f, "Illegal face width", value, Qnil);
 		}
 	      else
-		display_message (f, "Invalid attribute %s in face property",
-				 keyword, Qnil);
+		add_to_log (f, "Invalid attribute %s in face property",
+			    keyword, Qnil);
 
 	      prop = XCDR (XCDR (prop));
 	    }
@@ -2981,8 +2974,7 @@
       /* PROP ought to be a face name.  */
       Lisp_Object lface = lface_from_face_name (f, prop, 0);
       if (NILP (lface))
-	display_message (f, "Invalid face text property value: %s",
-			 prop, Qnil);
+	add_to_log (f, "Invalid face text property value: %s", prop, Qnil);
       else
 	merge_face_vectors (XVECTOR (lface)->contents, to);
     }