From: Michael Mauger <mmaug@yahoo.com>
Subject: Re: list-colors-display: filter same adjecent colors
Date: Tue, 18 May 2004 14:13:15 -0700 (PDT) [thread overview]
Message-ID: <20040518211315.66216.qmail@web60310.mail.yahoo.com> (raw)
I think we had agreed on this one. Can it be committed?
Index: emacs/lisp/facemenu.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/facemenu.el,v
retrieving revision 1.71
diff -u -r1.71 facemenu.el
--- emacs/lisp/facemenu.el 1 Sep 2003 15:45:11 -0000 1.71
+++ emacs/lisp/facemenu.el 13 Mar 2004 21:59:20 -0000
@@ -480,9 +480,19 @@
(when (and (null list) (> (display-color-cells) 0))
(setq list (defined-colors))
;; Delete duplicate colors.
+
+ ;; Identify duplicate colors by the name rather than the color
+ ;; value. On w32, logical colors are added to the list that might
+ ;; have the same value but have different names and meanings. For
+ ;; example, `SystemMenuText' (the color w32 uses for the text in
+ ;; menu entries) and `SystemWindowText' (the default color w32
+ ;; uses for the text in windows and dialogs) may be the same
+ ;; display color and be adjacent in the list. Detecting
+ ;; duplicates by name insures that both of these colors remain
+ ;; despite similar color values.
(let ((l list))
(while (cdr l)
- (if (facemenu-color-equal (car l) (car (cdr l)))
+ (if (facemenu-color-name-equal (car l) (car (cdr l)))
(setcdr l (cdr (cdr l)))
(setq l (cdr l)))))
(when (memq (display-visual-class) '(gray-scale pseudo-color
direct-color))
@@ -514,6 +524,22 @@
determine the correct answer."
(cond ((equal a b) t)
((equal (color-values a) (color-values b)))))
+
+(defun facemenu-color-name-equal (a b)
+ "Return t if colors A and B are the same color.
+A and B should be strings naming colors. These names are
+downcased, stripped of spaces and the string `grey' is turned
+into `gray'. This accommodates 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.
next reply other threads:[~2004-05-18 21:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-18 21:13 Michael Mauger [this message]
2004-05-20 17:55 ` list-colors-display: filter same adjecent colors Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2004-02-24 3:43 Michael Mauger
2004-02-24 6:43 ` Eli Zaretskii
2004-03-05 23:49 ` Michael Mauger
2004-03-06 8:51 ` Eli Zaretskii
2004-04-06 3:08 ` Michael Mauger
2004-04-15 13:18 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040518211315.66216.qmail@web60310.mail.yahoo.com \
--to=mmaug@yahoo.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.