Function: project-query-replace-regexp

project-query-replace-regexp is an autoloaded, interactive and byte-compiled function defined in project.el.gz.

Signature

(project-query-replace-regexp FROM TO)

Documentation

Query-replace REGEXP in all the files of the project.

Stops when a match is found and prompts for whether to replace it. At that prompt, the user must type a character saying what to do with the match. Type SPC or y to replace the match, DEL or n to skip and go to the next match. For more directions, type <f1> (help-command) at that time. If you exit the query-replace, you can later continue the query-replace loop using the command M-x fileloop-continue (fileloop-continue).

View in manual

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
;;;###autoload
(defun project-query-replace-regexp (from to)
  "Query-replace REGEXP in all the files of the project.
Stops when a match is found and prompts for whether to replace it.
At that prompt, the user must type a character saying what to do
with the match.  Type SPC or `y' to replace the match,
DEL or `n' to skip and go to the next match.  For more directions,
type \\[help-command] at that time.
If you exit the `query-replace', you can later continue the
`query-replace' loop using the command \\[fileloop-continue]."
  (interactive
   (let ((query-replace-read-from-regexp-default 'find-tag-default-as-regexp))
     (pcase-let ((`(,from ,to)
                  (query-replace-read-args "Query replace (regexp)" t t)))
       (list from to))))
  (fileloop-initialize-replace
   from to
   (project-files (project-current t))
   'default)
  (fileloop-continue))