all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Schroeder <alex@emacswiki.org>
Subject: Re: [LISP] completion of partial buffer name
Date: Sat, 07 Sep 2002 19:23:18 +0200	[thread overview]
Message-ID: <87y9adogs9.fsf@emacswiki.org> (raw)
In-Reply-To: upelc5low9.fsf@panix3.panix.com

Cliff Heller <fnord@panix.com> writes:

> say for example: output1, output2, output3
> but only one such buffer would exist at any time.
>
> How can I do a non interactive completion on substring "output" to get
> the full buffer name and switch to it? 

(let ((completions (mapcar (lambda (buf)
			     (list (buffer-name buf)))
			   (buffer-list))))
  (try-completion "output" completions))
 
For me, for example:

(let ((completions (mapcar (lambda (buf)
			     (list (buffer-name buf)))
			   (buffer-list))))
  (try-completion "*scra" completions))

=> "*scratch*"

See the doc of try-completion for what happens if your prefix is
non-unique, or matches exactly, or not at all.  :)

Alex.

  reply	other threads:[~2002-09-07 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-07 16:56 [LISP] completion of partial buffer name Cliff Heller
2002-09-07 17:23 ` Alex Schroeder [this message]
2002-09-09 14:51   ` Stefan Monnier <foo@acm.com>

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=87y9adogs9.fsf@emacswiki.org \
    --to=alex@emacswiki.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.