Function: xref--query-replace-1
xref--query-replace-1 is a byte-compiled function defined in
xref.el.gz.
Signature
(xref--query-replace-1 FROM TO ITER)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
;; FIXME: Write a nicer UI.
(defun xref--query-replace-1 (from to iter)
(let* ((query-replace-lazy-highlight nil)
(continue t)
did-it-once buf-pairs pairs
current-beg current-end
;; Counteract the "do the next match now" hack in
;; `perform-replace'. And still, it'll report that those
;; matches were "filtered out" at the end.
(isearch-filter-predicate
(lambda (beg end)
(and current-beg
(>= beg current-beg)
(<= end current-end))))
(replace-re-search-function
(lambda (from &optional _bound noerror)
(let (found pair)
(while (and (not found) pairs)
(setq pair (pop pairs)
current-beg (car pair)
current-end (cdr pair))
(goto-char current-beg)
(when (re-search-forward from current-end noerror)
(setq found t)))
found))))
(while (and continue (setq buf-pairs (funcall iter :next)))
(if did-it-once
;; Reuse the same window for subsequent buffers.
(switch-to-buffer (car buf-pairs))
(xref--with-dedicated-window
(pop-to-buffer (car buf-pairs)))
(setq did-it-once t))
(setq pairs (cdr buf-pairs))
(setq continue
(perform-replace from to t t nil nil multi-query-replace-map)))
(unless did-it-once (user-error "No suitable matches here"))
(when (and continue (not buf-pairs))
(message "All results processed"))))