Function: helpful--propertize-sym-ref
helpful--propertize-sym-ref is a byte-compiled function defined in
helpful.el.
Signature
(helpful--propertize-sym-ref SYM-NAME BEFORE-TXT AFTER-TXT)
Documentation
Given a symbol name from a docstring, convert to a button (if bound) or else highlight.
Source Code
;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--propertize-sym-ref (sym-name before-txt after-txt)
"Given a symbol name from a docstring, convert to a button (if
bound) or else highlight."
(let* ((sym (intern sym-name)))
(cond
;; Highlight keywords.
((s-matches-p
(rx ":"
symbol-start
(+? (or (syntax word) (syntax symbol)))
symbol-end)
sym-name)
(propertize sym-name
'face 'font-lock-builtin-face))
((and (boundp sym) (s-ends-with-p "variable " (downcase before-txt)))
(helpful--button
sym-name
'helpful-describe-exactly-button
'symbol sym
'callable-p nil))
((and (fboundp sym)
(or
(s-starts-with-p " command" (downcase after-txt))
(s-ends-with-p "command " (downcase before-txt))
(s-ends-with-p "function " (downcase before-txt))))
(helpful--button
sym-name
'helpful-describe-exactly-button
'symbol sym
'callable-p t))
;; Only create a link if this is a symbol that is bound as a
;; variable or callable.
((or (boundp sym) (fboundp sym))
(helpful--button
sym-name
'helpful-describe-button
'symbol sym))
;; If this is already a button, don't modify it.
((get-text-property 0 'button sym-name)
sym-name)
;; Highlight the quoted string.
(t
(propertize sym-name
'face 'font-lock-constant-face)))))