emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/extend_face_id 5c4bd42 3/5: Conditional merged fac


From: Jimmy Aguilar Mena
Subject: [Emacs-diffs] scratch/extend_face_id 5c4bd42 3/5: Conditional merged face to extend after eol.
Date: Mon, 9 Sep 2019 10:25:04 -0400 (EDT)

branch: scratch/extend_face_id
commit 5c4bd42a4ae9e327b547b230c014a75da739e72d
Author: Jimmy Aguilar Mena <address@hidden>
Commit: Jimmy Aguilar Mena <address@hidden>

    Conditional merged face to extend after eol.
    
    The face used in extend_face_to_end_of_line is not the same than in
    the text before anymore.
    The display engine uses the :extend parameter in the faces to
    conditionally merge and create a new id if needed.
---
 src/dispextern.h |   4 +-
 src/font.c       |   8 +-
 src/xdisp.c      | 230 +++++++++++++++++++++++++++++--------------------------
 src/xfaces.c     |  72 +++++++++++------
 4 files changed, 174 insertions(+), 140 deletions(-)

diff --git a/src/dispextern.h b/src/dispextern.h
index c11a3a7..de438e0 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3459,8 +3459,8 @@ int lookup_derived_face (struct window *, struct frame *,
 void init_frame_faces (struct frame *);
 void free_frame_faces (struct frame *);
 void recompute_basic_faces (struct frame *);
-int face_at_buffer_position (struct window *, ptrdiff_t, ptrdiff_t *, 
ptrdiff_t,
-                             bool, int);
+int face_at_buffer_position (struct window *, ptrdiff_t, ptrdiff_t *,
+                             ptrdiff_t, bool, int, enum lface_attribute_index);
 int face_for_overlay_string (struct window *, ptrdiff_t, ptrdiff_t *, 
ptrdiff_t,
                              bool, Lisp_Object);
 int face_at_string_position (struct window *, Lisp_Object, ptrdiff_t, 
ptrdiff_t,
diff --git a/src/font.c b/src/font.c
index 935dd64..2b16839 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3781,10 +3781,10 @@ font_at (int c, ptrdiff_t pos, struct face *face, 
struct window *w,
 
       if (STRINGP (string))
        face_id = face_at_string_position (w, string, pos, 0, &endptr,
-                                          DEFAULT_FACE_ID, false);
+                                          DEFAULT_FACE_ID, 0);
       else
        face_id = face_at_buffer_position (w, pos, &endptr,
-                                          pos + 100, false, -1);
+                                          pos + 100, false, -1, 0);
       face = FACE_FROM_ID (f, face_id);
     }
   if (multibyte)
@@ -3828,7 +3828,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t 
*limit,
 
       if (NILP (string))
          face_id = face_at_buffer_position (w, pos, &ignore, *limit,
-                                            false, -1);
+                                            false, -1, 0);
       else
        {
          face_id =
@@ -4614,7 +4614,7 @@ DEFUN ("internal-char-font", Finternal_char_font, 
Sinternal_char_font, 1, 2, 0,
       w = XWINDOW (window);
       f = XFRAME (w->frame);
       face_id = face_at_buffer_position (w, pos, &dummy,
-                                        pos + 100, false, -1);
+                                         pos + 100, false, -1, 0);
     }
   if (! CHAR_VALID_P (c))
     return Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 9e58a1b..9fb4f6b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4105,15 +4105,18 @@ handle_fontified_prop (struct it *it)
                                Faces
  ***********************************************************************/
 
-/* Set up iterator IT from face properties at its current position.
-   Called from handle_stop.  */
-
 static enum prop_handled
