* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
@ 2012-01-01 14:16 Aidan Kehoe
2012-01-01 22:59 ` Stefan Monnier
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Aidan Kehoe @ 2012-01-01 14:16 UTC (permalink / raw
To: 10416
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)
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2012-01-01 14:16 bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION Aidan Kehoe
@ 2012-01-01 22:59 ` Stefan Monnier
2012-01-02 0:11 ` Aidan Kehoe
2012-01-02 0:21 ` Aidan Kehoe
2016-06-08 3:42 ` Noam Postavsky
2016-06-18 16:32 ` Noam Postavsky
2 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2012-01-01 22:59 UTC (permalink / raw
To: Aidan Kehoe; +Cc: 10416
> (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
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2012-01-01 22:59 ` Stefan Monnier
@ 2012-01-02 0:11 ` Aidan Kehoe
2012-01-03 22:07 ` Stefan Monnier
2012-01-02 0:21 ` Aidan Kehoe
1 sibling, 1 reply; 9+ messages in thread
From: Aidan Kehoe @ 2012-01-02 0:11 UTC (permalink / raw
To: Stefan Monnier; +Cc: 10416
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)
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2012-01-01 22:59 ` Stefan Monnier
2012-01-02 0:11 ` Aidan Kehoe
@ 2012-01-02 0:21 ` Aidan Kehoe
1 sibling, 0 replies; 9+ messages in thread
From: Aidan Kehoe @ 2012-01-02 0:21 UTC (permalink / raw
To: Stefan Monnier; +Cc: 10416
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)
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2012-01-02 0:11 ` Aidan Kehoe
@ 2012-01-03 22:07 ` Stefan Monnier
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2012-01-03 22:07 UTC (permalink / raw
To: Aidan Kehoe; +Cc: 10416
>> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2012-01-01 14:16 bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION Aidan Kehoe
2012-01-01 22:59 ` Stefan Monnier
@ 2016-06-08 3:42 ` Noam Postavsky
2016-06-18 16:32 ` Noam Postavsky
2 siblings, 0 replies; 9+ messages in thread
From: Noam Postavsky @ 2016-06-08 3:42 UTC (permalink / raw
To: 10416
[-- Attachment #1: Type: text/plain, Size: 170 bytes --]
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.
[-- Attachment #2: 0001-Fix-documentation-of-completion-functions.patch --]
[-- Type: text/x-diff, Size: 1208 bytes --]
From dc25b98bf90b68b78c8b3baf4dcc0bbc609bd2d2 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Tue, 7 Jun 2016 23:37:05 -0400
Subject: [PATCH] Fix documentation of completion functions
So that the behavior matches the match code (and docstrings).
* doc/lispref/minibuf.texi (Basic Completion): Symbol keys of hash table
are not ignored.
---
doc/lispref/minibuf.texi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 6f41090..1fa2536 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -733,8 +733,8 @@ Basic Completion
If @var{collection} is an obarray (@pxref{Creating Symbols}), the names
of all symbols in the obarray form the set of permissible completions.
-If @var{collection} is a hash table, then the keys that are strings
-are the possible completions. Other keys are ignored.
+If @var{collection} is a hash table, then the keys that are strings or
+symbols are the possible completions. Other keys are ignored.
You can also use a function as @var{collection}. Then the function is
solely responsible for performing completion; @code{try-completion}
--
2.8.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2012-01-01 14:16 bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION Aidan Kehoe
2012-01-01 22:59 ` Stefan Monnier
2016-06-08 3:42 ` Noam Postavsky
@ 2016-06-18 16:32 ` Noam Postavsky
2016-06-18 17:20 ` Eli Zaretskii
2 siblings, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2016-06-18 16:32 UTC (permalink / raw
To: 10416; +Cc: Aidan Kehoe, Stefan Monnier
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?
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2016-06-18 16:32 ` Noam Postavsky
@ 2016-06-18 17:20 ` Eli Zaretskii
2016-06-18 19:09 ` Noam Postavsky
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2016-06-18 17:20 UTC (permalink / raw
To: Noam Postavsky; +Cc: kehoea, 10416, monnier
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Sat, 18 Jun 2016 12:32:07 -0400
> Cc: Aidan Kehoe <kehoea@parhasard.net>,
> Stefan Monnier <monnier@iro.umontreal.ca>
>
> Should we update the manual to match the docstring and code now?
Yes, as always.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION
2016-06-18 17:20 ` Eli Zaretskii
@ 2016-06-18 19:09 ` Noam Postavsky
0 siblings, 0 replies; 9+ messages in thread
From: Noam Postavsky @ 2016-06-18 19:09 UTC (permalink / raw
To: Eli Zaretskii; +Cc: Aidan Kehoe, 10416-done, Stefan Monnier
Version: 24.4
On Sat, Jun 18, 2016 at 1:20 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Noam Postavsky <npostavs@users.sourceforge.net>
>> Date: Sat, 18 Jun 2016 12:32:07 -0400
>> Cc: Aidan Kehoe <kehoea@parhasard.net>,
>> Stefan Monnier <monnier@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).
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-06-18 19:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-01 14:16 bug#10416: 24.0.92; #'test-completion is inconsistent with symbol hash keys in COLLECTION Aidan Kehoe
2012-01-01 22:59 ` Stefan Monnier
2012-01-02 0:11 ` Aidan Kehoe
2012-01-03 22:07 ` Stefan Monnier
2012-01-02 0:21 ` Aidan Kehoe
2016-06-08 3:42 ` Noam Postavsky
2016-06-18 16:32 ` Noam Postavsky
2016-06-18 17:20 ` Eli Zaretskii
2016-06-18 19:09 ` Noam Postavsky
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.