;; If the regexp search didn't find the location of
;; the symbol (for example, because it is generated by
;; a macro), try a slightly more expensive search that
- ;; expands macros until it finds the symbol.
+ ;; expands macros until it finds the symbol. Since
+ ;; macro-expansion involves arbitrary code execution,
+ ;; only attempt it in trusted buffers.
(cons (current-buffer)
- (find-function--search-by-expanding-macros
- (current-buffer) symbol type))))))))))
+ (when (trusted-content-p)
+ (find-function--search-by-expanding-macros
+ (current-buffer) symbol type)))))))))))
(defun find-function--try-macroexpand (form)
"Try to macroexpand FORM in full or partially.