]> code.delx.au - gnu-emacs/blobdiff - src/xfaces.c
(set_window_buffer): Always preserve current-buffer.
[gnu-emacs] / src / xfaces.c
index 6180b899dbbdb1890d8f95e34ae1ccf65f4a931e..aa3041d6910c9dabe2e7463a999839a151d4cce6 100644 (file)
@@ -234,7 +234,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define x_display_info w32_display_info
 #define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE
 #define check_x check_w32
-#define x_list_fonts w32_list_fonts
 #define GCGraphicsExposures 0
 #endif /* WINDOWSNT */
 
@@ -245,7 +244,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define x_display_info ns_display_info
 #define FRAME_X_FONT_TABLE FRAME_NS_FONT_TABLE
 #define check_x check_ns
-#define x_list_fonts ns_list_fonts
 #define GCGraphicsExposures 0
 #endif /* HAVE_NS */
 
@@ -557,14 +555,6 @@ static void uncache_face P_ ((struct face_cache *, struct face *));
 static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *));
 static void x_free_gc P_ ((struct frame *, GC));
 
-#ifdef WINDOWSNT
-extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
-#endif /* WINDOWSNT */
-
-#ifdef HAVE_NS
-extern Lisp_Object ns_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
-#endif /* HAVE_NS */
-
 #ifdef USE_X_TOOLKIT
 static void x_update_menu_appearance P_ ((struct frame *));
 
@@ -3743,6 +3733,10 @@ x_update_menu_appearance (f)
        }
 
       if (face->font
+         /* On Solaris 5.8, it's been reported that the `menu' face
+            can be unspecified here, during startup.  Why this
+            happens remains unknown.  -- cyd  */
+         && FONTP (LFACE_FONT (lface))
          && (!UNSPECIFIEDP (LFACE_FAMILY (lface))
              || !UNSPECIFIEDP (LFACE_FOUNDRY (lface))
              || !UNSPECIFIEDP (LFACE_SWIDTH (lface))
@@ -4984,7 +4978,9 @@ lookup_derived_face (f, symbol, face_id, signal_p)
   if (!default_face)
     abort ();
 
-  get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0);
+  if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
+    return -1;
+
   bcopy (default_face->lface, attrs, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
   return lookup_face (f, attrs);
@@ -5456,13 +5452,20 @@ be found.  Value is ALIST.  */)
      (alist)
      Lisp_Object alist;
 {
-  Lisp_Object tail, tail2;
+  Lisp_Object entry, tail, tail2;
 
   CHECK_LIST (alist);
   alist = Fcopy_sequence (alist);
   for (tail = alist; CONSP (tail); tail = XCDR (tail))
-    for (tail2 = XCAR (tail); CONSP (tail2); tail2 = XCDR (tail2))
-      XSETCAR (tail2, Fintern (XCAR (tail2), Qnil));
+    {
+      entry = XCAR (tail);
+      CHECK_LIST (entry);
+      entry = Fcopy_sequence (entry);
+      XSETCAR (tail, entry);
+      for (tail2 = entry; CONSP (tail2); tail2 = XCDR (tail2))
+       XSETCAR (tail2, Fintern (XCAR (tail2), Qnil));
+    }
+
   Vface_alternative_font_family_alist = alist;
   free_all_realized_faces (Qnil);
   return alist;
@@ -5479,13 +5482,19 @@ be found.  Value is ALIST.  */)
      (alist)
      Lisp_Object alist;
 {
-  Lisp_Object tail, tail2;
+  Lisp_Object entry, tail, tail2;
 
   CHECK_LIST (alist);
   alist = Fcopy_sequence (alist);
   for (tail = alist; CONSP (tail); tail = XCDR (tail))
-    for (tail2 = XCAR (tail); CONSP (tail2); tail2 = XCDR (tail2))
-      XSETCAR (tail2, Fdowncase (XCAR (tail2)));
+    {
+      entry = XCAR (tail);
+      CHECK_LIST (entry);
+      entry = Fcopy_sequence (entry);
+      XSETCAR (tail, entry);
+      for (tail2 = entry; CONSP (tail2); tail2 = XCDR (tail2))
+       XSETCAR (tail2, Fdowncase (XCAR (tail2)));
+    }
   Vface_alternative_font_registry_alist = alist;
   free_all_realized_faces (Qnil);
   return alist;
@@ -6543,10 +6552,10 @@ merge_faces (f, face_name, face_id, base_face_id)
       if (face_id < 0 || face_id >= lface_id_to_name_size)
        return base_face_id;
       face_name = lface_id_to_name[face_id];
-      face_id = lookup_derived_face (f, face_name, base_face_id, 1);
-      if (face_id >= 0)
-       return face_id;
-      return base_face_id;
+      /* When called during make-frame, lookup_derived_face may fail
+        if the faces are uninitialized.  Don't signal an error.  */
+      face_id = lookup_derived_face (f, face_name, base_face_id, 0);
+      return (face_id >= 0 ? face_id : base_face_id);
     }
 
   /* Begin with attributes from the base face.  */
@@ -6610,7 +6619,11 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string.  */)
            if (name[num] == '\n')
              name[num] = 0;
            cmap = Fcons (Fcons (build_string (name),
-                                make_number ((red << 16) | (green << 8) | blue)),
+#ifdef WINDOWSNT
+                                make_number (RGB (red, green, blue))),
+#else
+                                make_number ((red << 16) | (green << 8) | blue)),
+#endif
                          cmap);
          }
       }