-handle_face_prop (struct it *it)
+handle_face_prop_general (struct it *it,
+                          enum lface_attribute_index attr_filter)
 {
-  int new_face_id;
+  int new_face_id, *face_id_ptr;
   ptrdiff_t next_stop;
 
+  if (attr_filter == LFACE_EXTEND_INDEX)
+    face_id_ptr = &(it->extend_face_id);
+  else
+    face_id_ptr = &(it->face_id);
+
   if (!STRINGP (it->string))
     {
       new_face_id
@@ -4122,7 +4125,7 @@ handle_face_prop (struct it *it)
                                   &next_stop,
                                   (IT_CHARPOS (*it)
                                    + TEXT_PROP_DISTANCE_LIMIT),
-                                  false, it->base_face_id);
+                                  false, it->base_face_id, attr_filter);
 
       /* Is this a start of a run of characters with box face?
         Caveat: this can be called for a freshly initialized
@@ -4130,13 +4133,13 @@ handle_face_prop (struct it *it)
         face will not change until limit, i.e. if the new face has a
         box, all characters up to limit will have one.  But, as
         usual, we don't know whether limit is really the end.  */
-      if (new_face_id != it->face_id)
+      if (new_face_id != *face_id_ptr)
        {
          struct face *new_face = FACE_FROM_ID (it->f, new_face_id);
          /* If it->face_id is -1, old_face below will be NULL, see
             the definition of FACE_FROM_ID_OR_NULL.  This will happen
             if this is the initial call that gets the face.  */
-         struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
+         struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr);
 
          /* If the value of face_id of the iterator is -1, we have to
             look in front of IT's position and see whether there is a
@@ -4242,10 +4245,10 @@ handle_face_prop (struct it *it)
         box, all characters up to that position will have a
         box.  But, as usual, we don't know whether that position
         is really the end.  */
-      if (new_face_id != it->face_id)
+      if (new_face_id != *face_id_ptr)
        {
          struct face *new_face = FACE_FROM_ID (it->f, new_face_id);
-         struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
+         struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr);
 
          /* If new face has a box but old face hasn't, this is the
             start of a run of characters with box, i.e. it has a
@@ -4256,11 +4259,21 @@ handle_face_prop (struct it *it)
        }
     }
 
-  it->face_id = new_face_id;
+  *face_id_ptr = new_face_id;
   return HANDLED_NORMALLY;
 }
 
 
+/* Set up iterator IT from face properties at its current position.
+   Called from handle_stop.  */
+
+static enum prop_handled
+handle_face_prop (struct it *it)
+{
+  return handle_face_prop_general (it, 0);
+}
+
+
 /* Return the ID of the face ``underlying'' IT's current position,
    which is in a string.  If the iterator is associated with a
    buffer, return the face at IT's current buffer position.
@@ -4474,7 +4487,7 @@ face_before_or_after_it_pos (struct it *it, bool before_p)
       face_id = face_at_buffer_position (it->w,
                                         CHARPOS (pos),
                                         &next_check_charpos,
-                                        limit, false, -1);
+                                         limit, false, -1, 0);
 
       /* Correct the face for charsets different from ASCII.  Do it
         for the multibyte case only.  The face returned above is
@@ -7596,10 +7609,11 @@ get_next_display_element (struct it *it)
                  else
                    {
                      next_face_id =
-                       face_at_buffer_position (it->w, CHARPOS (pos), &ignore,
+                       face_at_buffer_position (it->w, CHARPOS (pos),
+                                                &ignore,
                                                 CHARPOS (pos)
                                                 + TEXT_PROP_DISTANCE_LIMIT,
-                                                false, -1);
+                                                false, -1, 0);
                      it->end_of_box_run_p
                        = (FACE_FROM_ID (it->f, next_face_id)->box
                           == FACE_NO_BOX);
@@ -20482,12 +20496,14 @@ extend_face_to_end_of_line (struct it *it)
           || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0))
     return;
 
-  /* Face extension extends the background and box of IT->face_id
+  handle_face_prop_general (it, LFACE_EXTEND_INDEX);
+
+  /* Face extension extends the background and box of IT->extend_face_id
      to the end of the line.  If the background equals the background
      of the frame, we don't have to do anything.  */
   face = FACE_FROM_ID (f, (it->face_before_selective_p
                           ? it->saved_face_id
-                          : it->face_id));
+                          : it->extend_face_id));
 
   if (FRAME_WINDOW_P (f)
       && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row)
