From unknown Tue Jun 17 20:12:57 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#14054 <14054@debbugs.gnu.org> To: bug#14054 <14054@debbugs.gnu.org> Subject: Status: completing against a hash-table doesn't work as documented Reply-To: bug#14054 <14054@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:12:57 +0000 retitle 14054 completing against a hash-table doesn't work as documented reassign 14054 emacs submitter 14054 Jonas Bernoulli severity 14054 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 25 22:58:39 2013 Received: (at submit) by debbugs.gnu.org; 26 Mar 2013 02:58:39 +0000 Received: from localhost ([127.0.0.1]:45369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UKK5v-0002vW-5e for submit@debbugs.gnu.org; Mon, 25 Mar 2013 22:58:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60056) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UKK5t-0002vP-D7 for submit@debbugs.gnu.org; Mon, 25 Mar 2013 22:58:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKK3U-0007qc-LT for submit@debbugs.gnu.org; Mon, 25 Mar 2013 22:56:20 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:58112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKK3U-0007qY-Ht for submit@debbugs.gnu.org; Mon, 25 Mar 2013 22:56:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKK3N-00009T-V1 for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 22:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKK3H-0007kZ-Qh for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 22:56:01 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:44057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKK3H-0007kL-HH for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 22:55:55 -0400 Received: by mail-ee0-f46.google.com with SMTP id e49so3469138eek.19 for ; Mon, 25 Mar 2013 19:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:subject:user-agent:date:message-id :mime-version:content-type; bh=sZi8G3tkv8T8vj6/CRUG24+qn87JFW8d19d7JxsGHXw=; b=umP1BoMMUMuTocM4sQcPbNlXNRqgxDy+yTTr3k/us7tCj4gV3zV9absGFBNAvG993Y VacEk9MFbEOHkchUp7pD+xNTstY61IC/oFU762ngxthzGydgEn63fQV65HQSHuL+yweL u1rum3AU9JOVluvFd1IJKQke52EcfhCJLgJvilNZQtjEyD4A2Fp/9vT4XCAWStVOBzr/ Qvc74kKZSpOmG3hubmtQzN5KPdwfXNE/tzzw7vXfboVy5Ti9bruY2Hcvz0se1L8EGsUU Xt0PHKNzPca+ViElA8MiGZ3XCwe6StLshqq2TiYVP3Q21FL10IDBekJIcy/7sk5gC47v YyfA== X-Received: by 10.15.107.205 with SMTP id cb53mr11269522eeb.14.1364266554005; Mon, 25 Mar 2013 19:55:54 -0700 (PDT) Received: from lem (178-83-148-119.dynamic.hispeed.ch. [178.83.148.119]) by mx.google.com with ESMTPS id q5sm22384201eeo.17.2013.03.25.19.55.52 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 25 Mar 2013 19:55:53 -0700 (PDT) From: Jonas Bernoulli To: bug-gnu-emacs@gnu.org Subject: completing against a hash-table doesn't work as documented User-agent: mu4e 0.9.9.5-dev6; emacs 24.3.1 Date: Tue, 26 Mar 2013 03:55:51 +0100 Message-ID: <871ub2hnt4.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) `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. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 27 15:57:42 2013 Received: (at 14054) by debbugs.gnu.org; 27 Mar 2013 19:57:42 +0000 Received: from localhost ([127.0.0.1]:48236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UKwTd-0003Q2-GX for submit@debbugs.gnu.org; Wed, 27 Mar 2013 15:57:41 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:38079) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UKwTa-0003Pt-Sh for 14054@debbugs.gnu.org; Wed, 27 Mar 2013 15:57:40 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r2RJt8b3002430; Wed, 27 Mar 2013 15:55:08 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id E6A41B4178; Wed, 27 Mar 2013 15:55:07 -0400 (EDT) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#14054: completing against a hash-table doesn't work as documented Message-ID: References: <871ub2hnt4.fsf@bernoul.li> Date: Wed, 27 Mar 2013 15:55:07 -0400 In-Reply-To: <871ub2hnt4.fsf@bernoul.li> (Jonas Bernoulli's message of "Tue, 26 Mar 2013 03:55:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4531=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4531> : streams <929234> : uri <1377774> X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: 14054 Cc: 14054@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > (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. > (2) It explicity sais that a key can be a symbol. Indeed, test-completion was too strict. The patch below should fix this. Can you confirm? Stefan === modified file 'src/minibuf.c' --- src/minibuf.c 2013-01-02 16:13:04 +0000 +++ src/minibuf.c 2013-03-27 19:52:34 +0000 @@ -1800,17 +1800,21 @@ { struct Lisp_Hash_Table *h = XHASH_TABLE (collection); i = hash_lookup (h, string, NULL); + Lisp_Object key = Qnil; if (i >= 0) tem = HASH_KEY (h, i); else for (i = 0; i < HASH_TABLE_SIZE (h); ++i) if (!NILP (HASH_HASH (h, i)) + && (key = HASH_KEY (h, i), + SYMBOLP (key) ? key = Fsymbol_name (key) : key, + STRINGP (key)) && EQ (Fcompare_strings (string, make_number (0), Qnil, - HASH_KEY (h, i), make_number (0) , Qnil, + key, make_number (0) , Qnil, completion_ignore_case ? Qt : Qnil), Qt)) { - tem = HASH_KEY (h, i); + tem = key; break; } if (!STRINGP (tem)) From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 09 16:13:37 2013 Received: (at control) by debbugs.gnu.org; 9 Apr 2013 20:13:37 +0000 Received: from localhost ([127.0.0.1]:42380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UPevA-0005hh-BL for submit@debbugs.gnu.org; Tue, 09 Apr 2013 16:13:37 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:51650) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UPev7-0005hX-Fq for control@debbugs.gnu.org; Tue, 09 Apr 2013 16:13:34 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r39K9qKW017858 for ; Tue, 9 Apr 2013 16:09:52 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 439E6B4178; Tue, 9 Apr 2013 16:09:52 -0400 (EDT) From: Stefan Monnier To: control@debbugs.gnu.org Subject: Re: bug#14054: completing against a hash-table doesn't work as documented Message-ID: References: <871ub2hnt4.fsf@bernoul.li> Date: Tue, 09 Apr 2013 16:09:52 -0400 In-Reply-To: (Stefan Monnier's message of "Wed, 27 Mar 2013 15:55:07 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4544=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4544> : streams <937893> : uri <1389480> X-Spam-Score: -4.5 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) close 14054 thanks From unknown Tue Jun 17 20:12:57 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 08 May 2013 11:24:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator