> hello,
> how can I write a macro to close all open buffers
>
> thanks
here's some elisp to do the trick:
(defun my-blank-slate-emacs ()
"kill all buffers, leaving *scratch* only"
(interactive)
;;close all frames but one, first
(mapcar (lambda (x) (delete-frame x))
(cdr (visible-frame-list)))
;;then, kill all buffers
(mapcar (lambda (x) (kill-buffer x))
(buffer-list))
;;make there be only one window holding buffer *scratch*
(delete-other-windows))
That should work, customize to taste. (this one also blows away all
frames but the one you are on).
Benjamin
> thanks,
> how about a function that can loop through each open buffer and prompt
> y/n to kill
that's built in, see M-x kill-some-buffers
Benjamin
> thanks, how about a function that can loop through each open buffer
> and prompt
You might like "ibuffer.el", which allows you to do mass operations on
buffers like this.
In ibuffer, this is two keystrokes: 't D'.
Or, you could pick and choose what buffers to delete, based their name
or other critera.
Then again, I am the author, so I guess I am a bit biased :)
Anyways, you can find a copy here:
Try 'M-x buffer-menu'. You can mark buffers to kill with 'd', and
then kill them with 'x'.