@@ -20510,9 +20526,7 @@ extend_face_to_end_of_line (struct it *it)
      that the character will always be single byte in unibyte
      text.  */
   if (!ASCII_CHAR_P (it->c))
-    {
       it->face_id = FACE_FOR_CHAR (f, face, 0, -1, Qnil);
-    }
 
   /* The default face, possibly remapped. */
   struct face *default_face =
@@ -20561,79 +20575,86 @@ extend_face_to_end_of_line (struct it *it)
          /* Display fill column indicator if not in modeline or
             toolbar and display fill column indicator mode is
             active.  */
-         int indicator_column = (it->w->pseudo_window_p == 0
+         const int indicator_column = (it->w->pseudo_window_p == 0
                                  ? fill_column_indicator_column (it)
                                  : -1);
-         if (indicator_column >= 0)
+
+         struct font *font = (default_face->font
+                              ? default_face->font
+                              : FRAME_FONT (f));
+
+         const int char_width = (font->average_width
+                                 ? font->average_width
+                                 : font->space_width);
+         int column_x;
+
+         const char saved_char = it->char_to_display;
+         const struct text_pos saved_pos = it->position;
+         const bool saved_avoid_cursor = it->avoid_cursor_p;
+         const bool saved_box_start = it->start_of_box_run_p;
+         Lisp_Object save_object = it->object;
+         const int saved_face_id = it->face_id;
+
+         it->face_id = it->extend_face_id;
+
+         if (indicator_column >= 0
+             && !INT_MULTIPLY_WRAPV (indicator_column, char_width, &column_x)
+             && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, &column_x)
+             && column_x >= it->current_x
+             && column_x <= it->last_visible_x)
             {
-             struct font *font = (default_face->font
-                                  ? default_face->font
-                                  : FRAME_FONT (f));
-             const int char_width = (font->average_width
-                                     ? font->average_width
-                                     : font->space_width);
-             int column_x;
-
-             if (!INT_MULTIPLY_WRAPV (indicator_column, char_width, &column_x)
-                 && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, &column_x)
-                 && column_x >= it->current_x
-                 && column_x <= it->last_visible_x)
-               {
-                 const char saved_char = it->char_to_display;
-                 const struct text_pos saved_pos = it->position;
-                 const bool saved_avoid_cursor = it->avoid_cursor_p;
-                 const int saved_face_id = it->face_id;
-                 const bool saved_box_start = it->start_of_box_run_p;
-                 Lisp_Object save_object = it->object;
-
-                 /* The stretch width needs to considet the latter
-                    added glyph.  */
-                 const int stretch_width
-                   = column_x - it->current_x - char_width;
-
-                 memset (&it->position, 0, sizeof it->position);
-                 it->avoid_cursor_p = true;
-                 it->object = Qnil;
-
-                 /* Only generate a stretch glyph if there is distance
-                    between current_x and and the indicator position.  */
-                 if (stretch_width > 0)
-                   {
-                     int stretch_ascent = (((it->ascent + it->descent)
-                                            * FONT_BASE (font)) / FONT_HEIGHT 
(font));
-                     append_stretch_glyph (it, Qnil, stretch_width,
-                                           it->ascent + it->descent,
-                                           stretch_ascent);
-                   }
 
-                 /* Generate the glyph indicator only if
-                    append_space_for_newline didn't already.  */
-                 if (it->current_x < column_x)
-                   {
-                     it->char_to_display
-                       = XFIXNAT (Vdisplay_fill_column_indicator_character);
-                     it->face_id
-                       = merge_faces (it->w, Qfill_column_indicator,
-                                      0, saved_face_id);
-                     PRODUCE_GLYPHS (it);
-                   }
-
-                 /* Restore the face after the indicator was generated.  */
-                 it->face_id = saved_face_id;
-
-                 /* If there is space after the indicator generate an
-                    extra empty glyph to restore the face.  Issue was
-                    observed in X systems.  */
-                 it->char_to_display = ' ';
-                 PRODUCE_GLYPHS (it);
-
-                 it->char_to_display = saved_char;
-                 it->position = saved_pos;
-                 it->avoid_cursor_p = saved_avoid_cursor;
-                 it->start_of_box_run_p = saved_box_start;
-                 it->object = save_object;
-               }
+             /* The stretch width needs to considet the latter
+                added glyph.  */
+             const int stretch_width
+               = column_x - it->current_x - char_width;
+
+             memset (&it->position, 0, sizeof it->position);
+             it->avoid_cursor_p = true;
+             it->object = Qnil;
+
+             /* Only generate a stretch glyph if there is distance
+                between current_x and and the indicator position.  */
+             if (stretch_width > 0)
+               {
+                 int stretch_ascent = (((it->ascent + it->descent)
+                                        * FONT_BASE (font)) / FONT_HEIGHT 
(font));
+                 append_stretch_glyph (it, Qnil, stretch_width,
+                                       it->ascent + it->descent,
+                                       stretch_ascent);
+               }
+
+             /* Generate the glyph indicator only if
+                append_space_for_newline didn't already.  */
+             if (it->current_x < column_x)
+               {
+                 const int save_face_id = it->face_id;
+                 it->char_to_display
+                   = XFIXNAT (Vdisplay_fill_column_indicator_character);
+                 it->face_id
+                   = merge_faces (it->w, Qfill_column_indicator,
+                                  0, it->extend_face_id);
+                 PRODUCE_GLYPHS (it);
+                 it->face_id = save_face_id;
+
+               }
             }
