all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES with duplicates
@ 2013-12-20 22:16 Drew Adams
  2013-12-23  2:58 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2013-12-20 22:16 UTC (permalink / raw)
  To: 16208

`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'





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-24  3:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 22:16 bug#16208: 24.3.50; `locate-file-completion-table' uses NAMES with duplicates Drew Adams
2013-12-23  2:58 ` 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

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.