emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xfaces.c


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/xfaces.c
Date: Mon, 07 Jun 2004 03:03:29 -0400

Index: emacs/src/xfaces.c
diff -c emacs/src/xfaces.c:1.297 emacs/src/xfaces.c:1.298
*** emacs/src/xfaces.c:1.297    Sun Jun  6 09:49:12 2004
--- emacs/src/xfaces.c  Mon Jun  7 07:02:20 2004
***************
*** 460,465 ****
--- 460,466 ----
  
  struct font_name;
  struct table_entry;
+ struct named_merge_point;
  
  static void map_tty_color P_ ((struct frame *, struct face *,
                               enum lface_attribute_index, int *));
***************
*** 518,528 ****
  static int face_numeric_swidth P_ ((Lisp_Object));
  static int face_fontset P_ ((Lisp_Object *));
  static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, int, 
int*));
! static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, 
Lisp_Object*, Lisp_Object));
! static void merge_face_inheritance P_ ((struct frame *f, Lisp_Object,
!                                       Lisp_Object *, Lisp_Object));
! static void merge_face_vector_with_property P_ ((struct frame *, Lisp_Object 
*,
!                                                Lisp_Object));
  static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object,
                                         Lisp_Object, int, int));
  static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, 
int));
--- 519,528 ----
  static int face_numeric_swidth P_ ((Lisp_Object));
  static int face_fontset P_ ((Lisp_Object *));
  static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, int, 
int*));
! static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, 
Lisp_Object*,
!                                   struct named_merge_point *));
! static int merge_face_ref P_ ((struct frame *, Lisp_Object, Lisp_Object *,
!                              int, struct named_merge_point *));
  static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object,
                                         Lisp_Object, int, int));
  static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, 
int));
***************
*** 3151,3156 ****
--- 3151,3199 ----
  #endif /* GLYPH_DEBUG == 0 */
  
  
+ 
+ /* Face-merge cycle checking.  */
+ 
+ /* A `named merge point' is simply a point during face-merging where we
+    look up a face by name.  We keep a stack of which named lookups we're
+    currently processing so that we can easily detect cycles, using a
+    linked- list of struct named_merge_point structures, typically
+    allocated on the stack frame of the named lookup functions which are
+    active (so no consing is required).  */
+ struct named_merge_point
+ {
+   Lisp_Object face_name;
+   struct named_merge_point *prev;
+ };
+ 
+ 
+ /* If a face merging cycle is detected for FACE_NAME, return 0,
+    otherwise add NEW_NAMED_MERGE_POINT, which is initialized using
+    FACE_NAME, as the head of the linked list
+    pointed to by NAMED_MERGE_POINTS, and return 1.  */
+ 
+ static INLINE int
+ push_named_merge_point (struct named_merge_point *new_named_merge_point,
+                       Lisp_Object face_name,
+                       struct named_merge_point **named_merge_points)
+ {
+   struct named_merge_point *prev;
+ 
+   for (prev = *named_merge_points; prev; prev = prev->prev)
+     if (EQ (face_name, prev->face_name))
+       break;
+ 
+   new_named_merge_point->face_name = face_name;
+   new_named_merge_point->prev = *named_merge_points;
+ 
+   *named_merge_points = new_named_merge_point;
+ 
+   return 1;
+ }
+ 
+ 
+ 
+ 
  /* Resolve face name FACE_NAME.  If FACE_NAME is a string, intern it
     to make it a symvol.  If FACE_NAME is an alias for another face,
     return that face's name.  */
***************
*** 3401,3406 ****
--- 3444,3451 ----
        else if (FLOATP (to))
        /* relative X relative => relative */
        result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to));
+       else if (UNSPECIFIEDP (to))
+       result = from;
      }
    else if (FUNCTIONP (from))
      /* FROM is a function, which use to adjust TO.  */
***************
*** 3432,3445 ****
     completely specified and contain only absolute attributes.  Every
     specified attribute of FROM overrides the corresponding attribute of
     TO; relative attributes in FROM are merged with the absolute value in
