unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* completing-read displays duplicates in the *Completions* buffer
@ 2005-12-20 17:30 Kevin Rodgers
  2005-12-20 19:49 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Rodgers @ 2005-12-20 17:30 UTC (permalink / raw)


Stefan asked me to report this bug:

In GNU Emacs 21.4.1 (i386-pc-solaris2.8, X toolkit, Xaw3d scroll bars)
  of 2005-09-21 on daedal
configured using `configure  --prefix=/opt/csw'

Evaluate the following, then type `?' at the prompt:

(completing-read "Prompt: " '(("a") ("b") ("c") ("a") ("b") ("c")))

The *Completions* buffer contents are:

/---
| Click <mouse-2> on a completion to select it.
| In this buffer, type RET to select the completion near point.
|
| Possible completions are:
| a                                  a
| b                                  b
| c                                  c
\---

Even if the code is changed to use eq strings or eq sublists, the
duplicates are displayed:

(let ((a "a") (b "b") (c "c"))
   (completing-read "Prompt: "
                    (list (list a) (list b) (list c)
                          (list a) (list b) (list c))))

(let ((a (list "a")) (b (list "b")) (c (list "c")))
   (completing-read "Prompt: "
                    (list a b c a b c)))

-- 
Kevin Rodgers

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

* RE: completing-read displays duplicates in the *Completions* buffer
  2005-12-20 17:30 completing-read displays duplicates in the *Completions* buffer Kevin Rodgers
@ 2005-12-20 19:49 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2005-12-20 19:49 UTC (permalink / raw)


    Evaluate the following, then type `?' at the prompt:

    (completing-read "Prompt: " '(("a") ("b") ("c") ("a") ("b") ("c")))

    The *Completions* buffer contents are:

    /---
    | Click <mouse-2> on a completion to select it.
    | In this buffer, type RET to select the completion near point.
    |
    | Possible completions are:
    | a                                  a
    | b                                  b
    | c                                  c
    \---

I'm not convinced that this is a bug.

There is nothing in the doc of `completing-read' or `all-completions' that
suggests that these functions should remove duplicates. This has _always_
been the behavior of these functions, AFAIK. Changing this behavior could
break existing libraries (at least external libraries) that might depend on
it.

Niether of these functions removes duplicates, but you can make sure there
are no duplicates, if you like, by passing them an appropriate TABLE
argument. IOW, as the Doctor says, "If it hurts, don't do that!"

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

end of thread, other threads:[~2005-12-20 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-20 17:30 completing-read displays duplicates in the *Completions* buffer Kevin Rodgers
2005-12-20 19:49 ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).