Subject: bug#9722: list-colors-duplicates does not exclude enough colors on Windows

From: Juanma Barranquero <[email-masked]>
Date: Tue, 11 Oct 2011 22:54:22 +0200

On Tue, Oct 11, 2011 at 21:39, Eli Zaretskii <[email-masked]> wrote:

> What is the purpose of checking w32-default-color-map?  Is it solely
> for detecting the System* colors?

Well, I don't really know, but in that function that's the only thing
it is used for. revno:59445, which introduced list-colors-duplicates
and the use of w32-default-color-map, removed the following comment

    ;; Identify duplicate colors by the name rather than the color
    ;; value.  For example, on MS-Windows, logical colors are added to
    ;; the list that might have the same value but have different
    ;; names and meanings.  For example, `SystemMenuText' (the color
    ;; w32 uses for the text in menu entries) and `SystemWindowText'
    ;; (the default color w32 uses for the text in windows and
    ;; dialogs) may be the same display color and be adjacent in the
    ;; list.  Detecting duplicates by name insures that both of these
    ;; colors remain despite identical color values.

so it seems that was the only intention.

BTW, if we remove the call to w32-d-c-m from list-colors-duplicates,
its only use will be in w32fns.c:Fx_open_connection (to initialize
Vw32_color_map) and then it is no longer necessary to have it as a
lisp level function.

> That sounds an odd method of doing so.

Yes.

> It is also fragile: it means any color not in
> w32-default-color-map will pass the duplicate test.

Not sure what you mean with "pass the duplicate test". It means that
any color not in w32-default-color-map will never be considered
duplicate of another color.

> No, they aren't.  Don't you see the lines below?
>
>  dark slate gray       dark slate gray,dark slate grey,DarkSlateGray,DarkSlateGrey  #2f4f4f
>  dim gray              dim gray,dim grey,DimGray,DimGrey  #696969
>  slate gray            slate gray,slate grey,SlateGray,SlateGrey  #708090
>  light slate gray      light slate gray,light slate grey,LightSlateGray,LightSlateGrey  #778899
>  light gray            light gray,light grey,LightGray,LightGrey  #d3d3d3

Yes, I see them. That means that list-colors-duplicates is correctly
detecting them as duplicates:

ELISP> (list-colors-duplicates '("black" "dark slate gray" "dark slate
gray" "dark slate grey" "DarkSlateGray" "DarkSlateGrey"))
(("black")
 ("dark slate gray" "DarkSlateGrey" "DarkSlateGray" "dark slate grey"
"dark slate gray"))

Or am I missing something?

    Juanma