Function: documentation
documentation is a function defined in doc.c.
Signature
(documentation FUNCTION &optional RAW)
Documentation
Return the documentation string of FUNCTION.
Unless a non-nil second argument RAW is given, the
string is passed through substitute-command-keys.
Probably introduced at or before Emacs version 21.1.
Source Code
// Defined in /usr/src/emacs/src/doc.c
{
Lisp_Object doc;
bool try_reload = documentation_dynamic_reload;
retry:
doc = Qnil;
if (SYMBOLP (function))
{
Lisp_Object tem = Fget (function, Qfunction_documentation);
if (!NILP (tem))
return Fdocumentation_property (function, Qfunction_documentation,
raw);
}
Lisp_Object fun = Findirect_function (function, Qnil);
if (NILP (fun))
xsignal1 (Qvoid_function, function);
if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
fun = XCDR (fun);
doc = calln (Qfunction_documentation, fun);
/* If DOC is 0, it's typically because of a dumped file missing
from the DOC file (bug in src/Makefile.in). */
if (BASE_EQ (doc, make_fixnum (0)))
doc = Qnil;
if (FIXNUMP (doc) || (CONSP (doc) && FIXNUMP (XCDR (doc))))
{
Lisp_Object tem = get_doc_string (doc, 0);
if (NILP (tem) && try_reload)
{
/* The file is newer, we need to reset the pointers. */
reread_doc_file (Fcar_safe (doc));
try_reload = false;
goto retry;
}
doc = tem;
}
if (NILP (raw))
doc = calln (Qsubstitute_command_keys, doc);
return doc;
}