GNU bug report logs - #10416
24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION

Previous Next

Package: emacs;

Reported by: Aidan Kehoe <kehoea <at> parhasard.net>

Date: Sun, 1 Jan 2012 14:20:01 UTC

Severity: normal

Tags: patch

Found in version 24.0.92

Fixed in version 24.4

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10416 in the body.
You can then email your comments to 10416 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Sun, 01 Jan 2012 14:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aidan Kehoe <kehoea <at> parhasard.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 01 Jan 2012 14:20:02 GMT) Full text and rfc822 format available.

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

From: Aidan Kehoe <kehoea <at> parhasard.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.92;
	#'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Sun, 1 Jan 2012 14:16:06 +0000
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

Hello there,

Recipe to trigger the problem:

 (try-completion "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 => t ;; as expected and documented

 (all-completions "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 => ("del-alist") ;; as expected and documented

 (test-completion "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 =>
Debugger entered--Lisp error: (wrong-type-argument stringp del-alist)
  test-completion("del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone ...)))

This is unexpected, inconsistent, and not documented; it should return t, as
it does if the hash table key is a string.

Happy New Year,

Aidan

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/Sources/emacs/etc/DEBUG.


In GNU Emacs 24.0.92.1 (i386-apple-darwin10.8.0, GTK+ Version 2.22.1)
 of 2011-12-30 on bonbon
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<escape> x r e p o r t - e m a c s - b u g <return
>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml easymenu
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

-- 
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Sun, 01 Jan 2012 23:03:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Aidan Kehoe <kehoea <at> parhasard.net>
Cc: 10416 <at> debbugs.gnu.org
Subject: Re: bug#10416: 24.0.92;
	#'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Sun, 01 Jan 2012 17:59:05 -0500
>  (try-completion "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
>  => t ;; as expected and documented

>  (all-completions "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
>  => ("del-alist") ;; as expected and documented

These are bugs.  The Elisp manual is pretty clear about it:

     If COLLECTION is a hash table, then the keys that are strings are
     the possible completions.  Other keys are ignored.


-- Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Mon, 02 Jan 2012 00:15:02 GMT) Full text and rfc822 format available.

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

From: Aidan Kehoe <kehoea <at> parhasard.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 10416 <at> debbugs.gnu.org
Subject: Re: bug#10416: 24.0.92;
	#'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Mon, 2 Jan 2012 00:11:41 +0000
 Ar an chéad lá de mí Eanair, scríobh Stefan Monnier: 

 > >  (try-completion "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 > >  => t ;; as expected and documented
 > 
 > >  (all-completions "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 > >  => ("del-alist") ;; as expected and documented
 > 
 > These are bugs.  The Elisp manual is pretty clear about it:
 > 
 >      If COLLECTION is a hash table, then the keys that are strings are
 >      the possible completions.  Other keys are ignored.

And the docstrings of #'try-completion and #'all-completion are equally
clear, and contradict that. They both say the following:

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

-- 
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Mon, 02 Jan 2012 00:25:01 GMT) Full text and rfc822 format available.

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

From: Aidan Kehoe <kehoea <at> parhasard.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 10416 <at> debbugs.gnu.org
Subject: Re: bug#10416: 24.0.92;
	#'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Mon, 2 Jan 2012 00:21:23 +0000
 Ar an chéad lá de mí Eanair, scríobh Stefan Monnier: 

 > >  (try-completion "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 > >  => t ;; as expected and documented
 > 
 > >  (all-completions "del-alist" #s(hash-table size 145 test equal rehash-size 1.5 rehash-threshold 0.8 data (del-alist hello "delay-mode-hooks" everyone "delete" everyone)))
 > >  => ("del-alist") ;; as expected and documented
 > 
 > These are bugs.  The Elisp manual is pretty clear about it:
 > 
 >      If COLLECTION is a hash table, then the keys that are strings are
 >      the possible completions.  Other keys are ignored.

Also, throwing an error on encountering a symbol key (as #'test-completion
does) is not what that paragraph describes.

-- 
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Tue, 03 Jan 2012 22:11:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Aidan Kehoe <kehoea <at> parhasard.net>
Cc: 10416 <at> debbugs.gnu.org
Subject: Re: bug#10416: 24.0.92;
	#'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Tue, 03 Jan 2012 17:07:20 -0500
>> If COLLECTION is a hash table, then the keys that are strings are
>> the possible completions.  Other keys are ignored.

> And the docstrings of #'try-completion and #'all-completion are equally
> clear, and contradict that. They both say the following:

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

Right.  So we clearly need to fix the doc.  Maybe also the code.  But in
the mean time I think the contradictory docs basically mean "stay away
from symbols as keys for completion hash-tables".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Wed, 08 Jun 2016 03:43:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: 10416 <at> debbugs.gnu.org
Subject: 24.0.92;
 #'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Tue, 7 Jun 2016 23:42:20 -0400
[Message part 1 (text/plain, inline)]
tag 10416 + patch
quit

In 24.5 the 3rd case is fixed, but the docs are still contradictory as
of 25.0.94. Here is a patch to make manual agree with code and
docstrings.
[0001-Fix-documentation-of-completion-functions.patch (text/x-diff, attachment)]

Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 08 Jun 2016 03:43:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Sat, 18 Jun 2016 16:33:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: 10416 <at> debbugs.gnu.org
Cc: Aidan Kehoe <kehoea <at> parhasard.net>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#10416: 24.0.92; #'test-completion is inconsistent with symbol
 hash keys in COLLECTION
Date: Sat, 18 Jun 2016 12:32:07 -0400
The code has meanwhile been changed to handle symbol hash keys in 24.4
(a8036e40 "* src/minibuf.c (Ftest_completion): Ignore
non-string/symbol keys in hash tables.").

Should we update the manual to match the docstring and code now?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10416; Package emacs. (Sat, 18 Jun 2016 17:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: kehoea <at> parhasard.net, 10416 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#10416: 24.0.92;
 #'test-completion is inconsistent with symbol hash keys in COLLECTION
Date: Sat, 18 Jun 2016 20:20:36 +0300
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Date: Sat, 18 Jun 2016 12:32:07 -0400
> Cc: Aidan Kehoe <kehoea <at> parhasard.net>,
> 	Stefan Monnier <monnier <at> iro.umontreal.ca>
> 
> Should we update the manual to match the docstring and code now?

Yes, as always.

Thanks.




Reply sent to Noam Postavsky <npostavs <at> users.sourceforge.net>:
You have taken responsibility. (Sat, 18 Jun 2016 19:11:02 GMT) Full text and rfc822 format available.

Notification sent to Aidan Kehoe <kehoea <at> parhasard.net>:
bug acknowledged by developer. (Sat, 18 Jun 2016 19:11:03 GMT) Full text and rfc822 format available.

Message #33 received at 10416-done <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Aidan Kehoe <kehoea <at> parhasard.net>, 10416-done <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#10416: 24.0.92; #'test-completion is inconsistent with symbol
 hash keys in COLLECTION
Date: Sat, 18 Jun 2016 15:09:57 -0400
Version: 24.4

On Sat, Jun 18, 2016 at 1:20 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
>> Date: Sat, 18 Jun 2016 12:32:07 -0400
>> Cc: Aidan Kehoe <kehoea <at> parhasard.net>,
>>       Stefan Monnier <monnier <at> iro.umontreal.ca>
>>
>> Should we update the manual to match the docstring and code now?
>
> Yes, as always.
>
> Thanks.

Okay, I pushed the manual patch to emacs-25 (d1efbafd).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Jul 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 30 days ago.

Previous Next


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