From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#4033: 23.1; list-colors-display is misleading Date: Tue, 4 Aug 2009 19:58:10 -0700 Message-ID: <986CB10EE9314167B974BF1551275370@us.oracle.com> References: <4B9B03BEE43E44B79206302B26E01B3A@us.oracle.com><87ws5j9rcv.fsf@mail.jurta.org> <6875A66084B7406B8409F2C495A75D26@us.oracle.com> Reply-To: Drew Adams , 4033@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1249441629 2221 80.91.229.12 (5 Aug 2009 03:07:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Aug 2009 03:07:09 +0000 (UTC) To: <4033@emacsbugs.donarmstrong.com>, "'Juri Linkov'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 05 05:07:01 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MYWqD-0002wY-FU for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Aug 2009 05:07:01 +0200 Original-Received: from localhost ([127.0.0.1]:35440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYWqC-0005gC-De for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Aug 2009 23:07:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MYWq7-0005fq-Fj for bug-gnu-emacs@gnu.org; Tue, 04 Aug 2009 23:06:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MYWq2-0005eV-6I for bug-gnu-emacs@gnu.org; Tue, 04 Aug 2009 23:06:54 -0400 Original-Received: from [199.232.76.173] (port=60438 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYWq2-0005eS-3t for bug-gnu-emacs@gnu.org; Tue, 04 Aug 2009 23:06:50 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:56436) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MYWq1-0005NB-HS for bug-gnu-emacs@gnu.org; Tue, 04 Aug 2009 23:06:49 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7536l1q019736; Tue, 4 Aug 2009 20:06:47 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n75355SH018960; Tue, 4 Aug 2009 20:05:05 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 05 Aug 2009 03:05:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4033 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4033-submit@emacsbugs.donarmstrong.com id=B4033.124944110718218 (code B ref 4033); Wed, 05 Aug 2009 03:05:05 +0000 Original-Received: (at 4033) by emacsbugs.donarmstrong.com; 5 Aug 2009 02:58:27 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from rgminet12.oracle.com (rcsinet12.oracle.com [148.87.113.124]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n752wMLx018211 for <4033@emacsbugs.donarmstrong.com>; Tue, 4 Aug 2009 19:58:23 -0700 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n752wCif028781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Aug 2009 02:58:14 GMT Original-Received: from abhmt005.oracle.com (abhmt005.oracle.com [141.146.116.14]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n752wbvq002483; Wed, 5 Aug 2009 02:58:37 GMT Original-Received: from dradamslap1 (/141.144.224.78) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 04 Aug 2009 19:58:12 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcoVTuZdnXz2o85zRHy9QT9NRbdW0AAJBkWwAAEnmMA= In-Reply-To: <6875A66084B7406B8409F2C495A75D26@us.oracle.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt005.oracle.com [141.146.116.14] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A010204.4A78F545.008E:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Tue, 04 Aug 2009 23:06:54 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29888 Archived-At: > > > I have had at least one user state that he thought that, since the > > > form shown is #RRGGBB, his colors had only that granularity. IOW, > > > even if one's system allows colors of the form #RRRRGGGGBBBB (more > > > colors), the color names are translated to hex strings of the form > > > #RRGGBB (fewer colors). > > > > Could you show a formula that calculates the color granularity? > > > > We could use it to print colors in the short format #RRGGBB > > for the smaller color space and #RRRRGGGGBBBB otherwise. This seems to DTRT, for printing with an RGB format that reflects the color support of the display: (defun list-colors-print (list) (let ((rgb-format (facemenu-rgb-format-for-display)) (col (car list)) rgb-width) (when (consp col) (setq col (car col))) (setq rgb-width (1+ (length (format rgb-format 1 1 1)))) (dolist (color list) (if (consp color) (when (cdr color) (setq color (sort color (lambda (a b) (string< (downcase a) (downcase b)))))) (setq color (list color))) (put-text-property (prog1 (point) (insert (car color)) (indent-to 22)) (point) 'face (list ':background (car color))) (put-text-property (prog1 (point) (insert " " (if (cdr color) (mapconcat 'identity (cdr color) ", ") (car color)))) (point) 'face (list ':foreground (car color))) (indent-to (max (- (window-width) rgb-width) 44)) (insert (apply 'format rgb-format (mapcar (lambda (c) (lsh c -8)) (color-values (car color))))) (insert "\n"))) (goto-char (point-min))) The question remains whether this is a useful/reasonable thing to do.