changeset 45682:b9f2c8b7c60e

(lookup_char_property): New function for looking up overlay and text properties, created from textget. (textget): Use it.
author Colin Walters <walters@gnu.org>
date Sat, 08 Jun 2002 20:25:17 +0000
parents 322be4c4e11d
children 9e40bb8e9a60
files src/intervals.c
diffstat 1 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/intervals.c	Sat Jun 08 20:24:55 2002 +0000
+++ b/src/intervals.c	Sat Jun 08 20:25:17 2002 +0000
@@ -1813,8 +1813,16 @@
      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 @@
 
   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;
 }