How can I get GNU Emacs to automatically save all the files I've changed after doing a multi-file search/replace with query-replace-regexp? Right now I have to switch back to the buffer for every individual file and save by hand whenever I do multi-file search and replace, which is just plain annoying.

  • 1
    Not what you asked for but save-some-buffers (bound to C-x s in vanilla emacs) will save you some time. – Fran Burstall Jun 6 at 19:35

You could trigger save-buffer after the replace. I believe the following should work:

(add-hook 'replace-update-post-hook 'save-buffer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.