From fdbbbf94a5ed233571478d94c812644bdfaeb600 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 20 Jun 2019 12:12:01 +0900 Subject: [PATCH] Change font_put_extra value for property removal from Qnil to Qunbound * font.c (font_put_extra): If VAL is Qunbound, delete the slot for PROP from the list of extra properties. Previous value Qnil is valid as boolean. (font_clear_prop): Changed argument of font_put_extra for property removal. --- src/font.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/font.c b/src/font.c index 964028ccf00..992f9e03fea 100644 --- a/src/font.c +++ b/src/font.c @@ -710,7 +710,9 @@ font_prop_validate (int idx, Lisp_Object prop, Lisp_Object val) /* Store VAL as a value of extra font property PROP in FONT while - keeping the sorting order. Don't check the validity of VAL. */ + keeping the sorting order. Don't check the validity of VAL. If + VAL is Qunbound, delete the slot for PROP from the list of extra + properties. */ Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val) @@ -722,6 +724,8 @@ font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val) { Lisp_Object prev = Qnil; + if (EQ (val, Qunbound)) + return val; while (CONSP (extra) && NILP (Fstring_lessp (prop, XCAR (XCAR (extra))))) prev = extra, extra = XCDR (extra); @@ -734,7 +738,7 @@ font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val) return val; } XSETCDR (slot, val); - if (NILP (val)) + if (EQ (val, Qunbound)) ASET (font, FONT_EXTRA_INDEX, Fdelq (slot, extra)); return val; } @@ -3055,7 +3059,7 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop) if (! NILP (Ffont_get (font, QCname))) { font = copy_font_spec (font); - font_put_extra (font, QCname, Qnil); + font_put_extra (font, QCname, Qunbound); } if (NILP (AREF (font, prop)) -- 2.39.2