diff options
| author | Stefan Monnier | 2004-03-29 00:48:32 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-03-29 00:48:32 +0000 |
| commit | f52a3ca37efff8a5667233b40de835ae3164f980 (patch) | |
| tree | 11c1989987ce8c86aeb437c9ba352e1aca4314f8 /src | |
| parent | a21aa1650a4a5ebd8ac6459328a810c837aa642e (diff) | |
| download | emacs-f52a3ca37efff8a5667233b40de835ae3164f980.tar.gz emacs-f52a3ca37efff8a5667233b40de835ae3164f980.zip | |
(Finteractive_form): Rename from Fsubr_interactive_form.
Extend to handle all kinds of functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 44 |
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 | ||
| 5 | This file is part of GNU Emacs. | 5 | This 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 | ||
| 764 | DEFUN ("subr-interactive-form", Fsubr_interactive_form, Ssubr_interactive_form, 1, 1, 0, | 764 | DEFUN ("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. |
| 766 | SUBR must be a built-in function. Value, if non-nil, is a list | 766 | CMD 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); |