Mercurial > emacs
comparison src/data.c @ 54627:532e0d3d8fc1
(Finteractive_form): Rename from Fsubr_interactive_form.
Extend to handle all kinds of functions.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 29 Mar 2004 00:48:32 +0000 |
parents | 26dc8943ee64 |
children | 122a60d4f165 |
comparison
equal
deleted
inserted
replaced
54626:8bcf0c459630 | 54627:532e0d3d8fc1 |
---|---|
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. |
6 | 6 |
7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
759 return Fcons (make_number (minargs), Qunevalled); | 759 return Fcons (make_number (minargs), Qunevalled); |
760 else | 760 else |
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 |
778 | 800 |
779 /*********************************************************************** | 801 /*********************************************************************** |
3207 staticpro (&Qchar_table); | 3229 staticpro (&Qchar_table); |
3208 staticpro (&Qbool_vector); | 3230 staticpro (&Qbool_vector); |
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); |
3216 defsubr (&Slistp); | 3238 defsubr (&Slistp); |
3217 defsubr (&Snlistp); | 3239 defsubr (&Snlistp); |