(Finteractive_form): Use a `interactive-form' property if
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 25 Jul 2007 06:24:58 +0000 (06:24 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 25 Jul 2007 06:24:58 +0000 (06:24 +0000)
present, analogous to the function-documentation property.

etc/NEWS
src/ChangeLog
src/data.c

index 8984259..da71e30 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -204,6 +204,10 @@ remote connection has been established already.
 ** The two new functions `looking-at-p' and `string-match-p' can do
 the same matching as `looking-at' and `string-match' without changing
 the match data.
+
+** The interactive-form of a function can be added post-facto via the
+`interactive-form' symbol property.  Mostly useful to add complex interactive
+forms to subroutines.
 \f
 * New Packages for Lisp Programming in Emacs 23.1
 
index ac6b24a..bfdf9ab 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * data.c (Finteractive_form): Use a `interactive-form' property if
+       present, analogous to the function-documentation property.
+
 2007-07-22  Nick Roberts  <nickrob@snap.net.nz>
 
        * xdisp.c (decode_mode_spec): Add case 'R' for to test for
index 0b3be2f..f705aa5 100644 (file)
@@ -751,8 +751,14 @@ Value, if non-nil, is a list \(interactive SPEC).  */)
      Lisp_Object cmd;
 {
   Lisp_Object fun = indirect_function (cmd);
-
-  if (SUBRP (fun))
+  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))
     {
       if (XSUBR (fun)->prompt)
        return list2 (Qinteractive, build_string (XSUBR (fun)->prompt));