From: Eshel Yaron Date: Wed, 11 Jun 2025 18:57:03 +0000 (+0200) Subject: scope.el: Fix tooltip help for local variables X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f7dc00c05a235ea1a14fdf714c8e941df6ff584f;p=emacs.git scope.el: Fix tooltip help for local variables --- diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el index 78aee4faed0..fb9f2557597 100644 --- a/lisp/emacs-lisp/scope.el +++ b/lisp/emacs-lisp/scope.el @@ -121,14 +121,18 @@ (scope-define-symbol-type variable () :doc "Variable names." :face 'elisp-free-variable - :help (lambda (beg end _def) - (if-let ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (let ((val (if (boundp sym) (truncate-string-to-width (prin1-to-string (symbol-value sym)) 60 nil nil t) "#"))) - (if-let ((doc (documentation-property sym 'variable-documentation t))) - (format "Special variable `%S'.\n\nValue: %s\n\n%s" sym val doc) - (format "Special variable `%S'.\n\nValue: %s" sym val)))) - "Special variable")) + :help (lambda (beg end def) + (cond + ((equal beg def) "Local variable definition") + (def "Local variable") + (t + (if-let ((sym (intern (buffer-substring-no-properties beg end)))) + (lambda (&rest _) + (let ((val (if (boundp sym) (truncate-string-to-width (prin1-to-string (symbol-value sym)) 60 nil nil t) "#"))) + (if-let ((doc (documentation-property sym 'variable-documentation t))) + (format "Special variable `%S'.\n\nValue: %s\n\n%s" sym val doc) + (format "Special variable `%S'.\n\nValue: %s" sym val)))) + "Special variable")))) :completion (lambda () (let ((local-vars (elisp-local-variables))) (lambda (sym) (or (elisp--shorthand-aware-boundp sym)