Function: replace-regexp-as-diff

replace-regexp-as-diff is an autoloaded, interactive and byte-compiled function defined in misearch.el.gz.

Signature

(replace-regexp-as-diff REGEXP TO-STRING &optional DELIMITED)

Documentation

Show as diffs replacements of REGEXP with TO-STRING in the current buffer.

DELIMITED has the same meaning as in replace-regexp. The replacements are displayed in the buffer *replace-diff* that you can later apply as a patch after reviewing the changes.

Probably introduced at or before Emacs version 30.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/misearch.el.gz
;;;###autoload
(defun replace-regexp-as-diff (regexp to-string &optional delimited)
  "Show as diffs replacements of REGEXP with TO-STRING in the current buffer.
DELIMITED has the same meaning as in `replace-regexp'.
The replacements are displayed in the buffer *replace-diff* that
you can later apply as a patch after reviewing the changes."
  (interactive
   (let ((common
          (query-replace-read-args
           (concat "Replace"
                   (if current-prefix-arg " word" "")
                   " regexp as diff")
           t t)))
     (list (nth 0 common) (nth 1 common) (nth 2 common))))
  (multi-file-replace-as-diff
   (list buffer-file-name) regexp to-string t delimited))