!    TO and replace it.  CYCLE_CHECK is used internally to detect loops in
!    face inheritance; it should be Qnil when called from other places.  */
  
  static INLINE void
! merge_face_vectors (f, from, to, cycle_check)
       struct frame *f;
       Lisp_Object *from, *to;
!      Lisp_Object cycle_check;
  {
    int i;
  
--- 3477,3491 ----
     completely specified and contain only absolute attributes.  Every
     specified attribute of FROM overrides the corresponding attribute of
     TO; relative attributes in FROM are merged with the absolute value in
!    TO and replace it.  NAMED_MERGE_POINTS is used internally to detect
!    loops in face inheritance; it should be 0 when called from other
!    places.  */
  
  static INLINE void
! merge_face_vectors (f, from, to, named_merge_points)
       struct frame *f;
       Lisp_Object *from, *to;
!      struct named_merge_point *named_merge_points;
  {
    int i;
  
***************
*** 3450,3456 ****
       other code uses `unspecified' as a generic value for face attributes. */
    if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])
        && !NILP (from[LFACE_INHERIT_INDEX]))
!     merge_face_inheritance (f, from[LFACE_INHERIT_INDEX], to, cycle_check);
  
    /* If TO specifies a :font attribute, and FROM specifies some
       font-related attribute, we need to clear TO's :font attribute
--- 3496,3502 ----
       other code uses `unspecified' as a generic value for face attributes. */
    if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])
        && !NILP (from[LFACE_INHERIT_INDEX]))
!     merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points);
  
    /* If TO specifies a :font attribute, and FROM specifies some
       font-related attribute, we need to clear TO's :font attribute
***************
*** 3469,3475 ****
      if (!UNSPECIFIEDP (from[i]))
        {
        if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
!         to[i] = merge_face_heights (from[i], to[i], to[i], cycle_check);
        else
          to[i] = from[i];
        }
--- 3515,3522 ----
      if (!UNSPECIFIEDP (from[i]))
        {
        if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
!         to[i] = merge_face_heights (from[i], to[i], to[i],
!                                     named_merge_points);
        else
          to[i] = from[i];
        }
***************
*** 3479,3539 ****
    to[LFACE_INHERIT_INDEX] = Qnil;
  }
  
! /* Merge face attributes from the face on frame F whose name is
!    INHERITS, into the vector of face attributes TO; INHERITS may also be
!    a list of face names, in which case they are applied in order.
!    CYCLE_CHECK is used to detect loops in face inheritance.
!    Returns true if any of the inherited attributes are `font-related'.  */
  
! static void
! merge_face_inheritance (f, inherit, to, cycle_check)
       struct frame *f;
!      Lisp_Object inherit;
       Lisp_Object *to;
!      Lisp_Object cycle_check;
  {
!   if (SYMBOLP (inherit) && !EQ (inherit, Qunspecified))
!     /* Inherit from the named face INHERIT.  */
!     {
!       Lisp_Object lface;
! 
!       /* Make sure we're not in an inheritance loop.  */
!       cycle_check = CYCLE_CHECK (cycle_check, inherit, 15);
!       if (NILP (cycle_check))
!       /* Cycle detected, ignore any further inheritance.  */
!       return;
  
!       lface = lface_from_face_name (f, inherit, 0);
!       if (!NILP (lface))
!       merge_face_vectors (f, XVECTOR (lface)->contents, to, cycle_check);
!     }
!   else if (CONSP (inherit))
!     /* Handle a list of inherited faces by calling ourselves recursively
!        on each element.  Note that we only do so for symbol elements, so
!        it's not possible to infinitely recurse.  */
      {
!       while (CONSP (inherit))
!       {
!         if (SYMBOLP (XCAR (inherit)))
!           merge_face_inheritance (f, XCAR (inherit), to, cycle_check);
  
!         /* Check for a circular inheritance list.  */
!         cycle_check = CYCLE_CHECK (cycle_check, inherit, 15);
!         if (NILP (cycle_check))
!           /* Cycle detected.  */
!           break;
  
!         inherit = XCDR (inherit);
!       }
      }
  }
  
  
