Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I save multiple buffers (of my choosing) at the same time in Emacs?

Tags:

emacs

save

When I press C-x s (save-some-buffers) or C-x C-c (save-buffers-kill-terminal), Emacs displays the names of modified buffers one by one and asks what to do with each (save, diff, pass, ...). Pressing y one by one is slow. Pressing ! doesn't let you see what buffers are being saved.

How can I have the names of all modified buffers displayed first so that I can mark off some of them and save all the other quickly?

like image 277
Yoo Avatar asked Dec 05 '09 17:12

Yoo


2 Answers

C-x C-b (M-x list-buffers) displays a list of all the buffers. Modified ones will be shown with a * next to them. You can mark a buffer for saving by pressing s. When you're done, press x to save all the buffers you marked.

Unfortunately, as far as I know, there's no way to show only the unsaved buffers or to sort them so they're all at the top.

(I actually prefer M-x ibuffer to M-x list-buffers, but ibuffer provides a similar feature.)

like image 102
Phil Avatar answered Nov 16 '22 00:11

Phil


In emacs 23, with ibuffer :

  • 'M-x ibuffer' (to open a list of buffers)
  • '*u' (start and u at the same time) to marked all unsaved buffers
  • 'S' to save all marked buffers

Strangely enough, *u does not mark 'special' buffers like scratch, compilation, etc... I suppose i regexps on the name ...

like image 21
phtrivier Avatar answered Nov 16 '22 02:11

phtrivier