Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

close all

1 view
Skip to first unread message

Benjamin Rutt

unread,
Oct 5, 2000, 3:00:00 AM10/5/00
to
"jan" <ja...@nospam.micorforte.com.au> writes:

> 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

Benjamin Rutt

unread,
Oct 5, 2000, 3:00:00 AM10/5/00
to
"jan" <ja...@nospam.micorforte.com.au> writes:

> 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

Colin Walters

unread,
Oct 5, 2000, 3:00:00 AM10/5/00
to
"jan" <ja...@nospam.micorforte.com.au> writes:

> 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:

http://www.cis.ohio-state.edu/archive/archive/ibuffer.el

Colin Walters

unread,
Oct 5, 2000, 3:00:00 AM10/5/00
to
Actually, I forgot to mention that Emacs already comes with
`buffer-menu', which you might like.

Try 'M-x buffer-menu'. You can mark buffers to kill with 'd', and
then kill them with 'x'.

jan

unread,
Oct 5, 2000, 8:33:53 PM10/5/00
to

jan

unread,
Oct 5, 2000, 9:03:02 PM10/5/00
to

thanks,
how about a function that can loop through each open buffer and prompt
y/n to kill
0 new messages