From 82323253378c310c71cfea393d228321d1fc51f4 Mon Sep 17 00:00:00 2001 From: Jimmy Aguilar Mena Date: Fri, 8 Nov 2019 09:31:33 +0100 Subject: [PATCH] Handle case where a face's :extend attribute is unspecified (Bug#37774) * src/xfaces.c (merge_face_vectors, merge_named_face): Handle case where the :extend attribute's value is 'unspecified' (Bug#37774). --- src/xfaces.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/xfaces.c b/src/xfaces.c index 3806fa90e23..67fa9e24b86 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2062,8 +2062,13 @@ merge_face_vectors (struct window *w, struct frame *f, eassert (attr_filter < LFACE_VECTOR_SIZE); - /* When FROM sets attr_filter to nil explicitly we don't merge it. */ - if (attr_filter > 0 && NILP(from[attr_filter])) + /* When FROM sets attr_filter explicitly to nil or unspecified + without inheriting don't merge it. */ + if (attr_filter > 0 + && (NILP(from[attr_filter]) + || (UNSPECIFIEDP(from[attr_filter]) + && (NILP (from[LFACE_INHERIT_INDEX]) + || UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]))))) return; /* If FROM inherits from some other faces, merge their attributes into @@ -2082,7 +2087,7 @@ merge_face_vectors (struct window *w, struct frame *f, else if (UNSPECIFIEDP (from[attr_filter])) /* FROM don't specify filter */ { Lisp_Object tmp[LFACE_VECTOR_SIZE]; - memcpy (tmp, to, LFACE_VECTOR_SIZE * sizeof *tmp); + memcpy (tmp, to, LFACE_VECTOR_SIZE * sizeof(*tmp)); merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], tmp, false, named_merge_points, attr_filter); @@ -2177,7 +2182,8 @@ merge_named_face (struct window *w, && !UNSPECIFIEDP(from[attr_filter])) || (!NILP(from[attr_filter]) /* Filter, unspecified, but inherited. */ && UNSPECIFIEDP(from[attr_filter]) - && !NILP (from[LFACE_INHERIT_INDEX])))) + && !NILP (from[LFACE_INHERIT_INDEX]) + && !UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])))) merge_face_vectors (w, f, from, to, named_merge_points, attr_filter); return ok; -- 2.39.2