From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.devel Subject: list-colors-display: filter same adjecent colors Date: Mon, 23 Feb 2004 19:43:58 -0800 (PST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040224034358.17107.qmail@web60301.mail.yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077594400 5314 80.91.224.253 (24 Feb 2004 03:46:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 03:46:40 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Feb 24 04:46:33 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvTWj-0007Rb-00 for ; Tue, 24 Feb 2004 04:46:33 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvTWj-0006cI-00 for ; Tue, 24 Feb 2004 04:46:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AvTWH-0001AH-Eh for emacs-devel@quimby.gnus.org; Mon, 23 Feb 2004 22:46:05 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1AvTVu-0000kq-1c for emacs-devel@gnu.org; Mon, 23 Feb 2004 22:45:42 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AvTUn-0007Ti-J3 for emacs-devel@gnu.org; Mon, 23 Feb 2004 22:45:07 -0500 Original-Received: from [216.109.118.112] (helo=web60301.mail.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.30) id 1AvTUJ-0006Ww-L0 for emacs-devel@gnu.org; Mon, 23 Feb 2004 22:44:03 -0500 Original-Received: from [12.76.164.24] by web60301.mail.yahoo.com via HTTP; Mon, 23 Feb 2004 19:43:58 PST Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20147 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20147 This was another conversation from November. See http://mail.gnu.org/archive/html/emacs-devel/2003-11/msg00189.html Currently a color in the color list is not shown if the previous color was the same numeric color value. This patch filters out the color if the *names* are the same (i.e., "gray" and "grey" are the same, whitespace and letter case are ignored). The benefit of this change is that under w32 we have added colors based on the current desktop theme. Some of these colors may be the same but logically be different colors. As an added benefit, on my slow machine, the patch runs faster than the original code. Index: emacs/lisp/facemenu.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/facemenu.el,v retrieving revision 1.71 diff -u -b -r1.71 facemenu.el --- emacs/lisp/facemenu.el 1 Sep 2003 15:45:11 -0000 1.71 +++ emacs/lisp/facemenu.el 18 Nov 2003 18:04:08 -0000 @@ -508,12 +510,19 @@ (defun facemenu-color-equal (a b) "Return t if colors A and B are the same color. -A and B should be strings naming colors. -This function queries the display system to find out what the color -names mean. It returns nil if the colors differ or if it can't -determine the correct answer." - (cond ((equal a b) t) - ((equal (color-values a) (color-values b))))) +A and B should be strings naming colors. These names are +downcased, stripped of spaces and the string `grey' is turned +into `gray'. This accomidates alternative spellings of colors +found commonly in the list. It returns nil if the colors differ." + (progn + (setq a (replace-regexp-in-string "grey" "gray" + (replace-regexp-in-string " " "" + (downcase a))) + b (replace-regexp-in-string "grey" "gray" + (replace-regexp-in-string " " "" + (downcase b)))) + + (equal a b))) (defun facemenu-add-face (face &optional start end) "Add FACE to text between START and END. __________________________________ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools