Use ibuffer
, which should come with all late-model emacsen. Put the following in your .emacs file:
(autoload 'ibuffer "ibuffer""" t)(global-set-key (kbd "C-x C-b") 'ibuffer)(defun my-ibuffer-load-hook ()"Hook for when ibuffer is loaded." (define-ibuffer-filter unsaved-file-buffers"Only show unsaved buffers backed by a real file." (:description "unsaved file buffers") (and (buffer-local-value 'buffer-file-name buf) (buffer-modified-p buf))) (define-key ibuffer-mode-map (kbd "/ *") 'ibuffer-filter-by-unsaved-file-buffers) );; (add-hook 'ibuffer-load-hook 'my-ibuffer-load-hook)(eval-after-load 'ibuf-ext '(my-ibuffer-load-hook))
Then use C-x C-b
to bring up the ibuffer list, and / *
to show just unsaved buffers backed by a real file (so you don't see *scratch*
in the list, for example). Mark the desired buffers with m
and then save them with S
.