help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Defun Self Documentation


From: Drew Adams
Subject: RE: Defun Self Documentation
Date: Thu, 5 Nov 2020 08:07:28 -0800 (PST)

> When using defun, can one include a Self Documenting string or is
> Self-Documentation only applicable for interactive functions?
> 
> (defun Gdn ()
>    "Description"
>    Body ...
> )

Ask Emacs: `C-h f defun'.

,----
| defun is a Lisp macro in ‘byte-run.el’.
| 
| (defun NAME ARGLIST &optional DOCSTRING DECL &rest BODY)
                                ^^^^^^^^^
| 
| Define NAME as a function.
| The definition is (lambda ARGLIST [DOCSTRING] BODY...).
| See also the function ‘interactive’.
| DECL is a declaration, optional, of the form (declare DECLS...) where
| DECLS is a list of elements of the form (PROP . VALUES).  These are
| interpreted according to ‘defun-declarations-alist’.
| The return value is undefined.
`----

That doesn't explicitly tell you that DOCSTRING is the
doc string _for the function_ you're defining, but one
might guess that.

1. `C-h i m elisp', to visit the Elisp manual.
2. `i defun', to go to the doc about `defun'.

There you see this, about the optional doc-string arg:

 DOC, if present, should be a string specifying the function’s
                                                ^^^^^^^^^^^^^^
 documentation string (*note Function Documentation::).
___


Ask Emacs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]