From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.help Subject: Re: [LISP] completion of partial buffer name Date: Sat, 07 Sep 2002 19:23:18 +0200 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <87y9adogs9.fsf@emacswiki.org> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1031420169 11154 127.0.0.1 (7 Sep 2002 17:36:09 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 7 Sep 2002 17:36:09 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17njV8-0002tm-00 for ; Sat, 07 Sep 2002 19:36:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17njV8-0007XO-00; Sat, 07 Sep 2002 13:36:06 -0400 Original-Newsgroups: gnu.emacs.help X-Face: ^BC$`[IcggstLPyen&dqF+b2'zyK#r.mU*'Nms}@&4zw%SJ#5!/7SMVjBS7'lb;QK)|IPU5U'o1'522W4TyzB3Ab*IBo^iw]l4|kUbdZuUDO6=Um-.4IzhNiV'B"@K#jy_(wW|Zbk[34flKY^|PrQ?$u2\fKg^]AY>wOX#H32i Original-Lines: 26 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu) Cancel-Lock: sha1:KkLgAI2NWKcujNvQfU3cJSg5AaE= Original-NNTP-Posting-Host: 217.162.239.98 Original-X-Trace: news.swissonline.ch 1031419258 217.162.239.98 (7 Sep 2002 19:20:58 +0200) Original-X-Complaints-To: abuse@swissonline.ch Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news.imp.ch!news-zh.switch.ch!news.swissonline.ch!not-for-mail Original-Xref: nntp.stanford.edu gnu.emacs.help:104571 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1128 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1128 Cliff Heller 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.