Discussion:
kill buffers according to regex
Matthew Huggett
2005-01-17 07:15:23 UTC
Permalink
Hello all,

Is there any built-in command to kill all buffers that match a regex?

thanks,

Matthew
drkm
2005-01-17 19:13:55 UTC
Permalink
Post by Matthew Huggett
Is there any built-in command to kill all buffers that match a regex?
I don't know. IMHO, I think `C-x C-b', `d' on buffers you want to
delete, `x' to execute and `C-x 4 0' are a very easy way to kill
multiple buffers.

--drkm
Matthew Huggett
2005-01-18 04:07:01 UTC
Permalink
Date: Mon, 17 Jan 2005 20:13:55 +0100>
Post by Matthew Huggett
Is there any built-in command to kill all buffers that match a regex?
I don't know. IMHO, I think `C-x C-b', `d' on buffers you want to
delete, `x' to execute and `C-x 4 0' are a very easy way to kill
multiple buffers.
--drkm
Thanks, I'll give those a try.

Matthew
Kevin Rodgers
2005-01-18 16:06:16 UTC
Permalink
Post by Matthew Huggett
Date: Mon, 17 Jan 2005 20:13:55 +0100>
Post by Matthew Huggett
Is there any built-in command to kill all buffers that match a regex?
I don't know. IMHO, I think `C-x C-b', `d' on buffers you want to
delete, `x' to execute and `C-x 4 0' are a very easy way to kill
multiple buffers.
Thanks, I'll give those a try.
By default `C-x C-b' runs the command list-buffers. drkm must use the
same customization I do:

(global-set-key "\C-x\C-b" 'electric-buffer-list)
--
Kevin Rodgers
drkm
2005-01-18 17:41:59 UTC
Permalink
Post by Kevin Rodgers
By default `C-x C-b' runs the command list-buffers. drkm must use the
(global-set-key "\C-x\C-b" 'electric-buffer-list)
Hum... No. I didn't know this command. I just forgot the `C-x o'.
It's interresting. Thanks for the link and the correction.

--drkm
Henrik Enberg
2005-01-17 19:45:04 UTC
Permalink
Post by Matthew Huggett
Hello all,
Is there any built-in command to kill all buffers that match a regex?
(defun kill-buffers-matching (regexp)
(interactive "sKill buffers matching: ")
(dolist (i (buffer-list))
(when (string-match regexp (buffer-name i))
(kill-buffer i))))
Matthew Huggett
2005-01-18 04:54:57 UTC
Permalink
Newsgroups: gnu.emacs.help
Date: Mon, 17 Jan 2005 20:45:04 +0100
Organization: Le Petomane Appreciation Society
Content-Type: text/plain; charset=us-ascii
X-Now-Playing: Raphael Saadiq - People (feat. Randy Wiggins)
Cancel-Lock: sha1:YUenTuCzvhgTBBft1K7Cymf+e6k=
Xref: shelby.stanford.edu gnu.emacs.help:127947
Post by Matthew Huggett
Hello all,
Is there any built-in command to kill all buffers that match a regex?
(defun kill-buffers-matching (regexp)
(interactive "sKill buffers matching: ") (dolist (i
(buffer-list))
(when (string-match regexp (buffer-name i))
(kill-buffer i))))
Thank you very much for this Henrik. I figured I'd have to use
buffer-list but wasn't sure of how to go about it.

Anyway, while I'm writing, as an Emacs/Elisp novice, I find this list
to be quite a friendly, helpful place, so thanks to all you more
experienced users for sharing your knowledge.


Regards,

Matthew
Drew Adams
2005-01-18 16:32:12 UTC
Permalink
By default `C-x C-b' runs the command list-buffers. drkm must use the
same customization I do:

(global-set-key "\C-x\C-b" 'electric-buffer-list)


Or, if you prefer `buffer-menu', as I do:

(substitute-key-definition 'list-buffers 'buffer-menu global-map)
Enila Nero
2005-01-18 18:16:50 UTC
Permalink
Post by Matthew Huggett
Hello all,
Is there any built-in command to kill all buffers that match a regex?
This might be helpful in constructing such a function:

In midnight.el you find the function clean-buffer-list which is
controlled by several variables one of which is

clean-buffer-list-kill-regexps

EN

Loading...