Function: helpful--canonical-symbol
helpful--canonical-symbol is a byte-compiled function defined in
helpful.el.
Signature
(helpful--canonical-symbol SYM CALLABLE-P)
Documentation
If SYM is an alias, return the underlying symbol.
Return SYM otherwise.
Source Code
;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--canonical-symbol (sym callable-p)
"If SYM is an alias, return the underlying symbol.
Return SYM otherwise."
(let ((depth 0))
(if (and (symbolp sym) callable-p)
(progn
;; Follow the chain of symbols until we find a symbol that
;; isn't pointing to a symbol.
(while (and (symbolp (symbol-function sym))
(< depth 10))
(setq sym (symbol-function sym))
(setq depth (1+ depth)))
;; If this is an alias to a primitive, return the
;; primitive's symbol.
(when (subrp (symbol-function sym))
(setq sym (intern (subr-name (symbol-function sym))))))
(setq sym (indirect-variable sym))))
sym)