Mercurial > emacs
diff lisp/facemenu.el @ 108979:6d1b80d173b3
Add all rgb.txt color names to x-colors.
* facemenu.el (list-colors-print): Don't print extra names if it
will overflow the window width.
* term/common-win.el (x-colors): Add all the color names defined
in rgb.txt (Bug#6332).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 12 Jun 2010 13:12:15 -0400 |
parents | 96ec3562df8f |
children | 8f3a9d4ebe87 |
line wrap: on
line diff
--- a/lisp/facemenu.el Sat Jun 12 14:30:48 2010 +0300 +++ b/lisp/facemenu.el Sat Jun 12 13:12:15 2010 -0400 @@ -526,15 +526,27 @@ (let* ((opoint (point)) (color-values (color-values (car color))) (light-p (>= (apply 'max color-values) - (* (car (color-values "white")) .5)))) + (* (car (color-values "white")) .5))) + (max-len (max (- (window-width) 33) 20))) (insert (car color)) (indent-to 22) (put-text-property opoint (point) 'face `(:background ,(car color))) (put-text-property (prog1 (point) - (insert " " (if (cdr color) - (mapconcat 'identity (cdr color) ", ") - (car color)))) + (insert " ") + (if (cdr color) + ;; Insert as many color names as possible, fitting max-len. + (let ((names (list (car color))) + (others (cdr color)) + (len (length (car color))) + newlen) + (while (and others + (< (setq newlen (+ len 2 (length (car others)))) + max-len)) + (setq len newlen) + (push (pop others) names)) + (insert (mapconcat 'identity (nreverse names) ", "))) + (insert (car color)))) (point) 'face (list :foreground (car color))) (indent-to (max (- (window-width) 8) 44))