>From 4f1bdeac06f0395441dad1ffa6db577aeaf81f75 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 7 Jul 2016 09:24:55 +0300 Subject: [PATCH 2/3] Simplify face_for_overlay_string and related users * src/xfaces.c (face_for_overlay_string): Remove 2nd and 3rd args, avoid call to Fnext_single_property_change because it's not actually required by the caller. * src/dispextern.h (face_for_overlay_string): Adjust prototype. * src/xdisp.c (handle_face_prop): The only user changed. --- src/dispextern.h | 3 +-- src/xdisp.c | 9 ++------- src/xfaces.c | 15 --------------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 922534f..bf44cd0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3438,8 +3438,7 @@ 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_for_overlay_string (struct window *, ptrdiff_t, ptrdiff_t *, ptrdiff_t, - bool, Lisp_Object); +int face_for_overlay_string (struct window *, ptrdiff_t, bool, Lisp_Object); int face_at_string_position (struct window *, Lisp_Object, ptrdiff_t, enum face_id, bool); int merge_faces (struct frame *, Lisp_Object, int, int); diff --git a/src/xdisp.c b/src/xdisp.c index f7db9de..790709e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3938,13 +3938,8 @@ handle_face_prop (struct it *it) /* For a string from an overlay, the base face depends only on text properties and ignores overlays. */ base_face_id - = face_for_overlay_string (it->w, - IT_CHARPOS (*it), - &next_stop, - (IT_CHARPOS (*it) - + TEXT_PROP_DISTANCE_LIMIT), - false, - from_overlay); + = face_for_overlay_string (it->w, IT_CHARPOS (*it), + false, from_overlay); else { /* For strings from a `display' property, use the face at diff --git a/src/xfaces.c b/src/xfaces.c index 6146ef5..41a45cf 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5981,34 +5981,21 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, int face_for_overlay_string (struct window *w, ptrdiff_t pos, - ptrdiff_t *endptr, ptrdiff_t limit, bool mouse, Lisp_Object overlay) { struct frame *f = XFRAME (w->frame); Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object prop, position; - ptrdiff_t endpos; Lisp_Object propname = mouse ? Qmouse_face : Qface; - Lisp_Object limit1, end; struct face *default_face; /* W must display the current buffer. We could write this function to use the frame and buffer of W, but right now it doesn't. */ - /* eassert (XBUFFER (w->contents) == current_buffer); */ - XSETFASTINT (position, pos); - endpos = ZV; - /* Get the `face' or `mouse_face' text property at POS, and determine the next position at which the property changes. */ prop = Fget_text_property (position, propname, w->contents); - XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); - end = Fnext_single_property_change (position, propname, w->contents, limit1); - if (INTEGERP (end)) - endpos = XINT (end); - - *endptr = endpos; /* Optimize common case where we can use the default face. */ if (NILP (prop) @@ -6023,8 +6010,6 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, if (!NILP (prop)) merge_face_ref (f, prop, attrs, true, 0); - *endptr = endpos; - /* Look up a realized face with the given face attributes, or realize a new one for ASCII characters. */ return lookup_face (f, attrs); -- 2.9.0