+
+         /* Restore the face after the indicator was generated.  */
+
+         /* If there is space after the indicator generate an
+            extra empty glyph to restore the face.  Issue was
+            observed in X systems.  */
+         it->char_to_display = ' ';
+         PRODUCE_GLYPHS (it);
+
+         it->char_to_display = saved_char;
+         it->position = saved_pos;
+         it->avoid_cursor_p = saved_avoid_cursor;
+         it->start_of_box_run_p = saved_box_start;
+         it->object = save_object;
+         it->face_id = saved_face_id;
+
        }
       if (it->glyph_row->reversed_p)
        {
@@ -20679,10 +20700,9 @@ extend_face_to_end_of_line (struct it *it)
              /* The last row's stretch glyph should get the default
                 face, to avoid painting the rest of the window with
                 the region face, if the region ends at ZV.  */
-             if (it->glyph_row->ends_at_zv_p)
-               it->face_id = default_face->id;
-             else
-               it->face_id = face->id;
+             it->face_id = (it->glyph_row->ends_at_zv_p ?
+                            default_face->id : face->id);
+
              it->start_of_box_run_p = false;
              append_stretch_glyph (it, Qnil, stretch_width,
                                    it->ascent + it->descent, stretch_ascent);
@@ -20704,14 +20724,11 @@ extend_face_to_end_of_line (struct it *it)
     {
       /* Save some values that must not be changed.  */
       int saved_x = it->current_x;
-      struct text_pos saved_pos;
-      Lisp_Object saved_object;
+      struct text_pos saved_pos = it->position;
+      Lisp_Object saved_object = it->object;;
       enum display_element_type saved_what = it->what;
       int saved_face_id = it->face_id;
 
-      saved_object = it->object;
-      saved_pos = it->position;
-
       it->what = IT_CHARACTER;
       memset (&it->position, 0, sizeof it->position);
       it->object = Qnil;
@@ -20750,10 +20767,8 @@ extend_face_to_end_of_line (struct it *it)
       /* The last row's blank glyphs should get the default face, to
         avoid painting the rest of the window with the region face,
         if the region ends at ZV.  */
-      if (it->glyph_row->ends_at_zv_p)
-       it->face_id = default_face->id;
-      else
-       it->face_id = face->id;
+      it->face_id = (it->glyph_row->ends_at_zv_p ?
+                     default_face->id : face->id);
 
       /* Display fill-column indicator if needed.  */
       int indicator_column = fill_column_indicator_column (it);
@@ -20763,24 +20778,21 @@ extend_face_to_end_of_line (struct it *it)
        indicator_column = -1;
       do
        {
-         int saved_face_id;
-         bool indicate = it->current_x == indicator_column;
-         if (indicate)
+         if (it->current_x == indicator_column)
            {
-             saved_face_id = it->face_id;
+             int saved_face_id = it->face_id;
              it->face_id
-               = merge_faces (it->w, Qfill_column_indicator, 0, saved_face_id);
+               = merge_faces (it->w, Qfill_column_indicator, 0, 
it->extend_face_id);
              it->c = it->char_to_display
                = XFIXNAT (Vdisplay_fill_column_indicator_character);
-           }
 
-         PRODUCE_GLYPHS (it);
+             PRODUCE_GLYPHS (it);
 
-         if (indicate)
-           {
              it->face_id = saved_face_id;
              it->c = it->char_to_display = ' ';
            }
+         else
+           PRODUCE_GLYPHS (it);
        }
       while (it->current_x <= it->last_visible_x);
 
@@ -30919,7 +30931,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
   hlinfo->mouse_face_face_id
     = face_at_buffer_position (w, mouse_charpos, &ignore,
                               mouse_charpos + 1,
-                              !hlinfo->mouse_face_hidden, -1);
+                               !hlinfo->mouse_face_hidden, -1, 0);
   show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
 }
 
