From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES with duplicates Date: Fri, 20 Dec 2013 14:16:07 -0800 (PST) Message-ID: <1d87f9c8-242e-487b-b902-28ba1cb9c85c@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1387577843 1882 80.91.229.3 (20 Dec 2013 22:17:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Dec 2013 22:17:23 +0000 (UTC) To: 16208@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 20 23:17:28 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vu8Nr-0003r3-Lr for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Dec 2013 23:17:27 +0100 Original-Received: from localhost ([::1]:52081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Nr-0006K9-2p for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Dec 2013 17:17:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Nd-0006J7-8z for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:17:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vu8NT-0004Nl-3L for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:17:13 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8NT-0004Nh-0D for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:17:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vu8NS-0001wg-H5 for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Dec 2013 22:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13875778057437 (code B ref -1); Fri, 20 Dec 2013 22:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Dec 2013 22:16:45 +0000 Original-Received: from localhost ([127.0.0.1]:60524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu8NA-0001vt-Jo for submit@debbugs.gnu.org; Fri, 20 Dec 2013 17:16:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57655) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu8N8-0001vk-3F for submit@debbugs.gnu.org; Fri, 20 Dec 2013 17:16:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vu8Mx-0004JC-9C for submit@debbugs.gnu.org; Fri, 20 Dec 2013 17:16:41 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:33958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Mx-0004J2-6z for submit@debbugs.gnu.org; Fri, 20 Dec 2013 17:16:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Mo-0006H7-GP for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:16:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vu8Me-0004GU-Hq for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:16:22 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:30383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vu8Me-0004GQ-AQ for bug-gnu-emacs@gnu.org; Fri, 20 Dec 2013 17:16:12 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rBKMG9Ce005692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Dec 2013 22:16:10 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rBKMG8PP004634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 20 Dec 2013 22:16:09 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rBKMG8CG012138 for ; Fri, 20 Dec 2013 22:16:08 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82304 Archived-At: `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@gmx.at-20131216095844-lbjh5yerk6ff0tm7 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/binary --enable-checking=3Dyes,glyphs 'CFLAGS=3D-O0 -g3' LDFLAGS=3D-Lc:/Devel/emacs/lib CPPFLAGS=3D-Ic:/Devel/emacs/include'