unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Mauger <mmaug@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: Patch to display "System" colors
Date: Tue, 18 Nov 2003 10:17:33 -0800 (PST)	[thread overview]
Message-ID: <20031118181733.98610.qmail@web60304.mail.yahoo.com> (raw)
In-Reply-To: <m3k75y571s.fsf@kfs-l.imdomain.dk>

--- "Kim F. Storm" <storm@cua.dk> wrote:
> Michael Mauger <mmaug@yahoo.com> 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

  reply	other threads:[~2003-11-18 18:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-15  0:26 Patch to display "System" colors Michael Mauger
2003-11-15 14:17 ` Eli Zaretskii
2003-11-15 14:28   ` Jason Rumney
2003-11-15 14:47     ` Eli Zaretskii
2003-11-15 15:41       ` Jason Rumney
2003-11-18  1:10         ` Michael Mauger
2003-11-18 10:01           ` Kim F. Storm
2003-11-18 18:17             ` Michael Mauger [this message]
2003-11-18 23:03           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031118181733.98610.qmail@web60304.mail.yahoo.com \
    --to=mmaug@yahoo.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).