diff --git a/src/xfaces.c b/src/xfaces.c
index 9c58e3e..7c5a085 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -347,7 +347,8 @@ static struct face_cache *make_face_cache (struct frame *);
 static void free_face_cache (struct face_cache *);
 static bool merge_face_ref (struct window *w,
                             struct frame *, Lisp_Object, Lisp_Object *,
-                           bool, struct named_merge_point *);
+                            bool, struct named_merge_point *,
+                            enum lface_attribute_index);
 static int color_distance (Emacs_Color *x, Emacs_Color *y);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1910,7 +1911,8 @@ get_lface_attributes (struct window *w,
            attrs[i] = Qunspecified;
 
          return merge_face_ref (w, f, XCDR (face_remapping), attrs,
-                                signal_p, named_merge_points);
+                                signal_p, named_merge_points,
+                                0);
        }
     }
 
@@ -2065,7 +2067,8 @@ merge_face_vectors (struct window *w,
   if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])
       && !NILP (from[LFACE_INHERIT_INDEX]))
     merge_face_ref (w, f, from[LFACE_INHERIT_INDEX],
-                    to, false, named_merge_points);
+                    to, false, named_merge_points,
+                   0);
 
   if (FONT_SPEC_P (from[LFACE_FONT_INDEX]))
     {
@@ -2131,7 +2134,8 @@ merge_face_vectors (struct window *w,
 static bool
 merge_named_face (struct window *w,
                   struct frame *f, Lisp_Object face_name, Lisp_Object *to,
-                 struct named_merge_point *named_merge_points)
+                  struct named_merge_point *named_merge_points,
+                  enum lface_attribute_index attr_filter)
 {
   struct named_merge_point named_merge_point;
 
@@ -2141,9 +2145,13 @@ merge_named_face (struct window *w,
     {
       Lisp_Object from[LFACE_VECTOR_SIZE];
       bool ok = get_lface_attributes (w, f, face_name, from, false,
-                                     named_merge_points);
+                                      named_merge_points);
 
-      if (ok)
+      eassert (attr_filter <  LFACE_VECTOR_SIZE);
+
+      if (ok && (attr_filter == 0
+                 || (!NILP (from[attr_filter])
+                    && !UNSPECIFIEDP (from[attr_filter]))))
        merge_face_vectors (w, f, from, to, named_merge_points);
 
       return ok;
@@ -2274,6 +2282,11 @@ filter_face_ref (Lisp_Object face_ref,
    of ERR_MSGS).  Use NAMED_MERGE_POINTS to detect loops in face
    inheritance or list structure; it may be 0 for most callers.
 
+   attr_filter is the index of a parameter that conditions the merging
+   for named faces (case 1) to only the face_ref where
+   lface[merge_face_ref] is non-nil. To merge unconditionally set this
+   value to 0.
+
    FACE_REF may be a single face specification or a list of such
    specifications.  Each face specification can be:
 
@@ -2302,7 +2315,8 @@ filter_face_ref (Lisp_Object face_ref,
 static bool
 merge_face_ref (struct window *w,
                 struct frame *f, Lisp_Object face_ref, Lisp_Object *to,
-               bool err_msgs, struct named_merge_point *named_merge_points)
+                bool err_msgs, struct named_merge_point *named_merge_points,
+                enum lface_attribute_index attr_filter)
 {
   bool ok = true;              /* Succeed without an error? */
   Lisp_Object filtered_face_ref;
@@ -2514,7 +2528,8 @@ merge_face_ref (struct window *w,
                  /* This is not really very useful; it's just like a
                     normal face reference.  */
                  if (! merge_face_ref (w, f, value, to,
-                                       err_msgs, named_merge_points))
+                                       err_msgs, named_merge_points,
+                                       0))
                    err = true;
                }
              else if (EQ (keyword, QCextend))
@@ -2544,16 +2559,19 @@ merge_face_ref (struct window *w,
          Lisp_Object next = XCDR (face_ref);
 
          if (! NILP (next))
-           ok = merge_face_ref (w, f, next, to, err_msgs, named_merge_points);
+           ok = merge_face_ref (w, f, next, to, err_msgs,
+                                named_merge_points, 0);
 
-         if (! merge_face_ref (w, f, first, to, err_msgs, named_merge_points))
+         if (! merge_face_ref (w, f, first, to, err_msgs,
+                               named_merge_points, 0))
            ok = false;
        }
     }
   else
     {
       /* FACE_REF ought to be a face name.  */
-      ok = merge_named_face (w, f, face_ref, to, named_merge_points);
+      ok = merge_named_face (w, f, face_ref, to, named_merge_points,
+                             attr_filter);
       if (!ok && err_msgs)
        add_to_log ("Invalid face reference: %s", face_ref);
     }
@@ -4534,7 +4552,8 @@ lookup_face (struct frame *f, Lisp_Object *attr)
    suitable face is found, realize a new one.  */
 
 int
-face_for_font (struct frame *f, Lisp_Object font_object, struct face 
*base_face)
+face_for_font (struct frame *f, Lisp_Object font_object,
+               struct face *base_face)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
   unsigned hash;
@@ -4767,7 +4786,7 @@ DEFUN ("face-attributes-as-vector", 
Fface_attributes_as_vector,
   Lisp_Object lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
   merge_face_ref (NULL, XFRAME (selected_frame),
                   plist, XVECTOR (lface)->contents,
-                 true, 0);
+                  true, NULL, 0);
   return lface;
 }
 
