Function: widget-documentation-string-value-create
widget-documentation-string-value-create is a byte-compiled function
defined in wid-edit.el.gz.
Signature
(widget-documentation-string-value-create WIDGET)
Source Code
;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-documentation-string-value-create (widget)
;; Insert documentation string.
(let ((doc (substitute-command-keys (widget-value widget)))
(indent (widget-get widget :indent))
(shown (widget-get (widget-get widget :parent) :documentation-shown))
(start (point)))
(if (string-match "\n" doc)
(let ((before (substring doc 0 (match-beginning 0)))
(after (substring doc (match-end 0)))
button end)
(widget-documentation-string-indent-to indent)
(insert before ?\s)
(widget-documentation-link-add widget start (point))
(setq button
(widget-create-child-and-convert
widget (widget-get widget :visibility-widget)
:help-echo "Show or hide rest of the documentation."
:on "Hide"
:off "More"
:always-active t
:action 'widget-parent-action
shown))
(when shown
(insert ?\n)
(setq start (point))
(when (and indent (not (zerop indent)))
(insert-char ?\s indent))
(insert after)
(setq end (point))
(widget-documentation-link-add widget start end)
;; Indent the subsequent lines.
(when (and indent (> indent 0))
(save-excursion
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(while (search-forward "\n" nil t)
(widget-documentation-string-indent-to indent))))))
(widget-put widget :buttons (list button)))
(widget-documentation-string-indent-to indent)
(insert doc)
(widget-documentation-link-add widget start (point))))
(insert ?\n))