From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: check to see if a buffer with a certain name exists? Date: Thu, 13 Nov 2008 08:45:50 -0800 Message-ID: <000001c945af$493a4a40$c2b22382@us.oracle.com> References: <1226590775.8767.2137.camel@localhost> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1226595370 9491 80.91.229.12 (13 Nov 2008 16:56:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Nov 2008 16:56:10 +0000 (UTC) To: "'Matt Price'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 13 17:57:10 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L0fV4-0003jQ-HH for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Nov 2008 17:56:58 +0100 Original-Received: from localhost ([127.0.0.1]:41733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0fTw-000287-HL for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Nov 2008 11:55:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0fKR-0003SW-Uj for help-gnu-emacs@gnu.org; Thu, 13 Nov 2008 11:45:59 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0fKQ-0003Rm-E1 for help-gnu-emacs@gnu.org; Thu, 13 Nov 2008 11:45:59 -0500 Original-Received: from [199.232.76.173] (port=36021 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0fKQ-0003Rd-4b for help-gnu-emacs@gnu.org; Thu, 13 Nov 2008 11:45:58 -0500 Original-Received: from rcsinet12.oracle.com ([148.87.113.124]:50846 helo=rgminet12.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L0fKQ-0008Tc-5l for help-gnu-emacs@gnu.org; Thu, 13 Nov 2008 11:45:58 -0500 Original-Received: from acsinet13.oracle.com (acsinet13.oracle.com [141.146.126.235]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mADGjkX7009612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Nov 2008 16:45:47 GMT Original-Received: from acsmt701.oracle.com (acsmt701.oracle.com [141.146.40.71]) by acsinet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mADGk223003985; Thu, 13 Nov 2008 16:46:03 GMT Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 13 Nov 2008 16:45:49 +0000 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1226590775.8767.2137.camel@localhost> Thread-Index: AclFrk55j9qcfIwYRluhPAKuNOkp9QAAEDsg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt701.oracle.com [141.146.40.71] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A09020B.491C59BF.0107:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) 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:59744 Archived-At: > i want to be able to check if there's a buffer > open named *Mutt* . what's the best way to do this? in python, for > instance, i would just say: > if "*Mutt*" in buffer-list : return true else : return false > in lisp i'm not seeing a quick way to test for something like this. C-h f get-buffer (get-buffer "*Mutt*") The Elisp manual is your friend. In the manual, `i buffer RET' takes you to the Buffers chapter. Buffer Names in the menu there shows you this: Function: get-buffer buffer-or-name This function returns the buffer specified by BUFFER-OR-NAME. If BUFFER-OR-NAME is a string and there is no buffer with that name, the value is `nil'. If BUFFER-OR-NAME is a buffer, it is returned as given; that is not very useful, so the argument is usually a name. For example: (setq b (get-buffer "lewis")) => # (get-buffer b) => # (get-buffer "Frazzle-nots") => nil See also the function `get-buffer-create' in *note Creating Buffers::.