Function: xref--collect-matches
xref--collect-matches is a byte-compiled function defined in
xref.el.gz.
Signature
(xref--collect-matches HIT REGEXP TMP-BUFFER REMOTE-ID SYNTAX-NEEDED)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
(defun xref--collect-matches (hit regexp tmp-buffer remote-id syntax-needed)
(pcase-let* ((`(,line ,file ,text) hit)
(file (and file (concat remote-id file)))
(buf (xref--find-file-buffer file))
(inhibit-modification-hooks t))
(if buf
(with-current-buffer buf
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(forward-line (1- line))
(xref--collect-matches-1 regexp file line
(line-beginning-position)
(line-end-position)
syntax-needed))))
;; Using the temporary buffer is both a performance and a buffer
;; management optimization.
(with-current-buffer tmp-buffer
(erase-buffer)
(when (and syntax-needed
(not (equal file xref--temp-buffer-file-name)))
(insert-file-contents file nil 0 200)
;; Can't (setq-local delay-mode-hooks t) because of
;; bug#23272, but the performance penalty seems minimal.
(let ((buffer-file-name file)
(inhibit-message t)
message-log-max)
(ignore-errors
(set-auto-mode t)))
(setq-local xref--temp-buffer-file-name file)
(setq-local inhibit-read-only t)
(erase-buffer))
(insert text)
(goto-char (point-min))
(xref--collect-matches-1 regexp file line
(point)
(point-max)
syntax-needed)))))