(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) "#<unbound>")))
- (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) "#<unbound>")))
+ (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)