changeset 82103:fac8f5421213

(Finteractive_form): Use a `interactive-form' property if present, analogous to the function-documentation property.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Jul 2007 06:24:58 +0000
parents 5b55db78e6d8
children efca9e4cc112
files etc/NEWS src/ChangeLog src/data.c
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Wed Jul 25 04:32:23 2007 +0000
+++ b/etc/NEWS	Wed Jul 25 06:24:58 2007 +0000
@@ -204,6 +204,10 @@
 ** 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.
 
 * New Packages for Lisp Programming in Emacs 23.1
 
--- a/src/ChangeLog	Wed Jul 25 04:32:23 2007 +0000
+++ b/src/ChangeLog	Wed Jul 25 06:24:58 2007 +0000
@@ -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
--- a/src/data.c	Wed Jul 25 04:32:23 2007 +0000
+++ b/src/data.c	Wed Jul 25 06:24:58 2007 +0000
@@ -751,8 +751,14 @@
      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));