From 948fe32d3941da4258aa6b2edce62d4ef43c9b78 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 8 Jun 2002 20:25:17 +0000 Subject: [PATCH] (lookup_char_property): New function for looking up overlay and text properties, created from textget. (textget): Use it. --- src/intervals.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/intervals.c b/src/intervals.c index 2aaaad14e70..11a8eccfdfe 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1813,8 +1813,16 @@ textget (plist, prop) Lisp_Object plist; register Lisp_Object prop; { - register Lisp_Object tail, fallback; - fallback = Qnil; + lookup_char_property (plist, prop, 1); +} + +Lisp_Object +lookup_char_property (plist, prop, textprop) + Lisp_Object plist; + register Lisp_Object prop; + int textprop; +{ + register Lisp_Object tail, fallback = Qnil; for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) { @@ -1832,9 +1840,20 @@ textget (plist, prop) if (! NILP (fallback)) return fallback; - if (CONSP (Vdefault_text_properties)) - return Fplist_get (Vdefault_text_properties, prop); - return Qnil; + /* Check for alternative properties */ + tail = Fassq (prop, Vchar_property_alias_alist); + if (NILP (tail)) + return tail; + tail = XCDR (tail); + for (; NILP (fallback) && !NILP (tail); tail = XCDR (tail)) + { + if (!CONSP (tail)) + wrong_type_argument (Qlistp, tail); + fallback = Fplist_get (plist, XCAR (tail)); + } + if (textprop && NILP (fallback) && CONSP (Vdefault_text_properties)) + fallback = Fplist_get (Vdefault_text_properties, prop); + return fallback; } -- 2.39.5