! /* Given a Lisp face attribute vector TO and a Lisp object PROP that
!    is a face property, determine the resulting face attributes on
!    frame F, and store them in TO.  PROP may be a single face
!    specification or a list of such specifications.  Each face
!    specification can be
  
     1. A symbol or string naming a Lisp face.
  
--- 3526,3570 ----
    to[LFACE_INHERIT_INDEX] = Qnil;
  }
  
! /* Merge the named face FACE_NAME on frame F, into the vector of face
!    attributes TO.  NAMED_MERGE_POINTS is used to detect loops in face
!    inheritance.  Returns true if FACE_NAME is a valid face name and
!    merging succeeded.  */
  
! static int
! merge_named_face (f, face_name, to, named_merge_points)
       struct frame *f;
!      Lisp_Object face_name;
       Lisp_Object *to;
!      struct named_merge_point *named_merge_points;
  {
!   struct named_merge_point named_merge_point;
  
!   if (push_named_merge_point (&named_merge_point,
!                             face_name, &named_merge_points))
      {
!       Lisp_Object from[LFACE_VECTOR_SIZE];
!       int ok = get_lface_attributes (f, face_name, from, 0);
  
!       if (ok)
!       merge_face_vectors (f, from, to, named_merge_points);
  
!       return ok;
      }
+   else
+     return 0;
  }
  
  
! /* Merge face attributes from the lisp `face reference' FACE_REF on
!    frame F into the face attribute vector TO.  If ERR_MSGS is non-zero,
!    problems with FACE_REF cause an error message to be shown.  Return
!    non-zero if no errors occurred (regardless of the value of ERR_MSGS).
!    NAMED_MERGE_POINTS is used to detect loops in face inheritance or
!    list structure; it may be 0 for most callers.
! 
!    FACE_REF may be a single face specification or a list of such
!    specifications.  Each face specification can be:
  
     1. A symbol or string naming a Lisp face.
  
***************
*** 3548,3569 ****
     Face specifications earlier in lists take precedence over later
     specifications.  */
  
! static void
! merge_face_vector_with_property (f, to, prop)
       struct frame *f;
       Lisp_Object *to;
