Function: function-documentation
function-documentation is a byte-compiled function defined in
simple.el.gz.
Signature
(function-documentation FUNCTION)
Documentation
Extract the raw docstring info from FUNCTION.
FUNCTION is expected to be a function value rather than, say, a mere symbol.
This is intended to be specialized via cl-defmethod but not called directly:
if you need a function's documentation use documentation which will call this
function as needed.
Probably introduced at or before Emacs version 21.1.
Implementations
(function-documentation (F cconv--interactive-helper)) in `simple.el'.
Undocumented
(function-documentation (FUNCTION accessor)) in `simple.el'.
Undocumented
(function-documentation FUNCTION) in `simple.el'.
Undocumented
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(cl-defgeneric function-documentation (function)
"Extract the raw docstring info from FUNCTION.
FUNCTION is expected to be a function value rather than, say, a mere symbol.
This is intended to be specialized via `cl-defmethod' but not called directly:
if you need a function's documentation use `documentation' which will call this
function as needed."
(let ((docstring-p (lambda (doc)
;; A docstring can be either a string or a reference
;; into either the `etc/DOC' or a `.elc' file.
(or (stringp doc)
(fixnump doc) (fixnump (cdr-safe doc))))))
(pcase function
((pred closurep)
(when (> (length function) 4)
(let ((doc (aref function 4)))
(when (funcall docstring-p doc) doc))))
((or (pred stringp) (pred vectorp)) "Keyboard macro.")
(`(keymap . ,_)
"Prefix command (definition is a keymap associating keystrokes with commands).")
((or `(lambda ,_args . ,body) `(autoload ,_file . ,body))
(let ((doc (car body)))
(when (funcall docstring-p doc)
doc)))
((pred symbolp)
(let ((f (indirect-function function)))
(if f (function-documentation f)
(signal 'void-function (list function)))))
(`(macro . ,f) (function-documentation f))
(_
(let ((doc (internal-subr-documentation function)))
(if (eq t doc)
(signal 'invalid-function (list function))
doc))))))