Alex Biddle     About     Archive     Feed

Emacs replace over multiple files

Replacing a string is easy in Emacs using a dired buffer. Open dired, use m to mark a file or u to unmark a file and run the replacement with Q. Emacs goes over each marked file, selects the change and prompts the user whether they want to make the replacement.

Type Space or `y' to replace one match, Delete or `n' to skip to next,
RET or `q' to exit, Period to replace one match and exit,
Comma to replace but not move point immediately,
C-r to enter recursive edit (C-M-c to get out again),
C-w to delete match and recursive edit,
C-l to clear the screen, redisplay, and offer same replacement again,
! to replace all remaining matches in this buffer with no more questions,
^ to move point back to previous match,
E to edit the replacement string.
In multi-buffer replacements type `Y' to replace all remaining
matches in all remaining buffers with no more questions,
`N' to skip to the next buffer without replacing remaining matches
in the current buffer.