!      Lisp_Object prop;
  {
!   if (CONSP (prop))
      {
!       Lisp_Object first = XCAR (prop);
  
        if (EQ (first, Qforeground_color)
          || EQ (first, Qbackground_color))
        {
          /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR
             . COLOR).  COLOR must be a string.  */
!         Lisp_Object color_name = XCDR (prop);
          Lisp_Object color = first;
  
          if (STRINGP (color_name))
--- 3579,3604 ----
     Face specifications earlier in lists take precedence over later
     specifications.  */
  
! static int
! merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
       struct frame *f;
+      Lisp_Object face_ref;
       Lisp_Object *to;
!      int err_msgs;
!      struct named_merge_point *named_merge_points;
  {
!   int ok = 1;                 /* Succeed without an error? */
! 
!   if (CONSP (face_ref))
      {
!       Lisp_Object first = XCAR (face_ref);
  
        if (EQ (first, Qforeground_color)
          || EQ (first, Qbackground_color))
        {
          /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR
             . COLOR).  COLOR must be a string.  */
!         Lisp_Object color_name = XCDR (face_ref);
          Lisp_Object color = first;
  
          if (STRINGP (color_name))
***************
*** 3574,3596 ****
                to[LFACE_BACKGROUND_INDEX] = color_name;
            }
          else
!           add_to_log ("Invalid face color", color_name, Qnil);
        }
        else if (SYMBOLP (first)
               && *SDATA (SYMBOL_NAME (first)) == ':')
        {
          /* Assume this is the property list form.  */
!         while (CONSP (prop) && CONSP (XCDR (prop)))
            {
!             Lisp_Object keyword = XCAR (prop);
!             Lisp_Object value = XCAR (XCDR (prop));
  
              if (EQ (keyword, QCfamily))
                {
                  if (STRINGP (value))
                    to[LFACE_FAMILY_INDEX] = value;
                  else
!                   add_to_log ("Invalid face font family", value, Qnil);
                }
              else if (EQ (keyword, QCheight))
                {
--- 3609,3636 ----
                to[LFACE_BACKGROUND_INDEX] = color_name;
            }
          else
!           {
!             if (err_msgs)
!               add_to_log ("Invalid face color", color_name, Qnil);
!             ok = 0;
!           }
        }
        else if (SYMBOLP (first)
               && *SDATA (SYMBOL_NAME (first)) == ':')
        {
          /* Assume this is the property list form.  */
!         while (CONSP (face_ref) && CONSP (XCDR (face_ref)))
            {
!             Lisp_Object keyword = XCAR (face_ref);
!             Lisp_Object value = XCAR (XCDR (face_ref));
!             int err = 0;
  
              if (EQ (keyword, QCfamily))
                {
                  if (STRINGP (value))
                    to[LFACE_FAMILY_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCheight))
                {
***************
*** 3598,3607 ****
                    merge_face_heights (value, to[LFACE_HEIGHT_INDEX],
                                        Qnil, Qnil);
  
!                 if (NILP (new_height))
!                   add_to_log ("Invalid face font height", value, Qnil);
!                 else
                    to[LFACE_HEIGHT_INDEX] = new_height;
                }
              else if (EQ (keyword, QCweight))
                {
--- 3638,3647 ----
                    merge_face_heights (value, to[LFACE_HEIGHT_INDEX],
                                        Qnil, Qnil);
  
!                 if (! NILP (new_height))
                    to[LFACE_HEIGHT_INDEX] = new_height;
+                 else
+                   err = 1;
                }
              else if (EQ (keyword, QCweight))
                {
***************
*** 3609,3615 ****
                      && face_numeric_weight (value) >= 0)
                    to[LFACE_WEIGHT_INDEX] = value;
                  else
!                   add_to_log ("Invalid face weight", value, Qnil);
                }
              else if (EQ (keyword, QCslant))
                {
--- 3649,3655 ----
                      && face_numeric_weight (value) >= 0)
                    to[LFACE_WEIGHT_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCslant))
                {
***************
*** 3617,3623 ****
                      && face_numeric_slant (value) >= 0)
                    to[LFACE_SLANT_INDEX] = value;
                  else
!                   add_to_log ("Invalid face slant", value, Qnil);
                }
              else if (EQ (keyword, QCunderline))
                {
--- 3657,3663 ----
                      && face_numeric_slant (value) >= 0)
                    to[LFACE_SLANT_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCunderline))
                {
***************
*** 3626,3632 ****
                      || STRINGP (value))
                    to[LFACE_UNDERLINE_INDEX] = value;
                  else
!                   add_to_log ("Invalid face underline", value, Qnil);
                }
              else if (EQ (keyword, QCoverline))
                {
--- 3666,3672 ----
                      || STRINGP (value))
                    to[LFACE_UNDERLINE_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCoverline))
                {
***************
*** 3635,3641 ****
                      || STRINGP (value))
                    to[LFACE_OVERLINE_INDEX] = value;
                  else
!                   add_to_log ("Invalid face overline", value, Qnil);
                }
              else if (EQ (keyword, QCstrike_through))
                {
--- 3675,3681 ----
                      || STRINGP (value))
                    to[LFACE_OVERLINE_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCstrike_through))
                {
***************
*** 3644,3650 ****
                      || STRINGP (value))
                    to[LFACE_STRIKE_THROUGH_INDEX] = value;
                  else
!                   add_to_log ("Invalid face strike-through", value, Qnil);
                }
              else if (EQ (keyword, QCbox))
                {
--- 3684,3690 ----
                      || STRINGP (value))
                    to[LFACE_STRIKE_THROUGH_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCbox))
                {
***************
*** 3656,3662 ****
                      || NILP (value))
                    to[LFACE_BOX_INDEX] = value;
                  else
