GNU bug report logs - #16208
24.3.50; `locate-file-completion-table' uses NAMES with duplicates

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Fri, 20 Dec 2013 22:17:02 UTC

Severity: minor

Found in version 24.3.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 16208 in the body.
You can then email your comments to 16208 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#16208; Package emacs. (Fri, 20 Dec 2013 22:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 20 Dec 2013 22:17:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; `locate-file-completion-table' uses NAMES with duplicates
Date: Fri, 20 Dec 2013 14:16:07 -0800 (PST)
`completion-all-completions' with `locate-file-completion-table' returns
this list, when doing `M-x load-library mule TAB TAB':

(#("mule-cmds" 0 4 (face (completions-common-part)) 4 5 (face
(completions-first-difference))) #("mule-conf" 0 4 (face
(completions-common-part)) 4 5 (face (completions-first-difference)))
#("mule-conf" 0 4 (face (completions-common-part)) 4 5 (face
(completions-first-difference))) #("mule-diag" 0 4 (face
(completions-common-part)) 4 5 (face (completions-first-difference)))
#("mule-diag" 0 4 (face (completions-common-part)) 4 5 (face
(completions-first-difference))) #("mule-util" 0 4 (face
(completions-common-part)) 4 5 (face (completions-first-difference)))
#("mule-util" 0 4 (face (completions-common-part)) 4 5 (face
(completions-first-difference))) #("mule" 0 4 (face
(completions-common-part))) #("mule" 0 4 (face
(completions-common-part))) . 0)

Each candidate in the list, except the first, `mule-cmds', is repeated
(two occurrences of each).

Please remove the duplicates.  The duplicates are not seen in emacs -Q
- they are apparently being filtered out afterward.

In my context, `completing-read' (my version) does not necessarily
remove duplicates, as they can have different associated data and I
sometimes make use of this data.  IOW, there can be candidates with
different associated data but with the same display string in
*Completions*.

In my context, it is up to the particular command calling
`completing-read' to decide whether to remove duplicates.

In this case, the command is a standard one, `load-library'.  I do not
want to have to define my own version (e.g. wrapper) of `load-library',
just to have it remove the duplicates.  My code uses
`completion-all-completions', and in this case, that is returning
duplicates.  This is rare, fortunately - I don't think I've encountered
this problem before.

A naive guess would be that this is the problematic code, in
`locate-file-completion-table', but this is really a wild guess:

 ;; Remove duplicates of the first element, so that we can easily check
 ;; if `names' really only contains a single element.
 (when (cdr names) (setcdr names (delete (car names) (cdr names))))

The guess would be that perhaps `when' should be `while', here (?).
Dunno.  But the comment makes it clear that this is not intended to
remove duplicates in general, so perhaps this is not the culprit.

Anyway, I'd apprciate it if `locate-file-completion-table' were fixed so
that when `completion-all-completions' uses it it did not return
duplicates.




In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-12-16 on ODIEONE
Bzr revision: 115543 rudalics <at> gmx.at-20131216095844-lbjh5yerk6ff0tm7
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16208; Package emacs. (Mon, 23 Dec 2013 02:59:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 16208 <at> debbugs.gnu.org
Subject: Re: bug#16208: 24.3.50;
 `locate-file-completion-table' uses NAMES with duplicates
Date: Sun, 22 Dec 2013 21:58:00 -0500
> In my context, it is up to the particular command calling
> `completing-read' to decide whether to remove duplicates.

I don't see why we should take this change of yours into account.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16208; Package emacs. (Mon, 23 Dec 2013 05:55:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 16208 <at> debbugs.gnu.org
Subject: RE: bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES
 with duplicates
Date: Sun, 22 Dec 2013 21:54:07 -0800 (PST)
> > I'd appreciate it if `locate-file-completion-table' were fixed
> > so that when `completion-all-completions' uses it, it did not
> > return duplicates.


> I don't see why we should take this change of yours into account.

This is the question: Why should `completion-all-completions' with
`locate-file-completion-table' return duplicate names?

You may say that whatever someone decides to do with the result
from `completion-all-completions' is not your concern.  But why?

Why not have it return all of the completions here, with no
duplicates, as is normally the case?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16208; Package emacs. (Mon, 23 Dec 2013 14:00:04 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 16208 <at> debbugs.gnu.org
Subject: Re: bug#16208: 24.3.50;
 `locate-file-completion-table' uses NAMES with duplicates
Date: Mon, 23 Dec 2013 08:59:02 -0500
> This is the question: Why should `completion-all-completions' with
> `locate-file-completion-table' return duplicate names?

Because it doesn't matter, since it's filtered later on,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16208; Package emacs. (Mon, 23 Dec 2013 15:17:01 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 16208 <at> debbugs.gnu.org
Subject: RE: bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES
 with duplicates
Date: Mon, 23 Dec 2013 07:16:13 -0800 (PST)
> > Why should `completion-all-completions' with
> > `locate-file-completion-table' return duplicate names?
> > 
> > You may say that whatever someone decides to do with the result
> > from `completion-all-completions' is not your concern.  But why?
> 
> Because it doesn't matter, since it's filtered later on

It's not filtered by `completion-all-completions' with
`locate-file-completion-table'.

So you are apparently saying that there is only one possible use
and calling function for `completion-all-completions' with
`locate-file-completion-table', so that indeed:

> > whatever someone decides to do with the result
> > from `completion-all-completions' is not your concern

Not very helpful, or cooperative.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16208; Package emacs. (Tue, 24 Dec 2013 03:10:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 16208 <at> debbugs.gnu.org
Subject: Re: bug#16208: 24.3.50;
 `locate-file-completion-table' uses NAMES with duplicates
Date: Mon, 23 Dec 2013 22:09:00 -0500
> It's not filtered by `completion-all-completions' with
> `locate-file-completion-table'.

Who cares?

> Not very helpful, or cooperative.

You might get better results if you send patches.  Maybe moving the
duplicate-filtering into completion-all-completions would work fine.
I can't tell, because I can't be bothered to spend the time trying it
since it doesn't affect any code I understand.


        Stefan




bug closed, send any further explanations to 16208 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Feb 2014 02:53:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 08 Mar 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 162 days ago.

Previous Next


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