GNU bug report logs -
#55096
Eldoc showing elisp variable value beside docs
Previous Next
Reported by: emacsq <laszlomail <at> protonmail.com>
Date: Sun, 24 Apr 2022 18:25:01 UTC
Severity: normal
Tags: moreinfo
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Mon, 25 Apr 2022 10:09:39 +0200
Lars Ingebrigtsen wrote:
> emacsq <laszlomail <at> protonmail.com> writes:
>
>> Eldoc showing the docs in the minibuffer is quite useful, but I often
>> check elisp variable values too in the code, and it can be quite handy
>> if eldoc shows that too simply by putting cursor on the variable.
>
> This would only work for global values, and in that case, you can just
> `C-x C-e' the variable if you're interested in the value.
>
> So it seems like this would be of marginal utility. Anybody else got an
> opinion here?
FWIW, I've been running with some form of the following for many years,
and I find it extremely useful:
;; cf. `elisp-eldoc-var-docstring'
(defun my-elisp-eldoc-var-docstring-with-value (callback &rest _)
"Document variable at point.
Intended for `eldoc-documentation-functions' (which see)."
(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 "%.1250S %s"
(symbol-value cs)
(let* ((doc (custom-variable-documentation cs))
(more (- (length doc) 1000)))
(concat (propertize
(s-truncate 1000
(if (string= doc "nil")
"Undocumented."
doc)
"")
'face 'font-lock-doc-face)
(when (> more 0)
(format "[%sc more]" more)))))
:thing cs
:face 'font-lock-variable-name-face))))
It shows the current value, i.e. buffer-local for local variables, which
is what I want. (It also shows more of the doc string: I use multi-line
echo area.)
--
Štěpán
This bug report was last modified 3 years and 84 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.