>>>>> "Richard" == Richard Fateman <fateman at gmail.com> writes:
Richard> On 8/13/2013 5:32 PM, Daniel Steinberg wrote:
>> In Maxima, the describe function can get documentation for some
>> function. For example, "describe(abs)" returns documentation on the
>> abs function. Is there any way to define documentation for
>> user-defined functions? For example, if I have a function "foo", is
>> there any way to define a doc string such that describe(foo) would
>> return that string?
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
Richard> I think it is not currently possible, but it would be very nice to have.
I agree.
Richard> The current documentation setup is unfortunately kept rather separate
Richard> from the code that is read into memory by load() or batch(). This is
Richard> partly a relic of an earlier time when memory was a scarce resource,
Richard> and partly that the processing of text is being done by other programs
Richard> in a batch operation... at least as far as I understand it. But
Richard> I haven't really tracked the various modifications of the routines.
Yes, that's basically it. But there is a git branch where all of the
parsing is done using Lisp.
Robert Dodier also added support so that other texinfo files can be
included. I think the intent there was so that share packages could
have texinfo documentation that would be automatically included in the
search that describe does. I don't remember exactly how this works,
though.
Richard> Here's a way one might handle what you've suggested...
Richard> have a command, say
Richard> document(name, "document string .... perhaps in html or TeX or ...");
Richard> that associates name with the documentation.
Richard> Add to describe(X) a preliminary search for document string(s)
Richard> associated with X,
Richard> and then access the reference manual.
I think this is a reasonable interface. Probably want to be sure to
clear the documentation if the function is redefined.
I've also wanted describe to return docstrings from internal maxima
Lisp functions.
Ray