!                   add_to_log ("Invalid face box", value, Qnil);
                }
              else if (EQ (keyword, QCinverse_video)
                       || EQ (keyword, QCreverse_video))
--- 3696,3702 ----
                      || NILP (value))
                    to[LFACE_BOX_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCinverse_video)
                       || EQ (keyword, QCreverse_video))
***************
*** 3664,3684 ****
                  if (EQ (value, Qt) || NILP (value))
                    to[LFACE_INVERSE_INDEX] = value;
                  else
!                   add_to_log ("Invalid face inverse-video", value, Qnil);
                }
              else if (EQ (keyword, QCforeground))
                {
                  if (STRINGP (value))
                    to[LFACE_FOREGROUND_INDEX] = value;
                  else
!                   add_to_log ("Invalid face foreground", value, Qnil);
                }
              else if (EQ (keyword, QCbackground))
                {
                  if (STRINGP (value))
                    to[LFACE_BACKGROUND_INDEX] = value;
                  else
!                   add_to_log ("Invalid face background", value, Qnil);
                }
              else if (EQ (keyword, QCstipple))
                {
--- 3704,3724 ----
                  if (EQ (value, Qt) || NILP (value))
                    to[LFACE_INVERSE_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCforeground))
                {
                  if (STRINGP (value))
                    to[LFACE_FOREGROUND_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCbackground))
                {
                  if (STRINGP (value))
                    to[LFACE_BACKGROUND_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCstipple))
                {
***************
*** 3687,3693 ****
                  if (!NILP (pixmap_p))
                    to[LFACE_STIPPLE_INDEX] = value;
                  else
!                   add_to_log ("Invalid face stipple", value, Qnil);
  #endif
                }
              else if (EQ (keyword, QCwidth))
--- 3727,3733 ----
                  if (!NILP (pixmap_p))
                    to[LFACE_STIPPLE_INDEX] = value;
                  else
!                   err = 1;
  #endif
                }
              else if (EQ (keyword, QCwidth))
***************
*** 3696,3747 ****
                      && face_numeric_swidth (value) >= 0)
                    to[LFACE_SWIDTH_INDEX] = value;
                  else
!                   add_to_log ("Invalid face width", value, Qnil);
                }
              else if (EQ (keyword, QCinherit))
                {
!                 if (SYMBOLP (value))
!                   to[LFACE_INHERIT_INDEX] = value;
!                 else
!                   {
!                     Lisp_Object tail;
!                     for (tail = value; CONSP (tail); tail = XCDR (tail))
!                       if (!SYMBOLP (XCAR (tail)))
!                         break;
!                     if (NILP (tail))
!                       to[LFACE_INHERIT_INDEX] = value;
!                     else
!                       add_to_log ("Invalid face inherit", value, Qnil);
!                   }
                }
              else
!               add_to_log ("Invalid attribute %s in face property",
!                           keyword, Qnil);
  
!             prop = XCDR (XCDR (prop));
            }
        }
        else
        {
!         /* This is a list of face specs.  Specifications at the
!            beginning of the list take precedence over later
!            specifications, so we have to merge starting with the
!            last specification.  */
!         Lisp_Object next = XCDR (prop);
!         if (!NILP (next))
!           merge_face_vector_with_property (f, to, next);
!         merge_face_vector_with_property (f, to, first);
        }
      }
    else
      {
!       /* PROP ought to be a face name.  */
!       Lisp_Object lface = lface_from_face_name (f, prop, 0);
!       if (NILP (lface))
!       add_to_log ("Invalid face text property value: %s", prop, Qnil);
!       else
!       merge_face_vectors (f, XVECTOR (lface)->contents, to, Qnil);
      }
  }
  
  
--- 3736,3786 ----
                      && face_numeric_swidth (value) >= 0)
                    to[LFACE_SWIDTH_INDEX] = value;
                  else
