unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5495: 23.1.90; symbol completion fails
@ 2010-01-30  0:53 Roland Winkler
  2010-02-01 15:16 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Winkler @ 2010-01-30  0:53 UTC (permalink / raw)
  To: 5495

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, ...

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.

Shouldn't the last example work, too? Or am I missing something?
I thought I had used symbol completion before. But now I cannot get
it to work anymore.

Thanks,

Roland


In GNU Emacs 23.1.90.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4)
 of 2009-12-12 on regnitz






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#5495: 23.1.90; symbol completion fails
  2010-01-30  0:53 bug#5495: 23.1.90; symbol completion fails Roland Winkler
@ 2010-02-01 15:16 ` Stefan Monnier
  2010-02-01 16:06   ` Roland Winkler
  2011-07-13 16:32   ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-02-01 15:16 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 5495

> 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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#5495: 23.1.90; symbol completion fails
  2010-02-01 15:16 ` Stefan Monnier
@ 2010-02-01 16:06   ` Roland Winkler
  2011-07-13 16:32   ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Roland Winkler @ 2010-02-01 16:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 5495

On Mon Feb 1 2010 Stefan Monnier wrote:
> > 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).

Thanks for the clarification. So my bug report refers really to this
node of the elisp manual. In particular, it says

  Symbols are converted to strings using `symbol-name'.

> 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.

One could specify that lambda expressions take precedence, i.e., if
and only if (functionp collection) returns non-nil, collection will
be interpreted as a function. Otherwise a list will be interpreted
as a list of symbols (or a list of strings, etc.).

I would find that useful. But I'll be happy to give this feature
request low importance.

> 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.

Sure.

Roland






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#5495: 23.1.90; symbol completion fails
  2010-02-01 15:16 ` Stefan Monnier
  2010-02-01 16:06   ` Roland Winkler
@ 2011-07-13 16:32   ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-13 16:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 5495, Roland Winkler

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 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 I think this isn't a bug, and am closing the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-13 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-30  0:53 bug#5495: 23.1.90; symbol completion fails Roland Winkler
2010-02-01 15:16 ` Stefan Monnier
2010-02-01 16:06   ` Roland Winkler
2011-07-13 16:32   ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).