In SBCL, I can get the documentation string for a function with something like this:
(documentation #'mapcar t)
However, I don't understand how to get the documentation string for a macro. For example, given the macro:
(defmacro with-lines-in-file ((line filename) &body body)
"Runs body for each line in the file specified by filename."
(let ((file (gensym)))
`(with-open-file (,file ,filename)
(do ((,line (read-line ,file nil) (read-line ,file nil)))
((null ,line) nil)
,@body))))
I'm not able to retrieve the documentation string. I don't understand the CLHS. As you can see below, the CLHS worked great for obtaining the documentation string for a function.
documentation (x function) (doc-type (eql 't))
However, the bit for obtaining the documentation string from a macro doesn't seem to work for me:
documentation (x symbol) (doc-type (eql 'compiler-macro))
In the context of my macro, I'm interpreting the above CLHS bit to mean this:
(documentation 'with-lines-in-file 'compiler-macro)
But that call returns NIL.
I'm trying to build a function that creates the README.md file for the Common Lisp packages that I plan to share on GitHub. Here's an example: https://github.com/macnod/dc-utilities. I've written a post about this here: https://donnieknows.com/documenting-common-lisp-for-github/.
(documentation ... 'function)
. – Bainbridge