Change doc string summary of a function on the fly tells the whole story but maybe one point could do with a bit more emphasis: Emacs looks for documentation of the function foo
in two different places:
- The original doc-string in the definition of
foo
. This is available from elisp as (documentation 'foo t)
.
- The contents of the
function-documentation
property of the symbol foo
.
The second overrides the first when it is non-nil and the second is not initialised from the first. Thus
(defun foo ()
"Foo's original doc.")
(documentation 'foo t) ;=> "Foo's original doc."
(get 'foo 'function-documentation) ;=> nil
The OP wants to append to the original documentation so this will do the trick:
(put 'foo 'function-documentation
(concat
(documentation 'foo t)
"Line 1
Line 2"))
Thus use documentation
to pull out the original doc-string, concat
stuff to it and store the result in the function-documentation
property.