GNU bug report logs - #15889
24.3; mysterious (cons nil features) in read-feature

Previous Next

Package: emacs;

Reported by: Leo Liu <shidai.liu <at> gmail.com>

Date: Thu, 14 Nov 2013 05:32:02 UTC

Severity: normal

Found in version 24.3

Done: Leo Liu <sdl.web <at> gmail.com>

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 15889 in the body.
You can then email your comments to 15889 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 monnier <at> iro.umontreal.ca, bojohan <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#15889; Package emacs. (Thu, 14 Nov 2013 05:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <shidai.liu <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bojohan <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Thu, 14 Nov 2013 05:32:02 GMT) Full text and rfc822 format available.

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

From: Leo Liu <shidai.liu <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; mysterious (cons nil features) in read-feature
Date: Thu, 14 Nov 2013 13:31:21 +0800
[Message part 1 (text/plain, inline)]
So apparently try-/all-/test-completion(s) functions test if COLLECTION
is a function imprecisely. I propose we fix these functions. Objections?

=== modified file 'src/minibuf.c'
--- src/minibuf.c	2013-11-06 04:11:04 +0000
+++ src/minibuf.c	2013-11-14 05:23:53 +0000
@@ -1199,9 +1199,7 @@
     type = (HASH_TABLE_P (collection) ? hash_table
 	    : VECTORP (collection) ? obarray_table
 	    : ((NILP (collection)
-		|| (CONSP (collection)
-		    && (!SYMBOLP (XCAR (collection))
-			|| NILP (XCAR (collection)))))
+		|| (CONSP (collection) && !FUNCTIONP (collection)))
 	       ? list_table : function_table));
   ptrdiff_t idx = 0, obsize = 0;
   int matchcount = 0;
@@ -1460,9 +1458,7 @@
   Lisp_Object allmatches;
   int type = HASH_TABLE_P (collection) ? 3
     : VECTORP (collection) ? 2
-    : NILP (collection) || (CONSP (collection)
-			    && (!SYMBOLP (XCAR (collection))
-				|| NILP (XCAR (collection))));
+    : NILP (collection) || (CONSP (collection) && !FUNCTIONP (collection));
   ptrdiff_t idx = 0, obsize = 0;
   ptrdiff_t bindcount = -1;
   Lisp_Object bucket, tem, zero;
@@ -1691,9 +1687,7 @@
 
   CHECK_STRING (string);
 
-  if ((CONSP (collection)
-       && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection))))
-      || NILP (collection))
+  if ((CONSP (collection) && !FUNCTIONP (collection)) || NILP (collection))
     {
       tem = Fassoc_string (string, collection, completion_ignore_case ? Qt : Qnil);
       if (NILP (tem))



[Message part 2 (message/rfc822, inline)]
From: Johan Bockgård <bojohan <at> gnu.org>
To: emacs-devel <at> gnu.org
Subject: Re: mysterious (cons nil features) in read-feature
Date: Wed, 13 Nov 2013 23:30:06 +0100
Leo Liu <sdl.web <at> gmail.com> writes:

> I have asked Stefan and Kim and neither has a definite answer. Kim
> pointed me to
> http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg00251.html. I
> have read that and checked the commit logs but I have no answer either.
>
> Anyone else know why (cons nil features)? If not, I plan to remove nil
> and its checking in read-feature.

If you remove it, you will get an error when you try to complete.

The documentation (info "(elisp) Basic Completion") used to allow a list
of symbols as a completion table,

     If COLLECTION is an alist (*note Association Lists::), the
     permissible completions are the elements of the alist that are
     either strings, symbols, or conses whose CAR is a string or symbol.
     Symbols are converted to strings using `symbol-name'.  Other
     elements of the alist are ignored. (Remember that in Emacs Lisp,
     the elements of alists do not _have_ to be conses.)  In
     particular, a list of strings or symbols is allowed, even though
     we usually do not think of such lists as alists.

However this did (and still does) in fact only work if the first symbol
in the list is `nil' (or is not a symbol at all).

Later the documentation was "fixed" to say,

     If COLLECTION is an list [sic], the permissible completions are
     specified by the elements of the list, each of which should be
     either a string, or a cons cell whose CAR is either a string or a
     symbol (a symbol is converted to a string using `symbol-name').
     If the list contains elements of any other type, those are ignored.

But this is not true either, since symbols are not ignored. (If the
first symbol is `nil', completion works. With any other symbol (except
`lambda'), it gives an invalid-function error.)



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15889; Package emacs. (Thu, 14 Nov 2013 19:44:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <shidai.liu <at> gmail.com>
Cc: 15889 <at> debbugs.gnu.org,
 Johan Bockgård <bojohan <at> gnu.org>
Subject: Re: bug#15889: 24.3; mysterious (cons nil features) in read-feature
Date: Thu, 14 Nov 2013 14:42:49 -0500
> So apparently try-/all-/test-completion(s) functions test if COLLECTION
> is a function imprecisely. I propose we fix these functions. Objections?

None here,


        Stefan




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Fri, 15 Nov 2013 06:57:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <shidai.liu <at> gmail.com>:
bug acknowledged by developer. (Fri, 15 Nov 2013 06:57:03 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: 15889-done <at> debbugs.gnu.org
Subject: Re: bug#15889: 24.3; mysterious (cons nil features) in read-feature
Date: Fri, 15 Nov 2013 14:56:14 +0800
Fixed in 24.4




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Dec 2013 12:24:30 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 146 days ago.

Previous Next


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