Function: widget-docstring
widget-docstring is a byte-compiled function defined in
wid-edit.el.gz.
Signature
(widget-docstring WIDGET)
Documentation
Return the documentation string specified by WIDGET, or nil if none.
If WIDGET has a :doc property, that specifies the documentation string.
Otherwise, try the :documentation-property property. If this
is a function, call it with the widget's value as an argument; if
it is a symbol, use this symbol together with the widget's value
as the argument to documentation-property.
Source Code
;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-docstring (widget)
"Return the documentation string specified by WIDGET, or nil if none.
If WIDGET has a `:doc' property, that specifies the documentation string.
Otherwise, try the `:documentation-property' property. If this
is a function, call it with the widget's value as an argument; if
it is a symbol, use this symbol together with the widget's value
as the argument to `documentation-property'."
(let ((doc (or (widget-get widget :doc)
(let ((doc-prop (widget-get widget :documentation-property))
(value (widget-get widget :value)))
(cond ((functionp doc-prop)
(funcall doc-prop value))
((symbolp doc-prop)
(documentation-property value doc-prop t)))))))
(when (and (stringp doc) (> (length doc) 0))
;; Remove any redundant `*' in the beginning.
(when (eq (aref doc 0) ?*)
(setq doc (substring doc 1)))
;; Remove trailing newlines.
(when (string-match "\n+\\'" doc)
(setq doc (substring doc 0 (match-beginning 0))))
doc)))