all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Price <matt.price@utoronto.ca>
To: Drew Adams <drew.adams@oracle.com>
Cc: help-gnu-emacs@gnu.org
Subject: RE: check to see if a buffer with a certain name exists?
Date: Fri, 14 Nov 2008 10:35:01 -0500	[thread overview]
Message-ID: <1226676902.4606.31.camel@localhost> (raw)
In-Reply-To: <000001c945af$493a4a40$c2b22382@us.oracle.com>

On Thu, 2008-11-13 at 08:45 -0800, Drew Adams wrote:
> > 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"))
>                => #<buffer lewis>
>           (get-buffer b)
>                => #<buffer lewis>
>           (get-buffer "Frazzle-nots")
>                => nil
> 
>      See also the function `get-buffer-create' in *note Creating
>      Buffers::.
> 
thanks Drew!  i am still getting used to info, thanks.  i had looked up
buffers inthe online manual but missed get-buffer, clearly it's exactly
what i'm looking for, thanks again!

matt


-- 
Matt Price
matt.price@utoronto.ca




  reply	other threads:[~2008-11-14 15:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-13 15:39 check to see if a buffer with a certain name exists? Matt Price
2008-11-13 16:45 ` Drew Adams
2008-11-14 15:35   ` Matt Price [this message]
2008-11-13 19:50 ` Nikolaj Schumacher
2008-11-13 21:03   ` Ian Eure
2008-11-14 15:38   ` Matt Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1226676902.4606.31.camel@localhost \
    --to=matt.price@utoronto.ca \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.