@@ -5124,7 +5143,7 @@ face for italic.  */)
 
   for (i = 0; i < LFACE_VECTOR_SIZE; i++)
     attrs[i] = Qunspecified;
-  merge_face_ref (NULL, f, attributes, attrs, true, 0);
+  merge_face_ref (NULL, f, attributes, attrs, true, NULL, 0);
 
   def_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
   if (def_face == NULL)
@@ -6008,7 +6027,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object 
prop)
       Lisp_Object attrs[LFACE_VECTOR_SIZE];
       struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
       memcpy (attrs, default_face->lface, sizeof attrs);
-      merge_face_ref (NULL, f, prop, attrs, true, 0);
+      merge_face_ref (NULL, f, prop, attrs, true, NULL, 0);
       face_id = lookup_face (f, attrs);
     }
 
@@ -6020,6 +6039,8 @@ compute_char_face (struct frame *f, int ch, Lisp_Object 
prop)
    which a different face is needed, as far as text properties and
    overlays are concerned.  W is a window displaying current_buffer.
 
+   attr_filter is passed merge_face_ref.
+
    REGION_BEG, REGION_END delimit the region, so it can be
    highlighted.
 
@@ -6039,7 +6060,8 @@ compute_char_face (struct frame *f, int ch, Lisp_Object 
prop)
 int
 face_at_buffer_position (struct window *w, ptrdiff_t pos,
                         ptrdiff_t *endptr, ptrdiff_t limit,
-                        bool mouse, int base_face_id)
+                         bool mouse, int base_face_id,
+                         enum lface_attribute_index attr_filter)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6100,8 +6122,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
   }
 
   /* Optimize common cases where we can use the default face.  */
