diff src/data.c @ 82112:dd8905ab6eaa

(Finteractive_form): Check for the presence of an `interactive-form' symbol property more thoroughly.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Jul 2007 21:03:24 +0000
parents fac8f5421213
children b98604865ea0
line wrap: on
line diff
--- a/src/data.c	Wed Jul 25 19:37:21 2007 +0000
+++ b/src/data.c	Wed Jul 25 21:03:24 2007 +0000
@@ -750,15 +750,24 @@
      (cmd)
      Lisp_Object cmd;
 {
-  Lisp_Object fun = indirect_function (cmd);
-  Lisp_Object tmp;
-
-  if (SYMBOLP (cmd)
-      /* Use an `interactive-form' property if present, analogous to the
-	 function-documentation property. */
-      && (tmp = Fget (cmd, intern ("interactive-form")), !NILP (tmp)))
-    return tmp;
-  else if (SUBRP (fun))
+  Lisp_Object fun = indirect_function (cmd); /* Check cycles.  */
+  
+  if (NILP (fun) || EQ (fun, Qunbound))
+    return Qnil;
+
+  /* Use an `interactive-form' property if present, analogous to the
+     function-documentation property. */
+  fun = cmd;
+  while (SYMBOLP (fun))
+    {
+      Lisp_Object tmp = Fget (fun, intern ("interactive-form"));
+      if (!NILP (tmp))
+	return tmp;
+      else
+	fun = Fsymbol_function (fun);
+    }
+
+  if (SUBRP (fun))
     {
       if (XSUBR (fun)->prompt)
 	return list2 (Qinteractive, build_string (XSUBR (fun)->prompt));