[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to display "System" colors

From: Michael Mauger
Subject: Re: Patch to display "System" colors
Date: Tue, 18 Nov 2003 10:17:33 -0800 (PST)

--- "Kim F. Storm" <address@hidden> wrote:
> Michael Mauger <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]