Function: cider-xref--references-in-file

cider-xref--references-in-file is a byte-compiled function defined in cider-xref-source.el.

Signature

(cider-xref--references-in-file FILE TARGET-NS NAME)

Documentation

Return xref match items for references to TARGET-NS/NAME in FILE.

A buffer opened solely to perform the scan is killed afterwards.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-xref-source.el
(defun cider-xref--references-in-file (file target-ns name)
  "Return xref match items for references to TARGET-NS/NAME in FILE.
A buffer opened solely to perform the scan is killed afterwards."
  (let* ((existing (find-buffer-visiting file))
         (buffer (or existing
                     ;; Suppress find-file hooks (font-lock, LSP, etc.) and the
                     ;; minibuffer chatter - we only need the buffer's text.
                     (let ((find-file-hook nil)
                           (inhibit-message t))
                       (find-file-noselect file t)))))
    (unwind-protect
        (with-current-buffer buffer
          (when-let* ((context (cider-xref--ns-context target-ns name))
                      (regexp (cider-xref--reference-regexp target-ns name context)))
            (cider-xref--scan-buffer
             regexp file
             (when-let* ((ns-beg (plist-get context :ns-beg)))
               (cons ns-beg (plist-get context :ns-end))))))
      (unless existing
        (kill-buffer buffer)))))