GNU bug report logs - #4033
23.1; list-colors-display is misleading

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Tue, 4 Aug 2009 16:10:07 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>
Cc: <4033 <at> debbugs.gnu.org>
Subject: bug#4033: 23.1; list-colors-display is misleading
Date: Tue, 4 Aug 2009 19:36:06 -0700
> What about something like this:
> 
> (defun rgb-color-format-for-display ()
>   (let ((ncolors  (display-color-cells (selected-frame)))
>         (exp      0))
>     (while (> (lsh ncolors (- exp)) 1) (setq exp  (1+ exp)))
>     (setq exp  (/ exp 12))
>     (format "#%%0%dx%%0%dx%%0%dx" exp exp exp)))
> 
> For 16777216 colors, that gives #%02x%02x%02x, which seems right.
> 
> In `list-colors-print', we would then do this:
> 
> (insert (apply 'format (rgb-color-format-for-display)
>                (mapcar (lambda (c) (lsh c -8))
>                          (color-values (car color)))))
> 
> IOW, replace the hard-coded "#%02x%02x%02x" with 
> (rgb-color-format-for-display).

We would also want to first do that for one of the colors, to get the field
width, then use that here:

(indent-to (max (- (window-width) RGB-WIDTH) 44))

instead of hard-coding a width of 8, as now:

(indent-to (max (- (window-width) 8) 44))




This bug report was last modified 15 years and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.