!                   err = 1;
                }
              else if (EQ (keyword, QCinherit))
                {
!                 /* This is not really very useful; it's just like a
!                    normal face reference.  */
!                 if (! merge_face_ref (f, value, to,
!                                       err_msgs, named_merge_points))
!                   err = 1;
                }
              else
!               err = 1;
  
!             if (err)
!               {
!                 add_to_log ("Invalid face attribute %S %S", keyword, value);
!                 ok = 0;
!               }
! 
!             face_ref = XCDR (XCDR (face_ref));
            }
        }
        else
        {
!         /* This is a list of face refs.  Those at the beginning of the
!            list take precedence over what follows, so we have to merge
!            from the end backwards.  */
!         Lisp_Object next = XCDR (face_ref);
! 
!         if (! NILP (next))
!           ok = merge_face_ref (f, next, to, err_msgs, named_merge_points);
! 
!         if (! merge_face_ref (f, first, to, err_msgs, named_merge_points))
!           ok = 0;
        }
      }
    else
      {
!       /* FACE_REF ought to be a face name.  */
!       ok = merge_named_face (f, face_ref, to, named_merge_points);
!       if (!ok && err_msgs)
!       add_to_log ("Invalid face reference: %s", face_ref, Qnil);
      }
+ 
+   return ok;
  }
  
  
***************
*** 5569,5575 ****
  
    get_lface_attributes (f, symbol, symbol_attrs, 1);
    bcopy (default_face->lface, attrs, sizeof attrs);
!   merge_face_vectors (f, symbol_attrs, attrs, Qnil);
    return lookup_face (f, attrs, c, NULL);
  }
  
--- 5608,5615 ----
  
    get_lface_attributes (f, symbol, symbol_attrs, 1);
    bcopy (default_face->lface, attrs, sizeof attrs);
!   merge_face_vectors (f, symbol_attrs, attrs, 0);
! 
    return lookup_face (f, attrs, c, NULL);
  }
  
***************
*** 5708,5714 ****
  
    get_lface_attributes (f, symbol, symbol_attrs, 1);
    bcopy (default_face->lface, attrs, sizeof attrs);
!   merge_face_vectors (f, symbol_attrs, attrs, Qnil);
    return lookup_face (f, attrs, c, default_face);
  }
  
--- 5748,5754 ----
  
    get_lface_attributes (f, symbol, symbol_attrs, 1);
    bcopy (default_face->lface, attrs, sizeof attrs);
!   merge_face_vectors (f, symbol_attrs, attrs, 0);
    return lookup_face (f, attrs, c, default_face);
  }
  
***************
*** 5721,5729 ****
    Lisp_Object lface;
    lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
                        Qunspecified);
!   merge_face_vector_with_property (XFRAME (selected_frame),
!                                  XVECTOR (lface)->contents,
!                                  plist);
    return lface;
  }
  
--- 5761,5768 ----
    Lisp_Object lface;
    lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
                        Qunspecified);
!   merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents,
!                 1, 0);
    return lface;
  }
  
***************
*** 5802,5808 ****
  
        bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
  
!       merge_face_vectors (f, attrs, merged_attrs, Qnil);
  
        face = FACE_FROM_ID (f, lookup_face (f, merged_attrs, 0, 0));
  
--- 5841,5847 ----
  
        bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
  
!       merge_face_vectors (f, attrs, merged_attrs, 0);
  
        face = FACE_FROM_ID (f, lookup_face (f, merged_attrs, 0, 0));
  
***************
*** 6058,6064 ****
  
    for (i = 0; i < LFACE_VECTOR_SIZE; i++)
      attrs[i] = Qunspecified;
!   merge_face_vector_with_property (f, attrs, attributes);
  
    def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
    if (def_face == NULL)
--- 6097,6103 ----
  
    for (i = 0; i < LFACE_VECTOR_SIZE; i++)
      attrs[i] = Qunspecified;
!   merge_face_ref (f, attributes, attrs, 1, 0);
  
    def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
    if (def_face == NULL)
***************
*** 6934,6940 ****
  
    /* Merge SYMBOL's face with the default face.  */
    get_lface_attributes (f, symbol, symbol_attrs, 1);
