Function: vc-dir-query-replace-regexp

vc-dir-query-replace-regexp is an interactive and byte-compiled function defined in vc-dir.el.gz.

Signature

(vc-dir-query-replace-regexp FROM TO &optional DELIMITED)

Documentation

Do query-replace-regexp of FROM with TO, on all marked files.

If a directory is marked, then use the files displayed for that directory. Third arg DELIMITED (prefix arg) means replace only word-delimited matches.

As each match is found, the user must type a character saying what to do with it. 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 (C-g (keyboard-quit), RET or q), you can resume the query replace with the command M-x fileloop-continue (fileloop-continue).

Probably introduced at or before Emacs version 23.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dir.el.gz
(defun vc-dir-query-replace-regexp (from to &optional delimited)
  "Do `query-replace-regexp' of FROM with TO, on all marked files.
If a directory is marked, then use the files displayed for that directory.
Third arg DELIMITED (prefix arg) means replace only word-delimited matches.

As each match is found, the user must type a character saying
what to do with it.  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 (\\[keyboard-quit], RET or q), you can resume the query replace
with the command \\[fileloop-continue]."
  ;; FIXME: this is almost a copy of `dired-do-query-replace-regexp'.  This
  ;; should probably be made generic and used in both places instead of
  ;; duplicating it here.
  (interactive
   (let ((common
	  (query-replace-read-args
	   "Query replace regexp in marked files" t t)))
     (list (nth 0 common) (nth 1 common) (nth 2 common))))
  (dolist (file (mapcar #'car (vc-dir-marked-only-files-and-states)))
    (let ((buffer (get-file-buffer file)))
      (if (and buffer (with-current-buffer buffer
			buffer-read-only))
	  (error "File `%s' is visited read-only" file))))
  (fileloop-initialize-replace
   from to (mapcar #'car (vc-dir-marked-only-files-and-states))
   (if (equal from (downcase from)) nil 'default)
   delimited)
  (fileloop-continue))