help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [LISP] completion of partial buffer name


From: Alex Schroeder
Subject: Re: [LISP] completion of partial buffer name
Date: Sat, 07 Sep 2002 19:23:18 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]