From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: david@adboyd.com (J. David Boyd) Newsgroups: gmane.emacs.help Subject: Re: If exists, Kill buffer Date: Fri, 07 Oct 2005 12:32:08 -0400 Message-ID: References: <20051007162552.GD1784@johnsons-web.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1128703083 21176 80.91.229.2 (7 Oct 2005 16:38:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2005 16:38:03 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 07 18:38:02 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ENvCM-0005MT-9t for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Oct 2005 18:35:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ENvCL-0006vI-PO for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Oct 2005 12:35:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ENvBx-0006pJ-Px for help-gnu-emacs@gnu.org; Fri, 07 Oct 2005 12:35:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ENvBw-0006p0-Vk for help-gnu-emacs@gnu.org; Fri, 07 Oct 2005 12:35:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ENvBw-0006ou-Nj for help-gnu-emacs@gnu.org; Fri, 07 Oct 2005 12:35:28 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1ENvBw-0003mT-Lk for help-gnu-emacs@gnu.org; Fri, 07 Oct 2005 12:35:28 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1ENvA7-0004Ke-82 for help-gnu-emacs@gnu.org; Fri, 07 Oct 2005 18:33:35 +0200 Original-Received: from 190-174.35-65.tampabay.res.rr.com ([65.35.174.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Oct 2005 18:33:35 +0200 Original-Received: from david by 190-174.35-65.tampabay.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Oct 2005 18:33:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 29 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 190-174.35-65.tampabay.res.rr.com User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:QpdH/hhvCThQMqdE4NHAUro3qVk= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30032 Archived-At: Tim Johnson writes: > I need a function that will kill a (named) buffer if it exists. > 1)Is there one? > a)If not, I will need a function that checks for the existance > of a buffer by name. > b)Is there one? > Pointers to docs, resources welcomed. > tim > > -- > Tim Johnson > http://www.alaska-internet-solutions.com I don't recall where I came by this, on this group probably... (defun kill-buffers-matching (regexp) (interactive "sKill buffers matching: ") (dolist (i (buffer-list)) (when (string-match regexp (buffer-name i)) (kill-buffer i)))) Dave in Largo, FL