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

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

bug#5495: 23.1.90; symbol completion fails


From: Stefan Monnier
Subject: bug#5495: 23.1.90; symbol completion fails
Date: Mon, 01 Feb 2010 10:16:20 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

> I am having trouble with symbol completion. The lisp manual says
> about `try-completion'

>   The value of COLLECTION must be a list of strings or symbols,
>   an alist, an obarray, ...

That's incorrect, a list of symbols is not supported (although it
somewhat works).

> So the following works well

>   (try-completion  "foo" '("bar" baz)) ; fine
>   (try-completion  "foo" '((bar) baz)) ; fine

> Yet the following example fails

>   (try-completion  "foo" '(bar baz))   ; fails

> because it tries to interpret (bar baz) as a call of function bar
> using arg baz.

Not, it interprets the whole (bar baz) as a function (without checking
whether the first symbol is indeed a lambda).

> Shouldn't the last example work, too? Or am I missing something?

It can be made to work, but then it will mysteriously break again when
the first symbol in the list happens to be a lambda.

> I thought I had used symbol completion before. But now I cannot get
> it to work anymore.

Use an alist with symbols as keys, or use an obarray.  Otherwise pass
your list of symbols through (mapcar 'symbol-name ...) to turn it into a
list of strings.



        Stefan






reply via email to

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