changeset 96529:7ac98f33f18c

(Finternal_merge_in_global_face): Don't realize default face if it didn't already exist.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 05 Jul 2008 21:16:05 +0000
parents 7619ac110c63
children 27e1134a894c
files src/xfaces.c
diffstat 1 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Sat Jul 05 21:15:39 2008 +0000
+++ b/src/xfaces.c	Sat Jul 05 21:16:05 2008 +0000
@@ -3971,22 +3971,26 @@
       struct face *newface, *oldface = FACE_FROM_ID (f, DEFAULT_FACE_ID);
       Lisp_Object attrs[LFACE_VECTOR_SIZE];
 
-      bcopy (oldface->lface, attrs, sizeof attrs);
-      merge_face_vectors (f, lvec, attrs, 0);
-      newface = realize_face (c, attrs, DEFAULT_FACE_ID);
-
-      if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
-	   || ! UNSPECIFIEDP (gvec[LFACE_FOUNDRY_INDEX])
-	   || ! UNSPECIFIEDP (gvec[LFACE_HEIGHT_INDEX])
-	   || ! UNSPECIFIEDP (gvec[LFACE_WEIGHT_INDEX])
-	   || ! UNSPECIFIEDP (gvec[LFACE_SLANT_INDEX])
-	   || ! UNSPECIFIEDP (gvec[LFACE_SWIDTH_INDEX])
-	   || ! UNSPECIFIEDP (gvec[LFACE_FONT_INDEX]))
-	  && newface->font)
+      /* This can be NULL (e.g., in batch mode).  */
+      if (oldface)
 	{
-	  Lisp_Object name = newface->font->props[FONT_NAME_INDEX];
-	  Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, name),
-						  Qnil));
+	  bcopy (oldface->lface, attrs, sizeof attrs);
+	  merge_face_vectors (f, lvec, attrs, 0);
+	  newface = realize_face (c, attrs, DEFAULT_FACE_ID);
+
+	  if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
+	       || ! UNSPECIFIEDP (gvec[LFACE_FOUNDRY_INDEX])
+	       || ! UNSPECIFIEDP (gvec[LFACE_HEIGHT_INDEX])
+	       || ! UNSPECIFIEDP (gvec[LFACE_WEIGHT_INDEX])
+	       || ! UNSPECIFIEDP (gvec[LFACE_SLANT_INDEX])
+	       || ! UNSPECIFIEDP (gvec[LFACE_SWIDTH_INDEX])
+	       || ! UNSPECIFIEDP (gvec[LFACE_FONT_INDEX]))
+	      && newface->font)
+	    {
+	      Lisp_Object name = newface->font->props[FONT_NAME_INDEX];
+	      Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, name),
+						      Qnil));
+	    }
 	}
     }