user_doc, line break?




On Tue, 14 Jul 2009, Martin Sch?necker wrote:

< The prompt is late:
< 
< (%i47) user_doc("foo");
< "asdf
< 
< fdsa";
< Enter documentation string surrounded by quotes '"'. End input with ';'.
< (%o47) foo
< 
< maxima-userinfo.lisp contains the following:
< 
< (setf (gethash "foo" cl-info::*info-user-doc-hashtable*) '("asdffdsa
< 
< Created: 2009-07-14 21:02:54+01:00" nil nil "user-documentation"))
< 
< 
< How can I escape the cr?  That would be a nice possibility to enter the
< documentation string with the long version user_doc("fun", "description").
< However, I found only newline() and freshline() which does not seem to work to
< construct a string.
 
Ok, I believe that wxmaxima parses in/output slightly differently from
the cl-maxima. See
http://www.math.utexas.edu/pipermail/maxima/2009/016536.html
In particular, it appears to treat newlines as whitespace. Without
knowing wxmaxima, I would speculate that if you precede a newline with a
backslash \, then this problem will disappear.

A guaranteed workaround is to define the doc string and pass it as
the second argument to user_doc (see below). If wxmaxima continues to
cause problems, you can concatenate lines and newlines with 'concat'.


Leo

(%i2) foo_str : "
  -- foo ()

  See bar.";
(%o2) "\
  -- foo ()\
\
  See bar."
(%i3) user_doc("foo",foo_str);
(%o3) "foo"
(%i4) ? foo


  -- foo ()

  See bar.

Created: 2009-07-14 20:28:27+01:00

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.