GNU bug report logs - #14054
completing against a hash-table doesn't work as documented

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Tue, 26 Mar 2013 02:59:01 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: bug-gnu-emacs <at> gnu.org
Subject: completing against a hash-table doesn't work as documented
Date: Tue, 26 Mar 2013 03:55:51 +0100
`completing-read's doc-strings sais I should read `try-completion's
(and `all-completions's) doc-string for details on COLLECTION.

`try-completion's doc-string sais:

>   If COLLECTION is a hash-table, all the keys that are strings or
>   symbols are the possible completions.

(1) To my this implies that all other keys are simply ignored, as it
    doesn't say that all keys _have to by_ strings or symbols.

    However using e.g. a vector or number as key causes a
    `wrong-type-argument' error in `test-completion'.

(2) It explicity sais that a key can be a symbol.

    However this causes the same error:

    (let ((ht (make-hash-table)))
      (puthash 'key 'val ht)
      (test-completion "input" ht))

I tried using hash-tables created with all three predefined hash-table
tests `eq', `eql', and `equal; none worked.

Note that depending on the "order" of elements in the hash-table no
error is raised by `test-completion' if a string key "before" the first
non-string key matches:

no error

    (let ((ht (make-hash-table)))
      (puthash "first" 'val ht)
      (puthash 'second 'val ht)
      (test-completion "first" ht))

error

    (let ((ht (make-hash-table)))
      (puthash 'first   'val ht)
      (puthash "second" 'val ht)
      (test-completion "second" ht))

I have tried with 23.4, 24.2, 24.3, and 24.3.50; they all behave the
this way.




This bug report was last modified 12 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.