Function: projectile-replace--start

projectile-replace--start is a byte-compiled function defined in projectile.el.

Signature

(projectile-replace--start BUFFER CANDIDATES REGEXP ON-DONE)

Documentation

Fill BUFFER's match list by scanning CANDIDATES for REGEXP.

Cancels any in-flight scan in BUFFER first, then scans with the async chunked driver when projectile-replace--async-p holds and otherwise synchronously (always in batch), so the final match list is identical either way - only delivery differs. BUFFER is re-rendered when done and ON-DONE (or nil) is called in it.

As an optional accelerator, a read-only search-reviewer BUFFER doing a literal search (or one carrying a projectile-replace--rg-pattern) takes the ripgrep fast-path (projectile-search--gather-rg) when projectile-search--rg-fastpath-p holds; the replace reviewer and the plain regexp search always take the elisp path below. A search spanning several projects takes it too - projectile-search--gather-rg runs one rg per project in turn.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-replace--start (buffer candidates regexp on-done)
  "Fill BUFFER's match list by scanning CANDIDATES for REGEXP.
Cancels any in-flight scan in BUFFER first, then scans with the async
chunked driver when `projectile-replace--async-p' holds and otherwise
synchronously (always in batch), so the final match list is identical
either way - only delivery differs.  BUFFER is re-rendered when done and
ON-DONE (or nil) is called in it.

As an optional accelerator, a read-only search-reviewer BUFFER doing a
literal search (or one carrying a `projectile-replace--rg-pattern') takes
the ripgrep fast-path (`projectile-search--gather-rg') when
`projectile-search--rg-fastpath-p' holds; the replace reviewer and the
plain regexp search always take the elisp path below.  A search spanning
several projects takes it too - `projectile-search--gather-rg' runs one
`rg' per project in turn."
  (with-current-buffer buffer
    (projectile-replace--cancel-scan))
  (cond
   ((with-current-buffer buffer
      (and (derived-mode-p 'projectile-search-mode)
           (projectile-search--rg-fastpath-p projectile-replace--literal
                                             projectile-replace--rg-pattern)))
    (projectile-search--gather-rg
     buffer (buffer-local-value 'projectile-replace--term buffer) on-done))
   ((projectile-replace--async-p)
    (projectile-replace--gather-async
     (projectile-replace--resolve-candidates candidates)
     (with-current-buffer buffer (projectile-replace--effective-regexp regexp))
     buffer on-done))
   (t
    (with-current-buffer buffer
      (let* ((case-fold-search projectile-replace--case-fold)
             (result (projectile-replace--gather
                      (projectile-replace--resolve-candidates candidates)
                      (projectile-replace--effective-regexp regexp))))
        (setq projectile-replace--matches (plist-get result :matches)
              projectile-replace--truncated (plist-get result :truncated)
              projectile-replace--scanning nil
              projectile-replace--scan-timer nil))
      (funcall projectile-replace--render-function)
      (when on-done (funcall on-done buffer))))))