all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 16208@debbugs.gnu.org
Subject: bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES with duplicates
Date: Fri, 20 Dec 2013 14:16:07 -0800 (PST)	[thread overview]
Message-ID: <1d87f9c8-242e-487b-b902-28ba1cb9c85c@default> (raw)

`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=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'





             reply	other threads:[~2013-12-20 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 22:16 Drew Adams [this message]
2013-12-23  2:58 ` bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES with duplicates Stefan Monnier
2013-12-23  5:54   ` Drew Adams
2013-12-23 13:59     ` Stefan Monnier
2013-12-23 15:16       ` Drew Adams
2013-12-24  3:09         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d87f9c8-242e-487b-b902-28ba1cb9c85c@default \
    --to=drew.adams@oracle.com \
    --cc=16208@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.