From: Colin Walters Date: Sat, 8 Jun 2002 20:25:17 +0000 (+0000) Subject: (lookup_char_property): New function for looking up overlay and text X-Git-Tag: ttn-vms-21-2-B4~14733 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=948fe32d3941da4258aa6b2edce62d4ef43c9b78;p=emacs.git (lookup_char_property): New function for looking up overlay and text properties, created from textget. (textget): Use it. --- 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; }