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: Re: Patch to display "System" colors Date: Tue, 18 Nov 2003 10:17:33 -0800 (PST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20031118181733.98610.qmail@web60304.mail.yahoo.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069179587 23679 80.91.224.253 (18 Nov 2003 18:19:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Nov 2003 18:19:47 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Nov 18 19:19:44 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMAS0-0001vk-00 for ; Tue, 18 Nov 2003 19:19:44 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMARz-0002xe-00 for ; Tue, 18 Nov 2003 19:19:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMBOc-0003qE-6u for emacs-devel@quimby.gnus.org; Tue, 18 Nov 2003 14:20:18 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AMBNx-0003oe-Ae for emacs-devel@gnu.org; Tue, 18 Nov 2003 14:19:37 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AMBNQ-0003OB-Jv for emacs-devel@gnu.org; Tue, 18 Nov 2003 14:19:36 -0500 Original-Received: from [216.109.118.115] (helo=web60304.mail.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.24) id 1AMBNK-0003NP-Lg for emacs-devel@gnu.org; Tue, 18 Nov 2003 14:18:58 -0500 Original-Received: from [12.91.10.56] by web60304.mail.yahoo.com via HTTP; Tue, 18 Nov 2003 10:17:33 PST Original-To: "Kim F. Storm" , Eli Zaretskii , Jason Rumney In-Reply-To: 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:17889 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17889 --- "Kim F. Storm" wrote: > Michael Mauger writes: > > > Is there an existing elisp function to replace substrings within an > > original string with replacement substrings? See > > `facemenu-string-match-and-replace' in the patch below. > > replace-regexp-in-string > Thanks. I'm not sure how I missed that one... Here's the updated patch... 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!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree