Skip to content

Instantly share code, notes, and snippets.

@shellfly
Created November 24, 2017 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shellfly/c3967c0a0fa99076661fd60361e5b6e8 to your computer and use it in GitHub Desktop.
Save shellfly/c3967c0a0fa99076661fd60361e5b6e8 to your computer and use it in GitHub Desktop.
batch replace in dir in emacs
C-M-h  mark-defun

C-x C-space pop-global-mark

modify-syntax-entry _ w

M-x find-name-dired: you will be prompted for a root directory and a filename pattern.
Press t to "toggle mark" for all files found.
Press Q for "Query-Replace in Files...": you will be prompted for query/substitution regexps.
Proceed as with query-replace-regexp: SPACE to replace and move to next match, n to skip a match, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment