Function: elisp-eldoc-var-docstring-with-value
elisp-eldoc-var-docstring-with-value is a byte-compiled function
defined in elisp-mode.el.gz.
Signature
(elisp-eldoc-var-docstring-with-value CALLBACK &rest _)
Documentation
Document variable at point by calling CALLBACK.
Intended for eldoc-documentation-functions (which see).
Compared to elisp-eldoc-var-docstring, this also includes the
current variable value and a bigger chunk of the docstring.
Probably introduced at or before Emacs version 29.1.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp-eldoc-var-docstring-with-value (callback &rest _)
"Document variable at point by calling CALLBACK.
Intended for `eldoc-documentation-functions' (which see).
Compared to `elisp-eldoc-var-docstring', this also includes the
current variable value and a bigger chunk of the docstring."
(when-let* ((cs (elisp--current-symbol)))
(when (and (boundp cs)
;; nil and t are boundp!
(not (null cs))
(not (eq cs t)))
(funcall callback
(format "%.100S %s"
(symbol-value cs)
(let* ((doc (documentation-property
cs 'variable-documentation t))
(more (- (length doc) elisp-eldoc-docstring-length-limit)))
(concat (propertize
(string-limit (if (string= doc "nil")
"Undocumented."
doc)
elisp-eldoc-docstring-length-limit)
'face 'font-lock-doc-face)
(when (> more 0)
(format "[%sc more]" more)))))
:thing cs
:face 'font-lock-variable-name-face))))