After modifying multiple files, how can I save all their buffers?
2 Answers
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.
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
.
multi-occur
is not dependent on projectile. It is a vanill Emacs command from standard libraryreplace.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.C-h a
(apropos-command
) is your friend.C-h a save buffers
tells you about commands whose names matchsave
andbuffers
.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.