!   merge_face_vectors (f, symbol_attrs, attrs, Qnil);
  
    /* Realize the face.  */
    new_face = realize_face (c, attrs, 0, NULL, id);
--- 6973,6979 ----
  
    /* Merge SYMBOL's face with the default face.  */
    get_lface_attributes (f, symbol, symbol_attrs, 1);
!   merge_face_vectors (f, symbol_attrs, attrs, 0);
  
    /* Realize the face.  */
    new_face = realize_face (c, attrs, 0, NULL, id);
***************
*** 7399,7405 ****
        Lisp_Object attrs[LFACE_VECTOR_SIZE];
        struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
        bcopy (default_face->lface, attrs, sizeof attrs);
!       merge_face_vector_with_property (f, attrs, prop);
        face_id = lookup_face (f, attrs, ch, NULL);
      }
  
--- 7438,7444 ----
        Lisp_Object attrs[LFACE_VECTOR_SIZE];
        struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
        bcopy (default_face->lface, attrs, sizeof attrs);
!       merge_face_ref (f, prop, attrs, 1, 0);
        face_id = lookup_face (f, attrs, ch, NULL);
      }
  
***************
*** 7485,7491 ****
  
    /* Merge in attributes specified via text properties.  */
    if (!NILP (prop))
!     merge_face_vector_with_property (f, attrs, prop);
  
    /* Now merge the overlay data.  */
    noverlays = sort_overlays (overlay_vec, noverlays, w);
--- 7524,7530 ----
  
    /* Merge in attributes specified via text properties.  */
    if (!NILP (prop))
!     merge_face_ref (f, prop, attrs, 1, 0);
  
    /* Now merge the overlay data.  */
    noverlays = sort_overlays (overlay_vec, noverlays, w);
***************
*** 7496,7502 ****
  
        prop = Foverlay_get (overlay_vec[i], propname);
        if (!NILP (prop))
!       merge_face_vector_with_property (f, attrs, prop);
  
        oend = OVERLAY_END (overlay_vec[i]);
        oendpos = OVERLAY_POSITION (oend);
--- 7535,7541 ----
  
        prop = Foverlay_get (overlay_vec[i], propname);
        if (!NILP (prop))
!       merge_face_ref (f, prop, attrs, 1, 0);
  
        oend = OVERLAY_END (overlay_vec[i]);
        oendpos = OVERLAY_POSITION (oend);
***************
*** 7507,7514 ****
    /* If in the region, merge in the region face.  */
    if (pos >= region_beg && pos < region_end)
      {
!       Lisp_Object region_face = lface_from_face_name (f, Qregion, 0);
!       merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil);
  
        if (region_end < endpos)
        endpos = region_end;
--- 7546,7552 ----
    /* If in the region, merge in the region face.  */
    if (pos >= region_beg && pos < region_end)
      {
!       merge_named_face (f, Qregion, attrs, 0);
  
        if (region_end < endpos)
        endpos = region_end;
***************
*** 7604,7619 ****
  
    /* Merge in attributes specified via text properties.  */
    if (!NILP (prop))
!     merge_face_vector_with_property (f, attrs, prop);
  
    /* If in the region, merge in the region face.  */
    if (bufpos
        && bufpos >= region_beg
        && bufpos < region_end)
!     {
!       Lisp_Object region_face = lface_from_face_name (f, Qregion, 0);
!       merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil);
!     }
  
    /* Look up a realized face with the given face attributes,
       or realize a new one for ASCII characters.  */
--- 7642,7654 ----
  
    /* Merge in attributes specified via text properties.  */
    if (!NILP (prop))
!     merge_face_ref (f, prop, attrs, 1, 0);
  
    /* If in the region, merge in the region face.  */
    if (bufpos
        && bufpos >= region_beg
        && bufpos < region_end)
!     merge_named_face (f, Qregion, attrs, 0);
  
    /* Look up a realized face with the given face attributes,
       or realize a new one for ASCII characters.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]