5

After modifying multiple files, how can I save all their buffers?

  • multi-occur is not dependent on projectile. It is a vanill Emacs command from standard library replace.el. Why mention (and link to) projectile here? Is there really something pertinent about projectile in your question? Search and replace seem to be irrelevant to the question, as well. – Drew Oct 8 '14 at 15:41
  • 1
    C-h a (apropos-command) is your friend. C-h a save buffers tells you about commands whose names match save and buffers. – Drew Oct 8 '14 at 15:46
  • Thanks for clarifying that multi-occur is built in. I mentioned projectile specifically as it is a feature and package that people may not know about. Most folks are diligent at saving while editing, so the use case of updating multiple files at a time makes more sense within the context of a library like projectile and/or multi-occur. The same goes for using a macro to edit multiple buffers. My thought was that including these libs helps widen the discoverability of helpful features. – elarson Oct 8 '14 at 17:13
6

After making the changes you can save the open buffers using save-some-buffers. This is bound C-x s by default.

Here is what the docs say.

Save some modified file-visiting buffers.  Asks user about each one. 
You can answer `y' to save, `n' not to save, `C-r' to look at the 
buffer in question with `view-buffer' before deciding or `d' to 
view the differences using `diff-buffer-with-file'.

You can use C-u C-x s to save without asking.

5

M-x ibuffer * u S is quite convenient for this as well, because you can add/remove selected buffers with m or u before saving with S.

  • Likwise, buffer-menu. – Drew Oct 8 '14 at 16:58

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.