comparison src/symbols.c @ 5789:72c5d36ba3b6

Make `define-function' accept docstring, as in GNU Emacs. 2014-01-27 Michael Sperber <mike@xemacs.org> * symbols.c (Fdefine_function): Allow optional `docstring' argument, as in GNU Emacs. * lisp.h (Qfunction_documentation): Add extern declaration. * doc.c (Fdocumentation_property): Move before its use. (Fdocumentation): Retrieve documentation from `define-function' docstring for symbols.
author Mike Sperber <sperber@deinprogramm.de>
date Mon, 27 Jan 2014 17:50:57 +0100
parents 2014ff433daf
children
comparison
equal deleted inserted replaced
5788:6a6c89b53c5d 5789:72c5d36ba3b6
747 } 747 }
748 return newdef; 748 return newdef;
749 } 749 }
750 750
751 /* FSFmacs */ 751 /* FSFmacs */
752 DEFUN ("define-function", Fdefine_function, 2, 2, 0, /* 752 DEFUN ("define-function", Fdefine_function, 2, 3, 0, /*
753 Set SYMBOL's function definition to NEWDEF, and return NEWDEF. 753 Set SYMBOL's function definition to NEWDEF, and return NEWDEF.
754 Associates the function with the current load file, if any. 754 Associates the function with the current load file, if any.
755 If NEWDEF is a compiled-function object, stores the function name in 755 If NEWDEF is a compiled-function object, stores the function name in
756 the `annotated' slot of the compiled-function (retrievable using 756 the `annotated' slot of the compiled-function (retrievable using
757 `compiled-function-annotation'). 757 `compiled-function-annotation').
758 */ 758 */
759 (symbol, newdef)) 759 (symbol, newdef, docstring))
760 { 760 {
761 /* This function can GC */ 761 /* This function can GC */
762 Ffset (symbol, newdef); 762 Ffset (symbol, newdef);
763 LOADHIST_ATTACH (Fcons (Qdefun, symbol)); 763 LOADHIST_ATTACH (Fcons (Qdefun, symbol));
764 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK 764 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
765 if (COMPILED_FUNCTIONP (newdef)) 765 if (COMPILED_FUNCTIONP (newdef))
766 XCOMPILED_FUNCTION (newdef)->annotated = symbol; 766 XCOMPILED_FUNCTION (newdef)->annotated = symbol;
767 #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ 767 #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */
768
769 if (!NILP (docstring))
770 Fput (symbol, Qfunction_documentation, docstring);
771
768 return newdef; 772 return newdef;
769 } 773 }
770 774
771 DEFUN ("subr-name", Fsubr_name, 1, 1, 0, /* 775 DEFUN ("subr-name", Fsubr_name, 1, 1, 0, /*
772 Return name of function SUBR. 776 Return name of function SUBR.