Function: elisp-refs--search-1
elisp-refs--search-1 is a byte-compiled function defined in
elisp-refs.el.
Signature
(elisp-refs--search-1 BUFS MATCH-FN)
Documentation
Call MATCH-FN on each buffer in BUFS, reporting progress and accumulating results.
BUFS should be disposable: we make no effort to preserve their state during searching.
MATCH-FN should return a list where each element takes the form:
(form start-pos end-pos).
Source Code
;; Defined in ~/.emacs.d/elpa/elisp-refs-20230920.201/elisp-refs.el
(defun elisp-refs--search-1 (bufs match-fn)
"Call MATCH-FN on each buffer in BUFS, reporting progress
and accumulating results.
BUFS should be disposable: we make no effort to preserve their
state during searching.
MATCH-FN should return a list where each element takes the form:
\(form start-pos end-pos)."
(let* (;; Our benchmark suggests we spend a lot of time in GC, and
;; performance improves if we GC less frequently.
(gc-cons-percentage 0.8)
(total-bufs (length bufs)))
(let ((searched 0)
(forms-and-bufs nil))
(dolist (buf bufs)
(let* ((matching-forms (funcall match-fn buf)))
;; If there were any matches in this buffer, push the
;; matches along with the buffer into our results
;; list.
(when matching-forms
(push (cons matching-forms buf) forms-and-bufs))
;; Give feedback to the user on our progress, because
;; searching takes several seconds.
(when (and (zerop (mod searched 10))
elisp-refs-verbose)
(message "Searched %s/%s files" searched total-bufs))
(cl-incf searched)))
(when elisp-refs-verbose
(message "Searched %s/%s files" total-bufs total-bufs))
forms-and-bufs)))