diff options
| author | Jimmy Aguilar Mena | 2019-10-12 18:10:48 +0200 |
|---|---|---|
| committer | Jimmy Aguilar Mena | 2019-10-14 14:18:39 +0200 |
| commit | e02fe26c7fcccb4059a7c7baba20bd9cb3b9a313 (patch) | |
| tree | 5e22d028833155660ac95ac39a8a619fde8f327d /src | |
| parent | bc8db39775eb3af36a45d51130cd4dbd3b3e7210 (diff) | |
| download | emacs-e02fe26c7fcccb4059a7c7baba20bd9cb3b9a313.tar.gz emacs-e02fe26c7fcccb4059a7c7baba20bd9cb3b9a313.zip | |
New parameter to control the face extension..
* src/xdisp.c (handle_face_prop_general): New function to specialize
handle_face_prop with ATTR_FILTER.
* src/dispextern.h (face_at_buffer_position): Added
LFACE_ATTRIBUTE_INDEX.
* src/xfaces.c (merge_face_ref): Added LFACE_ATTRIBUTE_INDEX to merge
conditionally.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/font.c | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 44 | ||||
| -rw-r--r-- | src/xfaces.c | 72 |
4 files changed, 82 insertions, 46 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 519cc36345c..5db3ae88bf8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3554,8 +3554,8 @@ int lookup_derived_face (struct window *, struct frame *, | |||
| 3554 | void init_frame_faces (struct frame *); | 3554 | void init_frame_faces (struct frame *); |
| 3555 | void free_frame_faces (struct frame *); | 3555 | void free_frame_faces (struct frame *); |
| 3556 | void recompute_basic_faces (struct frame *); | 3556 | void recompute_basic_faces (struct frame *); |
| 3557 | int face_at_buffer_position (struct window *, ptrdiff_t, ptrdiff_t *, ptrdiff_t, | 3557 | int face_at_buffer_position (struct window *, ptrdiff_t, ptrdiff_t *, |
| 3558 | bool, int); | 3558 | ptrdiff_t, bool, int, enum lface_attribute_index); |
| 3559 | int face_for_overlay_string (struct window *, ptrdiff_t, ptrdiff_t *, ptrdiff_t, | 3559 | int face_for_overlay_string (struct window *, ptrdiff_t, ptrdiff_t *, ptrdiff_t, |
| 3560 | bool, Lisp_Object); | 3560 | bool, Lisp_Object); |
| 3561 | int face_at_string_position (struct window *, Lisp_Object, ptrdiff_t, ptrdiff_t, | 3561 | int face_at_string_position (struct window *, Lisp_Object, ptrdiff_t, ptrdiff_t, |
diff --git a/src/font.c b/src/font.c index 6bc977fd68e..e1e33ab8b22 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -3785,10 +3785,10 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, | |||
| 3785 | 3785 | ||
| 3786 | if (STRINGP (string)) | 3786 | if (STRINGP (string)) |
| 3787 | face_id = face_at_string_position (w, string, pos, 0, &endptr, | 3787 | face_id = face_at_string_position (w, string, pos, 0, &endptr, |
| 3788 | DEFAULT_FACE_ID, false); | 3788 | DEFAULT_FACE_ID, 0); |
| 3789 | else | 3789 | else |
| 3790 | face_id = face_at_buffer_position (w, pos, &endptr, | 3790 | face_id = face_at_buffer_position (w, pos, &endptr, |
| 3791 | pos + 100, false, -1); | 3791 | pos + 100, false, -1, 0); |
| 3792 | face = FACE_FROM_ID (f, face_id); | 3792 | face = FACE_FROM_ID (f, face_id); |
| 3793 | } | 3793 | } |
| 3794 | if (multibyte) | 3794 | if (multibyte) |
| @@ -3832,7 +3832,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, | |||
| 3832 | 3832 | ||
| 3833 | if (NILP (string)) | 3833 | if (NILP (string)) |
| 3834 | face_id = face_at_buffer_position (w, pos, &ignore, *limit, | 3834 | face_id = face_at_buffer_position (w, pos, &ignore, *limit, |
| 3835 | false, -1); | 3835 | false, -1, 0); |
| 3836 | else | 3836 | else |
| 3837 | { | 3837 | { |
| 3838 | face_id = | 3838 | face_id = |
| @@ -4618,7 +4618,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 4618 | w = XWINDOW (window); | 4618 | w = XWINDOW (window); |
| 4619 | f = XFRAME (w->frame); | 4619 | f = XFRAME (w->frame); |
| 4620 | face_id = face_at_buffer_position (w, pos, &dummy, | 4620 | face_id = face_at_buffer_position (w, pos, &dummy, |
| 4621 | pos + 100, false, -1); | 4621 | pos + 100, false, -1, 0); |
| 4622 | } | 4622 | } |
| 4623 | if (! CHAR_VALID_P (c)) | 4623 | if (! CHAR_VALID_P (c)) |
| 4624 | return Qnil; | 4624 | return Qnil; |
diff --git a/src/xdisp.c b/src/xdisp.c index 38a2ff66c5b..07ff4c7da7d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -4148,15 +4148,18 @@ handle_fontified_prop (struct it *it) | |||
| 4148 | Faces | 4148 | Faces |
| 4149 | ***********************************************************************/ | 4149 | ***********************************************************************/ |
| 4150 | 4150 | ||
| 4151 | /* Set up iterator IT from face properties at its current position. | ||
| 4152 | Called from handle_stop. */ | ||
| 4153 | |||
| 4154 | static enum prop_handled | 4151 | static enum prop_handled |
| 4155 | handle_face_prop (struct it *it) | 4152 | handle_face_prop_general (struct it *it, |
| 4153 | enum lface_attribute_index attr_filter) | ||
| 4156 | { | 4154 | { |
| 4157 | int new_face_id; | 4155 | int new_face_id, *face_id_ptr; |
| 4158 | ptrdiff_t next_stop; | 4156 | ptrdiff_t next_stop; |
| 4159 | 4157 | ||
| 4158 | if (attr_filter == LFACE_EXTEND_INDEX) | ||
| 4159 | face_id_ptr = &(it->extend_face_id); | ||
| 4160 | else | ||
| 4161 | face_id_ptr = &(it->face_id); | ||
| 4162 | |||
| 4160 | if (!STRINGP (it->string)) | 4163 | if (!STRINGP (it->string)) |
| 4161 | { | 4164 | { |
| 4162 | new_face_id | 4165 | new_face_id |
| @@ -4165,7 +4168,7 @@ handle_face_prop (struct it *it) | |||
| 4165 | &next_stop, | 4168 | &next_stop, |
| 4166 | (IT_CHARPOS (*it) | 4169 | (IT_CHARPOS (*it) |
| 4167 | + TEXT_PROP_DISTANCE_LIMIT), | 4170 | + TEXT_PROP_DISTANCE_LIMIT), |
| 4168 | false, it->base_face_id); | 4171 | false, it->base_face_id, attr_filter); |
| 4169 | 4172 | ||
| 4170 | /* Is this a start of a run of characters with box face? | 4173 | /* Is this a start of a run of characters with box face? |
| 4171 | Caveat: this can be called for a freshly initialized | 4174 | Caveat: this can be called for a freshly initialized |
| @@ -4173,13 +4176,13 @@ handle_face_prop (struct it *it) | |||
| 4173 | face will not change until limit, i.e. if the new face has a | 4176 | face will not change until limit, i.e. if the new face has a |
| 4174 | box, all characters up to limit will have one. But, as | 4177 | box, all characters up to limit will have one. But, as |
| 4175 | usual, we don't know whether limit is really the end. */ | 4178 | usual, we don't know whether limit is really the end. */ |
| 4176 | if (new_face_id != it->face_id) | 4179 | if (new_face_id != *face_id_ptr) |
| 4177 | { | 4180 | { |
| 4178 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); | 4181 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); |
| 4179 | /* If it->face_id is -1, old_face below will be NULL, see | 4182 | /* If it->face_id is -1, old_face below will be NULL, see |
| 4180 | the definition of FACE_FROM_ID_OR_NULL. This will happen | 4183 | the definition of FACE_FROM_ID_OR_NULL. This will happen |
| 4181 | if this is the initial call that gets the face. */ | 4184 | if this is the initial call that gets the face. */ |
| 4182 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id); | 4185 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr); |
| 4183 | 4186 | ||
| 4184 | /* If the value of face_id of the iterator is -1, we have to | 4187 | /* If the value of face_id of the iterator is -1, we have to |
| 4185 | look in front of IT's position and see whether there is a | 4188 | look in front of IT's position and see whether there is a |
| @@ -4285,10 +4288,10 @@ handle_face_prop (struct it *it) | |||
| 4285 | box, all characters up to that position will have a | 4288 | box, all characters up to that position will have a |
| 4286 | box. But, as usual, we don't know whether that position | 4289 | box. But, as usual, we don't know whether that position |
| 4287 | is really the end. */ | 4290 | is really the end. */ |
| 4288 | if (new_face_id != it->face_id) | 4291 | if (new_face_id != *face_id_ptr) |
| 4289 | { | 4292 | { |
| 4290 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); | 4293 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); |
| 4291 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id); | 4294 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr); |
| 4292 | 4295 | ||
| 4293 | /* If new face has a box but old face hasn't, this is the | 4296 | /* If new face has a box but old face hasn't, this is the |
| 4294 | start of a run of characters with box, i.e. it has a | 4297 | start of a run of characters with box, i.e. it has a |
| @@ -4299,11 +4302,21 @@ handle_face_prop (struct it *it) | |||
| 4299 | } | 4302 | } |
| 4300 | } | 4303 | } |
| 4301 | 4304 | ||
| 4302 | it->face_id = new_face_id; | 4305 | *face_id_ptr = new_face_id; |
| 4303 | return HANDLED_NORMALLY; | 4306 | return HANDLED_NORMALLY; |
| 4304 | } | 4307 | } |
| 4305 | 4308 | ||
| 4306 | 4309 | ||
| 4310 | /* Set up iterator IT from face properties at its current position. | ||
| 4311 | Called from handle_stop. */ | ||
| 4312 | |||
| 4313 | static enum prop_handled | ||
| 4314 | handle_face_prop (struct it *it) | ||
| 4315 | { | ||
| 4316 | return handle_face_prop_general (it, 0); | ||
| 4317 | } | ||
| 4318 | |||
| 4319 | |||
| 4307 | /* Return the ID of the face ``underlying'' IT's current position, | 4320 | /* Return the ID of the face ``underlying'' IT's current position, |
| 4308 | which is in a string. If the iterator is associated with a | 4321 | which is in a string. If the iterator is associated with a |
| 4309 | buffer, return the face at IT's current buffer position. | 4322 | buffer, return the face at IT's current buffer position. |
| @@ -4527,7 +4540,7 @@ face_before_or_after_it_pos (struct it *it, bool before_p) | |||
| 4527 | face_id = face_at_buffer_position (it->w, | 4540 | face_id = face_at_buffer_position (it->w, |
| 4528 | CHARPOS (pos), | 4541 | CHARPOS (pos), |
| 4529 | &next_check_charpos, | 4542 | &next_check_charpos, |
| 4530 | limit, false, -1); | 4543 | limit, false, -1, 0); |
| 4531 | 4544 | ||
| 4532 | /* Correct the face for charsets different from ASCII. Do it | 4545 | /* Correct the face for charsets different from ASCII. Do it |
| 4533 | for the multibyte case only. The face returned above is | 4546 | for the multibyte case only. The face returned above is |
| @@ -7649,10 +7662,11 @@ get_next_display_element (struct it *it) | |||
| 7649 | else | 7662 | else |
| 7650 | { | 7663 | { |
| 7651 | next_face_id = | 7664 | next_face_id = |
| 7652 | face_at_buffer_position (it->w, CHARPOS (pos), &ignore, | 7665 | face_at_buffer_position (it->w, CHARPOS (pos), |
| 7666 | &ignore, | ||
| 7653 | CHARPOS (pos) | 7667 | CHARPOS (pos) |
| 7654 | + TEXT_PROP_DISTANCE_LIMIT, | 7668 | + TEXT_PROP_DISTANCE_LIMIT, |
| 7655 | false, -1); | 7669 | false, -1, 0); |
| 7656 | it->end_of_box_run_p | 7670 | it->end_of_box_run_p |
| 7657 | = (FACE_FROM_ID (it->f, next_face_id)->box | 7671 | = (FACE_FROM_ID (it->f, next_face_id)->box |
| 7658 | == FACE_NO_BOX); | 7672 | == FACE_NO_BOX); |
| @@ -32068,7 +32082,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 32068 | hlinfo->mouse_face_face_id | 32082 | hlinfo->mouse_face_face_id |
| 32069 | = face_at_buffer_position (w, mouse_charpos, &ignore, | 32083 | = face_at_buffer_position (w, mouse_charpos, &ignore, |
| 32070 | mouse_charpos + 1, | 32084 | mouse_charpos + 1, |
| 32071 | !hlinfo->mouse_face_hidden, -1); | 32085 | !hlinfo->mouse_face_hidden, -1, 0); |
| 32072 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); | 32086 | show_mouse_face (hlinfo, DRAW_MOUSE_FACE); |
| 32073 | } | 32087 | } |
| 32074 | 32088 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index 889bf83561c..189ba1e7678 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -347,7 +347,8 @@ static struct face_cache *make_face_cache (struct frame *); | |||
| 347 | static void free_face_cache (struct face_cache *); | 347 | static void free_face_cache (struct face_cache *); |
| 348 | static bool merge_face_ref (struct window *w, | 348 | static bool merge_face_ref (struct window *w, |
| 349 | struct frame *, Lisp_Object, Lisp_Object *, | 349 | struct frame *, Lisp_Object, Lisp_Object *, |
| 350 | bool, struct named_merge_point *); | 350 | bool, struct named_merge_point *, |
| 351 | enum lface_attribute_index); | ||
| 351 | static int color_distance (Emacs_Color *x, Emacs_Color *y); | 352 | static int color_distance (Emacs_Color *x, Emacs_Color *y); |
| 352 | 353 | ||
| 353 | #ifdef HAVE_WINDOW_SYSTEM | 354 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -1910,7 +1911,8 @@ get_lface_attributes (struct window *w, | |||
| 1910 | attrs[i] = Qunspecified; | 1911 | attrs[i] = Qunspecified; |
| 1911 | 1912 | ||
| 1912 | return merge_face_ref (w, f, XCDR (face_remapping), attrs, | 1913 | return merge_face_ref (w, f, XCDR (face_remapping), attrs, |
| 1913 | signal_p, named_merge_points); | 1914 | signal_p, named_merge_points, |
| 1915 | 0); | ||
| 1914 | } | 1916 | } |
| 1915 | } | 1917 | } |
| 1916 | 1918 | ||
| @@ -2065,7 +2067,8 @@ merge_face_vectors (struct window *w, | |||
| 2065 | if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]) | 2067 | if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]) |
| 2066 | && !NILP (from[LFACE_INHERIT_INDEX])) | 2068 | && !NILP (from[LFACE_INHERIT_INDEX])) |
| 2067 | merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], | 2069 | merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], |
| 2068 | to, false, named_merge_points); | 2070 | to, false, named_merge_points, |
| 2071 | 0); | ||
| 2069 | 2072 | ||
| 2070 | if (FONT_SPEC_P (from[LFACE_FONT_INDEX])) | 2073 | if (FONT_SPEC_P (from[LFACE_FONT_INDEX])) |
| 2071 | { | 2074 | { |
| @@ -2131,7 +2134,8 @@ merge_face_vectors (struct window *w, | |||
| 2131 | static bool | 2134 | static bool |
| 2132 | merge_named_face (struct window *w, | 2135 | merge_named_face (struct window *w, |
| 2133 | struct frame *f, Lisp_Object face_name, Lisp_Object *to, | 2136 | struct frame *f, Lisp_Object face_name, Lisp_Object *to, |
| 2134 | struct named_merge_point *named_merge_points) | 2137 | struct named_merge_point *named_merge_points, |
| 2138 | enum lface_attribute_index attr_filter) | ||
| 2135 | { | 2139 | { |
| 2136 | struct named_merge_point named_merge_point; | 2140 | struct named_merge_point named_merge_point; |
| 2137 | 2141 | ||
| @@ -2141,9 +2145,13 @@ merge_named_face (struct window *w, | |||
| 2141 | { | 2145 | { |
| 2142 | Lisp_Object from[LFACE_VECTOR_SIZE]; | 2146 | Lisp_Object from[LFACE_VECTOR_SIZE]; |
| 2143 | bool ok = get_lface_attributes (w, f, face_name, from, false, | 2147 | bool ok = get_lface_attributes (w, f, face_name, from, false, |
| 2144 | named_merge_points); | 2148 | named_merge_points); |
| 2145 | 2149 | ||
| 2146 | if (ok) | 2150 | eassert (attr_filter < LFACE_VECTOR_SIZE); |
| 2151 | |||
| 2152 | if (ok && (attr_filter == 0 | ||
| 2153 | || (!NILP (from[attr_filter]) | ||
| 2154 | && !UNSPECIFIEDP (from[attr_filter])))) | ||
| 2147 | merge_face_vectors (w, f, from, to, named_merge_points); | 2155 | merge_face_vectors (w, f, from, to, named_merge_points); |
| 2148 | 2156 | ||
| 2149 | return ok; | 2157 | return ok; |
| @@ -2274,6 +2282,11 @@ filter_face_ref (Lisp_Object face_ref, | |||
| 2274 | of ERR_MSGS). Use NAMED_MERGE_POINTS to detect loops in face | 2282 | of ERR_MSGS). Use NAMED_MERGE_POINTS to detect loops in face |
| 2275 | inheritance or list structure; it may be 0 for most callers. | 2283 | inheritance or list structure; it may be 0 for most callers. |
| 2276 | 2284 | ||
| 2285 | attr_filter is the index of a parameter that conditions the merging | ||
| 2286 | for named faces (case 1) to only the face_ref where | ||
| 2287 | lface[merge_face_ref] is non-nil. To merge unconditionally set this | ||
| 2288 | value to 0. | ||
| 2289 | |||
| 2277 | FACE_REF may be a single face specification or a list of such | 2290 | FACE_REF may be a single face specification or a list of such |
| 2278 | specifications. Each face specification can be: | 2291 | specifications. Each face specification can be: |
| 2279 | 2292 | ||
| @@ -2302,7 +2315,8 @@ filter_face_ref (Lisp_Object face_ref, | |||
| 2302 | static bool | 2315 | static bool |
| 2303 | merge_face_ref (struct window *w, | 2316 | merge_face_ref (struct window *w, |
| 2304 | struct frame *f, Lisp_Object face_ref, Lisp_Object *to, | 2317 | struct frame *f, Lisp_Object face_ref, Lisp_Object *to, |
| 2305 | bool err_msgs, struct named_merge_point *named_merge_points) | 2318 | bool err_msgs, struct named_merge_point *named_merge_points, |
| 2319 | enum lface_attribute_index attr_filter) | ||
| 2306 | { | 2320 | { |
| 2307 | bool ok = true; /* Succeed without an error? */ | 2321 | bool ok = true; /* Succeed without an error? */ |
| 2308 | Lisp_Object filtered_face_ref; | 2322 | Lisp_Object filtered_face_ref; |
| @@ -2514,7 +2528,8 @@ merge_face_ref (struct window *w, | |||
| 2514 | /* This is not really very useful; it's just like a | 2528 | /* This is not really very useful; it's just like a |
| 2515 | normal face reference. */ | 2529 | normal face reference. */ |
| 2516 | if (! merge_face_ref (w, f, value, to, | 2530 | if (! merge_face_ref (w, f, value, to, |
| 2517 | err_msgs, named_merge_points)) | 2531 | err_msgs, named_merge_points, |
| 2532 | 0)) | ||
| 2518 | err = true; | 2533 | err = true; |
| 2519 | } | 2534 | } |
| 2520 | else if (EQ (keyword, QCextend)) | 2535 | else if (EQ (keyword, QCextend)) |
| @@ -2544,16 +2559,19 @@ merge_face_ref (struct window *w, | |||
| 2544 | Lisp_Object next = XCDR (face_ref); | 2559 | Lisp_Object next = XCDR (face_ref); |
| 2545 | 2560 | ||
| 2546 | if (! NILP (next)) | 2561 | if (! NILP (next)) |
| 2547 | ok = merge_face_ref (w, f, next, to, err_msgs, named_merge_points); | 2562 | ok = merge_face_ref (w, f, next, to, err_msgs, |
| 2563 | named_merge_points, 0); | ||
| 2548 | 2564 | ||
| 2549 | if (! merge_face_ref (w, f, first, to, err_msgs, named_merge_points)) | 2565 | if (! merge_face_ref (w, f, first, to, err_msgs, |
| 2566 | named_merge_points, 0)) | ||
| 2550 | ok = false; | 2567 | ok = false; |
| 2551 | } | 2568 | } |
| 2552 | } | 2569 | } |
| 2553 | else | 2570 | else |
| 2554 | { | 2571 | { |
| 2555 | /* FACE_REF ought to be a face name. */ | 2572 | /* FACE_REF ought to be a face name. */ |
| 2556 | ok = merge_named_face (w, f, face_ref, to, named_merge_points); | 2573 | ok = merge_named_face (w, f, face_ref, to, named_merge_points, |
| 2574 | attr_filter); | ||
| 2557 | if (!ok && err_msgs) | 2575 | if (!ok && err_msgs) |
| 2558 | add_to_log ("Invalid face reference: %s", face_ref); | 2576 | add_to_log ("Invalid face reference: %s", face_ref); |
| 2559 | } | 2577 | } |
| @@ -4534,7 +4552,8 @@ lookup_face (struct frame *f, Lisp_Object *attr) | |||
| 4534 | suitable face is found, realize a new one. */ | 4552 | suitable face is found, realize a new one. */ |
| 4535 | 4553 | ||
| 4536 | int | 4554 | int |
| 4537 | face_for_font (struct frame *f, Lisp_Object font_object, struct face *base_face) | 4555 | face_for_font (struct frame *f, Lisp_Object font_object, |
| 4556 | struct face *base_face) | ||
| 4538 | { | 4557 | { |
| 4539 | struct face_cache *cache = FRAME_FACE_CACHE (f); | 4558 | struct face_cache *cache = FRAME_FACE_CACHE (f); |
| 4540 | unsigned hash; | 4559 | unsigned hash; |
| @@ -4769,7 +4788,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, | |||
| 4769 | Lisp_Object lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified); | 4788 | Lisp_Object lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified); |
| 4770 | merge_face_ref (NULL, XFRAME (selected_frame), | 4789 | merge_face_ref (NULL, XFRAME (selected_frame), |
| 4771 | plist, XVECTOR (lface)->contents, | 4790 | plist, XVECTOR (lface)->contents, |
| 4772 | true, 0); | 4791 | true, NULL, 0); |
| 4773 | return lface; | 4792 | return lface; |
| 4774 | } | 4793 | } |
| 4775 | 4794 | ||
| @@ -5126,7 +5145,7 @@ face for italic. */) | |||
| 5126 | 5145 | ||
| 5127 | for (i = 0; i < LFACE_VECTOR_SIZE; i++) | 5146 | for (i = 0; i < LFACE_VECTOR_SIZE; i++) |
| 5128 | attrs[i] = Qunspecified; | 5147 | attrs[i] = Qunspecified; |
| 5129 | merge_face_ref (NULL, f, attributes, attrs, true, 0); | 5148 | merge_face_ref (NULL, f, attributes, attrs, true, NULL, 0); |
| 5130 | 5149 | ||
| 5131 | def_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID); | 5150 | def_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID); |
| 5132 | if (def_face == NULL) | 5151 | if (def_face == NULL) |
| @@ -6012,7 +6031,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop) | |||
| 6012 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 6031 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 6013 | struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | 6032 | struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
| 6014 | memcpy (attrs, default_face->lface, sizeof attrs); | 6033 | memcpy (attrs, default_face->lface, sizeof attrs); |
| 6015 | merge_face_ref (NULL, f, prop, attrs, true, 0); | 6034 | merge_face_ref (NULL, f, prop, attrs, true, NULL, 0); |
| 6016 | face_id = lookup_face (f, attrs); | 6035 | face_id = lookup_face (f, attrs); |
| 6017 | } | 6036 | } |
| 6018 | 6037 | ||
| @@ -6024,6 +6043,8 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop) | |||
| 6024 | which a different face is needed, as far as text properties and | 6043 | which a different face is needed, as far as text properties and |
| 6025 | overlays are concerned. W is a window displaying current_buffer. | 6044 | overlays are concerned. W is a window displaying current_buffer. |
| 6026 | 6045 | ||
| 6046 | attr_filter is passed merge_face_ref. | ||
| 6047 | |||
| 6027 | REGION_BEG, REGION_END delimit the region, so it can be | 6048 | REGION_BEG, REGION_END delimit the region, so it can be |
| 6028 | highlighted. | 6049 | highlighted. |
| 6029 | 6050 | ||
| @@ -6043,7 +6064,8 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop) | |||
| 6043 | int | 6064 | int |
| 6044 | face_at_buffer_position (struct window *w, ptrdiff_t pos, | 6065 | face_at_buffer_position (struct window *w, ptrdiff_t pos, |
| 6045 | ptrdiff_t *endptr, ptrdiff_t limit, | 6066 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 6046 | bool mouse, int base_face_id) | 6067 | bool mouse, int base_face_id, |
| 6068 | enum lface_attribute_index attr_filter) | ||
| 6047 | { | 6069 | { |
| 6048 | struct frame *f = XFRAME (w->frame); | 6070 | struct frame *f = XFRAME (w->frame); |
| 6049 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 6071 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| @@ -6104,8 +6126,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 6104 | } | 6126 | } |
| 6105 | 6127 | ||
| 6106 | /* Optimize common cases where we can use the default face. */ | 6128 | /* Optimize common cases where we can use the default face. */ |
| 6107 | if (noverlays == 0 | 6129 | if (noverlays == 0 && NILP (prop)) |
| 6108 | && NILP (prop)) | ||
| 6109 | { | 6130 | { |
| 6110 | SAFE_FREE (); | 6131 | SAFE_FREE (); |
| 6111 | return default_face->id; | 6132 | return default_face->id; |
| @@ -6116,7 +6137,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 6116 | 6137 | ||
| 6117 | /* Merge in attributes specified via text properties. */ | 6138 | /* Merge in attributes specified via text properties. */ |
| 6118 | if (!NILP (prop)) | 6139 | if (!NILP (prop)) |
| 6119 | merge_face_ref (w, f, prop, attrs, true, 0); | 6140 | merge_face_ref (w, f, prop, attrs, true, NULL, 0); |
| 6120 | 6141 | ||
| 6121 | /* Now merge the overlay data. */ | 6142 | /* Now merge the overlay data. */ |
| 6122 | noverlays = sort_overlays (overlay_vec, noverlays, w); | 6143 | noverlays = sort_overlays (overlay_vec, noverlays, w); |
| @@ -6136,7 +6157,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 6136 | so discard the mouse-face text property, if any, and | 6157 | so discard the mouse-face text property, if any, and |
| 6137 | use the overlay property instead. */ | 6158 | use the overlay property instead. */ |
| 6138 | memcpy (attrs, default_face->lface, sizeof attrs); | 6159 | memcpy (attrs, default_face->lface, sizeof attrs); |
| 6139 | merge_face_ref (w, f, prop, attrs, true, 0); | 6160 | merge_face_ref (w, f, prop, attrs, true, NULL, attr_filter); |
| 6140 | } | 6161 | } |
| 6141 | 6162 | ||
| 6142 | oend = OVERLAY_END (overlay_vec[i]); | 6163 | oend = OVERLAY_END (overlay_vec[i]); |
| @@ -6153,8 +6174,9 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 6153 | ptrdiff_t oendpos; | 6174 | ptrdiff_t oendpos; |
| 6154 | 6175 | ||
| 6155 | prop = Foverlay_get (overlay_vec[i], propname); | 6176 | prop = Foverlay_get (overlay_vec[i], propname); |
| 6177 | |||
| 6156 | if (!NILP (prop)) | 6178 | if (!NILP (prop)) |
| 6157 | merge_face_ref (w, f, prop, attrs, true, 0); | 6179 | merge_face_ref (w, f, prop, attrs, true, NULL, attr_filter); |
| 6158 | 6180 | ||
| 6159 | oend = OVERLAY_END (overlay_vec[i]); | 6181 | oend = OVERLAY_END (overlay_vec[i]); |
| 6160 | oendpos = OVERLAY_POSITION (oend); | 6182 | oendpos = OVERLAY_POSITION (oend); |
| @@ -6220,7 +6242,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6220 | 6242 | ||
| 6221 | /* Merge in attributes specified via text properties. */ | 6243 | /* Merge in attributes specified via text properties. */ |
| 6222 | if (!NILP (prop)) | 6244 | if (!NILP (prop)) |
| 6223 | merge_face_ref (w, f, prop, attrs, true, 0); | 6245 | merge_face_ref (w, f, prop, attrs, true, NULL, 0); |
| 6224 | 6246 | ||
| 6225 | *endptr = endpos; | 6247 | *endptr = endpos; |
| 6226 | 6248 | ||
| @@ -6255,7 +6277,7 @@ int | |||
| 6255 | face_at_string_position (struct window *w, Lisp_Object string, | 6277 | face_at_string_position (struct window *w, Lisp_Object string, |
| 6256 | ptrdiff_t pos, ptrdiff_t bufpos, | 6278 | ptrdiff_t pos, ptrdiff_t bufpos, |
| 6257 | ptrdiff_t *endptr, enum face_id base_face_id, | 6279 | ptrdiff_t *endptr, enum face_id base_face_id, |
| 6258 | bool mouse_p) | 6280 | bool mouse_p) |
| 6259 | { | 6281 | { |
| 6260 | Lisp_Object prop, position, end, limit; | 6282 | Lisp_Object prop, position, end, limit; |
| 6261 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 6283 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| @@ -6299,7 +6321,7 @@ face_at_string_position (struct window *w, Lisp_Object string, | |||
| 6299 | 6321 | ||
| 6300 | /* Merge in attributes specified via text properties. */ | 6322 | /* Merge in attributes specified via text properties. */ |
| 6301 | if (!NILP (prop)) | 6323 | if (!NILP (prop)) |
| 6302 | merge_face_ref (w, f, prop, attrs, true, 0); | 6324 | merge_face_ref (w, f, prop, attrs, true, NULL, 0); |
| 6303 | 6325 | ||
| 6304 | /* Look up a realized face with the given face attributes, | 6326 | /* Look up a realized face with the given face attributes, |
| 6305 | or realize a new one for ASCII characters. */ | 6327 | or realize a new one for ASCII characters. */ |
| @@ -6349,7 +6371,7 @@ merge_faces (struct window *w, Lisp_Object face_name, int face_id, | |||
| 6349 | 6371 | ||
| 6350 | if (!NILP (face_name)) | 6372 | if (!NILP (face_name)) |
| 6351 | { | 6373 | { |
| 6352 | if (!merge_named_face (w, f, face_name, attrs, 0)) | 6374 | if (!merge_named_face (w, f, face_name, attrs, NULL, 0)) |
| 6353 | return base_face_id; | 6375 | return base_face_id; |
| 6354 | } | 6376 | } |
| 6355 | else | 6377 | else |