* [LISP] completion of partial buffer name
@ 2002-09-07 16:56 Cliff Heller
2002-09-07 17:23 ` Alex Schroeder
0 siblings, 1 reply; 3+ messages in thread
From: Cliff Heller @ 2002-09-07 16:56 UTC (permalink / raw)
I'm trying to use elisp to write a function that will switch to a buffer
of a certain type.
But I only have the beginning of the name availalble.
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?
Thanks.
--
"Letters may be used to construct words, phrases and sentences that may be
deemed offensive."
-Warning label on children's alphabet blocks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LISP] completion of partial buffer name
2002-09-07 16:56 [LISP] completion of partial buffer name Cliff Heller
@ 2002-09-07 17:23 ` Alex Schroeder
2002-09-09 14:51 ` Stefan Monnier <foo@acm.com>
0 siblings, 1 reply; 3+ messages in thread
From: Alex Schroeder @ 2002-09-07 17:23 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LISP] completion of partial buffer name
2002-09-07 17:23 ` Alex Schroeder
@ 2002-09-09 14:51 ` Stefan Monnier <foo@acm.com>
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-09-09 14:51 UTC (permalink / raw)
>>>>> "Alex" == Alex Schroeder <alex@emacswiki.org> writes:
> (let ((completions (mapcar (lambda (buf)
> (list (buffer-name buf)))
> (buffer-list))))
> (try-completion "output" completions))
You can also use `all-completions' which will unsurprisingly
return the list of buffers that match.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-09 14:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-07 16:56 [LISP] completion of partial buffer name Cliff Heller
2002-09-07 17:23 ` Alex Schroeder
2002-09-09 14:51 ` Stefan Monnier <foo@acm.com>
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).