-  if (noverlays == 0
-      && NILP (prop))
+  if (noverlays == 0 && NILP (prop))
     {
       SAFE_FREE ();
       return default_face->id;
@@ -6112,7 +6133,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
-    merge_face_ref (w, f, prop, attrs, true, 0);
+    merge_face_ref (w, f, prop, attrs, true, NULL, 0);
 
   /* Now merge the overlay data.  */
   noverlays = sort_overlays (overlay_vec, noverlays, w);
@@ -6132,7 +6153,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
                 so discard the mouse-face text property, if any, and
                 use the overlay property instead.  */
              memcpy (attrs, default_face->lface, sizeof attrs);
-             merge_face_ref (w, f, prop, attrs, true, 0);
+             merge_face_ref (w, f, prop, attrs, true, NULL, attr_filter);
            }
 
          oend = OVERLAY_END (overlay_vec[i]);
@@ -6149,8 +6170,9 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
          ptrdiff_t oendpos;
 
          prop = Foverlay_get (overlay_vec[i], propname);
+
          if (!NILP (prop))
-           merge_face_ref (w, f, prop, attrs, true, 0);
+           merge_face_ref (w, f, prop, attrs, true, NULL, attr_filter);
 
          oend = OVERLAY_END (overlay_vec[i]);
          oendpos = OVERLAY_POSITION (oend);
@@ -6216,7 +6238,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
-    merge_face_ref (w, f, prop, attrs, true, 0);
+    merge_face_ref (w, f, prop, attrs, true, NULL, 0);
 
   *endptr = endpos;
 
@@ -6251,7 +6273,7 @@ int
 face_at_string_position (struct window *w, Lisp_Object string,
                         ptrdiff_t pos, ptrdiff_t bufpos,
                         ptrdiff_t *endptr, enum face_id base_face_id,
-                        bool mouse_p)
+                         bool mouse_p)
 {
   Lisp_Object prop, position, end, limit;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -6295,7 +6317,7 @@ face_at_string_position (struct window *w, Lisp_Object 
string,
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
-    merge_face_ref (w, f, prop, attrs, true, 0);
+    merge_face_ref (w, f, prop, attrs, true, NULL, 0);
 
   /* Look up a realized face with the given face attributes,
      or realize a new one for ASCII characters.  */
@@ -6345,7 +6367,7 @@ merge_faces (struct window *w, Lisp_Object face_name, int 
face_id,
 
   if (!NILP (face_name))
     {
-      if (!merge_named_face (w, f, face_name, attrs, 0))
+      if (!merge_named_face (w, f, face_name, attrs, NULL, 0))
        return base_face_id;
     }
   else



reply via email to

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