GNU bug report logs -
#50781
27.2; completing-read with a vector
Previous Next
Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Date: Fri, 24 Sep 2021 14:04:01 UTC
Severity: normal
Tags: notabug
Found in version 27.2
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
> I am not sure if `completing-read` is supposed to accept a vector but
> an error is not thrown on this usage (incidentally helpful uses
> `completing-read` in this way).
>
> However, starting from `emacs -Q` and executing the following code
>
> (completing-read "Test: " [A B C])
>
> works but then pressing <TAB> for auto-completion shows objects beside
> A, B and C.
The documentation here says:
COLLECTION can be a list of strings, an alist, an obarray or a hash table.
So using a vector isn't really supported, but works in some instances by
chance.
> On the other hand, executing
> (completing-read "Test: " [1 2 3])
> and then pressing <TAB> shows the error `(error "Bad data in guts of obarray")`
It interprets all vectors as obarrays, and an obarray is just a vector
of symbols. But numbers aren't symbols, which is what it's complaining
about.
We could make `completing-read' iterate over all the elements in the
vector to see whether it's valid, and signal an error earlier, but it
would make common usages slower.
So I don't think there's an error in Emacs here -- feeding a
(non-obarray) vector to `completing-read' is not supported, and is an
error in the code that does it. So I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.