GNU bug report logs - #55096
Eldoc showing elisp variable value beside docs

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55096 in the body.
You can then email your comments to 55096 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55096; Package emacs. (Sun, 24 Apr 2022 18:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to emacsq <laszlomail <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 24 Apr 2022 18:25:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: emacsq <laszlomail <at> protonmail.com>
To: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
Subject: Eldoc showing elisp variable value beside docs
Date: Sun, 24 Apr 2022 18:24:36 +0000
[Message part 1 (text/plain, inline)]
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.

So for variables the value too can be shown after the docs. In case of primitive values it's quite simple, if there is a local value then it can show the local value first and then the global one.

In case of complex values the full value may be too big to display, but the beginning of it can still be shown, truncated after, say, 30 chars. It is still useful if, for example, a variable can be nil and also a list. Then you can see at a glance if it has a value set.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55096; Package emacs. (Mon, 25 Apr 2022 08:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 55096 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: emacsq <laszlomail <at> protonmail.com>
Cc: 55096 <at> debbugs.gnu.org
Subject: Re: bug#55096: Eldoc showing elisp variable value beside docs
Date: Mon, 25 Apr 2022 10:09:39 +0200
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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 25 Apr 2022 08:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55096; Package emacs. (Mon, 25 Apr 2022 11:01:01 GMT) Full text and rfc822 format available.

Message #13 received at 55096 <at> debbugs.gnu.org (full text, mbox):

From: Štěpán Němec <stepnem <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55096 <at> debbugs.gnu.org, emacsq <laszlomail <at> protonmail.com>
Subject: Re: bug#55096: Eldoc showing elisp variable value beside docs
Date: Mon, 25 Apr 2022 13:00:33 +0200
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55096; Package emacs. (Tue, 24 May 2022 12:51:02 GMT) Full text and rfc822 format available.

Message #16 received at 55096 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Štěpán Němec <stepnem <at> gmail.com>
Cc: 55096 <at> debbugs.gnu.org, emacsq <laszlomail <at> protonmail.com>
Subject: Re: bug#55096: Eldoc showing elisp variable value beside docs
Date: Tue, 24 May 2022 14:50:13 +0200
Štěpán Němec <stepnem <at> gmail.com> writes:

>> 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:

Well, that means that there are at least two people who would like this,
so I've added Štěpán's function to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 55096 <at> debbugs.gnu.org and emacsq <laszlomail <at> protonmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 24 May 2022 12:51:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 22 Jun 2022 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.