aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorStefan Monnier2004-03-29 00:48:32 +0000
committerStefan Monnier2004-03-29 00:48:32 +0000
commitf52a3ca37efff8a5667233b40de835ae3164f980 (patch)
tree11c1989987ce8c86aeb437c9ba352e1aca4314f8 /src/data.c
parenta21aa1650a4a5ebd8ac6459328a810c837aa642e (diff)
downloademacs-f52a3ca37efff8a5667233b40de835ae3164f980.tar.gz
emacs-f52a3ca37efff8a5667233b40de835ae3164f980.zip
(Finteractive_form): Rename from Fsubr_interactive_form.
Extend to handle all kinds of functions.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/src/data.c b/src/data.c
index bff2baaed27..e10d7b4fd1d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
1/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter. 1/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985,86,88,93,94,95,97,98,99, 2000, 2001, 2003 2 Copyright (C) 1985,86,88,93,94,95,97,98,99, 2000, 2001, 03, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -761,17 +761,39 @@ function with `&rest' args, or `unevalled' for a special form. */)
761 return Fcons (make_number (minargs), make_number (maxargs)); 761 return Fcons (make_number (minargs), make_number (maxargs));
762} 762}
763 763
764DEFUN ("subr-interactive-form", Fsubr_interactive_form, Ssubr_interactive_form, 1, 1, 0, 764DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0,
765 doc: /* Return the interactive form of SUBR or nil if none. 765 doc: /* Return the interactive form of CMD or nil if none.
766SUBR must be a built-in function. Value, if non-nil, is a list 766CMD must be a command. Value, if non-nil, is a list
767\(interactive SPEC). */) 767\(interactive SPEC). */)
768 (subr) 768 (cmd)
769 Lisp_Object subr; 769 Lisp_Object cmd;
770{ 770{
771 if (!SUBRP (subr)) 771 Lisp_Object fun = indirect_function (cmd);
772 wrong_type_argument (Qsubrp, subr); 772
773 if (XSUBR (subr)->prompt) 773 if (SUBRP (fun))
774 return list2 (Qinteractive, build_string (XSUBR (subr)->prompt)); 774 {
775 if (XSUBR (fun)->prompt)
776 return list2 (Qinteractive, build_string (XSUBR (fun)->prompt));
777 }
778 else if (COMPILEDP (fun))
779 {
780 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE)
781 return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE));
782 }
783 else if (CONSP (fun))
784 {
785 Lisp_Object funcar = XCAR (fun);
786 if (EQ (funcar, Qlambda))
787 return Fassq (Qinteractive, Fcdr (XCDR (fun)));
788 else if (EQ (funcar, Qautoload))
789 {
790 struct gcpro gcpro1;
791 GCPRO1 (cmd);
792 do_autoload (fun, cmd);
793 UNGCPRO;
794 return Finteractive_form (cmd);
795 }
796 }
775 return Qnil; 797 return Qnil;
776} 798}
777 799
@@ -3209,7 +3231,7 @@ syms_of_data ()
3209 staticpro (&Qhash_table); 3231 staticpro (&Qhash_table);
3210 3232
3211 defsubr (&Sindirect_variable); 3233 defsubr (&Sindirect_variable);
3212 defsubr (&Ssubr_interactive_form); 3234 defsubr (&Sinteractive_form);
3213 defsubr (&Seq); 3235 defsubr (&Seq);
3214 defsubr (&Snull); 3236 defsubr (&Snull);
3215 defsubr (&Stype_of); 3237 defsubr (&Stype_of);