* Re: how can i kill all the buffers
2007-01-30 15:19 how can i kill all the buffers step
@ 2007-01-30 16:51 ` HS
2007-01-30 17:06 ` Marc Tfardy
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: HS @ 2007-01-30 16:51 UTC (permalink / raw)
To: help-gnu-emacs
I have this function here, i'm not the author...
(defun kill-all-buffers ()
"Kill literally all buffers. This keeps Emacs from bloating."
(interactive)
(if (fboundp 'gnus-group-exit) (gnus-group-exit))
(loop for x being buffers
do (kill-buffer x)))
On 30 jan, 12:19, "step" <fxl...@gmail.com> wrote:
> 1. this is any command to kill all buffers ,not close the emacs
>
> 2. if only i want to close the buffers of some mode (ep: c
> files),can i do it?
>
> 3x
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 15:19 how can i kill all the buffers step
2007-01-30 16:51 ` HS
@ 2007-01-30 17:06 ` Marc Tfardy
2007-01-30 17:15 ` Marc Tfardy
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Marc Tfardy @ 2007-01-30 17:06 UTC (permalink / raw)
To: help-gnu-emacs
step schrieb:
> 1. this is any command to kill all buffers ,not close the emacs
>
> 2. if only i want to close the buffers of some mode (ep: c
> files),can i do it?
Maybe something like this:?
(defun kill-major-mode-buffer (mode)
"Kills current buffer when major mode is MODE."
(if (eq (cdr (assoc 'major-mode (buffer-local-variables))) mode)
(kill-buffer (current-buffer))))
(defun kill-all-major-mode-buffer (mode)
"Kills all buffer when major mode is MODE."
(interactive "SMode: ")
(mapc (lambda (buffer)
(progn
(set-buffer buffer)
(kill-major-mode-buffer mode))) (buffer-list)))
HTH
regards
Marc
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 15:19 how can i kill all the buffers step
2007-01-30 16:51 ` HS
2007-01-30 17:06 ` Marc Tfardy
@ 2007-01-30 17:15 ` Marc Tfardy
2007-01-30 22:34 ` Eric Hanchrow
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Marc Tfardy @ 2007-01-30 17:15 UTC (permalink / raw)
To: help-gnu-emacs
step schrieb:
> 1. this is any command to kill all buffers ,not close the emacs
(defun kill-all-buffers ()
"Kills all buffers."
(interactive)
(mapc (lambda (buffer)
(progn
(set-buffer buffer)
(kill-buffer buffer))) (buffer-list)))
regards
Marc
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 15:19 how can i kill all the buffers step
` (2 preceding siblings ...)
2007-01-30 17:15 ` Marc Tfardy
@ 2007-01-30 22:34 ` Eric Hanchrow
2007-01-30 22:46 ` Peter Dyballa
2007-01-31 1:25 ` Drew Adams
2007-02-01 1:02 ` RealityMonster
2007-02-01 4:23 ` Eric Hanchrow
5 siblings, 2 replies; 11+ messages in thread
From: Eric Hanchrow @ 2007-01-30 22:34 UTC (permalink / raw)
To: help-gnu-emacs
Another option:
C-x C-b ; to run "list-buffers"
kkkkkkkkkkkkkkkkk ; to mark the buffers to be killed
x ; to actually kill them
--
98% of ... computers is just hacking your way through the jungle
with a blunt machete. Lisp ... can save you 90% of the
remaining 2%, but alas, that's only 1.8% of the total.
-- Tim Bradshaw
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 22:34 ` Eric Hanchrow
@ 2007-01-30 22:46 ` Peter Dyballa
2007-01-30 23:00 ` Eric Hanchrow
2007-01-31 1:25 ` Drew Adams
1 sibling, 1 reply; 11+ messages in thread
From: Peter Dyballa @ 2007-01-30 22:46 UTC (permalink / raw)
To: Eric Hanchrow; +Cc: help-gnu-emacs
Am 30.01.2007 um 23:34 schrieb Eric Hanchrow:
> C-x C-b ; to run "list-buffers"
Isn't here a C-x o needed?
And wouldn't C-u 99 d make more sense and by faster than the following?
> kkkkkkkkkkkkkkkkk ; to mark the buffers to be killed
> x ; to actually kill them
This all would also kill the *scratch* buffer ...
--
Greetings
Pete
"Specifications are for the weak and timid!"
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 22:46 ` Peter Dyballa
@ 2007-01-30 23:00 ` Eric Hanchrow
2007-01-30 23:11 ` Peter Dyballa
0 siblings, 1 reply; 11+ messages in thread
From: Eric Hanchrow @ 2007-01-30 23:00 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs
>>>>> "Peter" == Peter Dyballa <Peter_Dyballa@Web.DE> writes:
Peter> Am 30.01.2007 um 23:34 schrieb Eric Hanchrow:
>> C-x C-b ; to run "list-buffers"
Peter> Isn't here a C-x o needed?
Yes, it might be.
Peter> And wouldn't C-u 99 d make more sense and by faster than
Peter> the following?
Probably :-)
Peter> This all would also kill the *scratch* buffer ...
Yup, but the OP indeed asked how to kill _all_ the buffers.
--
I think the future of the Republic may depend on young
audiences seeing more movies like "Whale Rider" and fewer
movies like "Scooby-Doo 2," but then that's just me.
-- Roger Ebert
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 23:00 ` Eric Hanchrow
@ 2007-01-30 23:11 ` Peter Dyballa
0 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2007-01-30 23:11 UTC (permalink / raw)
To: Eric Hanchrow; +Cc: help-gnu-emacs
Am 31.01.2007 um 00:00 schrieb Eric Hanchrow:
> Yup, but the OP indeed asked how to kill _all_ the buffers.
Sometimes folks don't make these fine distinctions between really all
buffers and only all those with a major-mode ... although: doesn't it
have Lisp Interaction-mode?
--
Greetings
Pete
"Isn't vi that text editor with two modes... one that beeps and one
that corrupts your file?" -- Dan Jacobson, on comp.os.linux.advocacy
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: how can i kill all the buffers
2007-01-30 22:34 ` Eric Hanchrow
2007-01-30 22:46 ` Peter Dyballa
@ 2007-01-31 1:25 ` Drew Adams
1 sibling, 0 replies; 11+ messages in thread
From: Drew Adams @ 2007-01-31 1:25 UTC (permalink / raw)
To: help-gnu-emacs
In Icicles: C-x k TAB C-!
Of course, I agree with others who've said that you probably do not really
want to kill all buffers. If you don't, then use this, where <pattern> is a
regexp or a substring that matches all of the buffers you do want to kill:
C-x k <pattern> S-TAB C-!
You can see all of the matching buffer names in buffer *Completions*, and
you can modify the <pattern> if it didn't match exactly exactly what you
thought it would ;-) - the set of matches is updated on the fly. Hit `C-!'
when the matching names are those you really want.
Or use a <pattern> to match all of the buffers that you do _not_ want to
kill, and kill all the rest. `C-~' complements the candidate set.
C-x k <pattern> S-TAB C-~ C-!
Or cycle among matching buffer candidates, killing only those you want when
you reach them. Or click `C-mouse-2' in *Completions* to selectively kill
buffers. These are all ways to manipulate the set of names that match your
input.
The same behavior applies to deleting files, using command
`icicle-delete-file'.
Your question is a generalization of "How do I kill one buffer", which is
what standard `C-x k' (`kill-buffer') does. In Icicles, commands that affect
one object can also affect many, and `C-x k' (`icicle-kill-buffer') is an
example of this.
And it is as easy to define such a multi-command as it is to define the
single-target version - the definitions are in fact the same.
http://www.emacswiki.org/cgi-bin/emacs-en/Icicles - all the Icicles doc
http://www.emacswiki.org/cgi-bin/emacs-en/Icicles_-_Multi-Commands - about
multi-commands
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 15:19 how can i kill all the buffers step
` (3 preceding siblings ...)
2007-01-30 22:34 ` Eric Hanchrow
@ 2007-02-01 1:02 ` RealityMonster
2007-02-01 4:23 ` Eric Hanchrow
5 siblings, 0 replies; 11+ messages in thread
From: RealityMonster @ 2007-02-01 1:02 UTC (permalink / raw)
To: help-gnu-emacs
On Jan 30, 8:19 am, "step" <fxl...@gmail.com> wrote:
> 1. this is any command to kill all buffers ,not close the emacs
>
> 2. if only i want to close the buffers of some mode (ep: c
> files),can i do it?
>
> 3x
I took kill-some-buffers and modified it a bit.
(defun kill-all-buffers (&optional list)
"For each buffer in LIST, kill it. If it's been modified don't do
anything.
LIST defaults to all existing live buffers."
(interactive)
(if (null list)
(setq list (buffer-list)))
(while list
(let* ((buffer (car list))
(name (buffer-name buffer)))
(and (not (string-equal name ""))
(/= (aref name 0) ? )
(if (not (buffer-modified-p buffer)) t )
(kill-buffer buffer)))
(setq list (cdr list))))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: how can i kill all the buffers
2007-01-30 15:19 how can i kill all the buffers step
` (4 preceding siblings ...)
2007-02-01 1:02 ` RealityMonster
@ 2007-02-01 4:23 ` Eric Hanchrow
5 siblings, 0 replies; 11+ messages in thread
From: Eric Hanchrow @ 2007-02-01 4:23 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> "step" == step <fxlzju@gmail.com> writes:
step> 2. if only i want to close the buffers of some mode (ep: c
step> files),can i do it?
If you use ibuffer, then
bring up Ibuffer menu with C-x C-b
mark your perl buffers with % m perl RET
delete with D
confirm with y
--
"Serenity" is an old-fashioned space opera, and differs from
a horse opera mostly in that it involves space, not horses.
-- Roger Ebert
^ permalink raw reply [flat|nested] 11+ messages in thread