Function: helpful--find-by-macroexpanding
helpful--find-by-macroexpanding is a byte-compiled function defined in
helpful.el.
Signature
(helpful--find-by-macroexpanding BUF SYM CALLABLE-P)
Documentation
Search BUF for the definition of SYM by macroexpanding interesting forms in BUF.
Source Code
;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--find-by-macroexpanding (buf sym callable-p)
"Search BUF for the definition of SYM by macroexpanding
interesting forms in BUF."
(catch 'found
(with-current-buffer buf
(save-excursion
(goto-char (point-min))
(condition-case nil
(while t
(let ((form (read (current-buffer)))
(var-def-p
(lambda (sexp)
(and (eq (car-safe sexp) 'defvar)
(eq (car-safe (cdr sexp)) sym))))
(fn-def-p
(lambda (sexp)
;; `defun' ultimately expands to `defalias'.
(and (eq (car-safe sexp) 'defalias)
(equal (car-safe (cdr sexp)) `(quote ,sym))))))
(setq form (helpful--macroexpand-try form))
(when (helpful--tree-any-p
(if callable-p fn-def-p var-def-p)
form)
;; `read' puts point at the end of the form, so go
;; back to the start.
(throw 'found (scan-sexps (point) -1)))))
(end-of-file nil))))))