aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2005-01-12 00:33:00 +0000
committerJuri Linkov2005-01-12 00:33:00 +0000
commit987d1819c1486eb76d341ba22c8152fd07c89005 (patch)
treee27454c6771a1d8b2f8623f869039ea441c36105
parent066a23af25db3836c7dcc4d7f43ee63a2bb9b1dc (diff)
downloademacs-987d1819c1486eb76d341ba22c8152fd07c89005.tar.gz
emacs-987d1819c1486eb76d341ba22c8152fd07c89005.zip
* facemenu.el (list-colors-print): New function created from code
in list-colors-display. Print #RRGGBB at the window right edge. (list-colors-display): When temp-buffer-show-function is not defined, call list-colors-print from temp-buffer-show-hook to get the right value of window-width in list-colors-print after the buffer is displayed.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/facemenu.el57
2 files changed, 43 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a4c4c0d030e..bfd88a6e9f7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -10,6 +10,13 @@
10 (list-colors-duplicates): New function. 10 (list-colors-duplicates): New function.
11 (facemenu-color-name-equal): Delete function. 11 (facemenu-color-name-equal): Delete function.
12 12
13 * facemenu.el (list-colors-print): New function created from code
14 in list-colors-display. Print #RRGGBB at the window right edge.
15 (list-colors-display): When temp-buffer-show-function is not
16 defined, call list-colors-print from temp-buffer-show-hook
17 to get the right value of window-width in list-colors-print
18 after the buffer is displayed.
19
132005-01-12 Juri Linkov <juri@jurta.org> 202005-01-12 Juri Linkov <juri@jurta.org>
14 21
15 * isearch.el (search-highlight, isearch, isearch-lazy-highlight): 22 * isearch.el (search-highlight, isearch, isearch-lazy-highlight):
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 7179523eec8..127b8fe608b 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -489,27 +489,42 @@ argument BUFFER-NAME is nil, it defaults to *Colors*."
489 (save-excursion 489 (save-excursion
490 (set-buffer standard-output) 490 (set-buffer standard-output)
491 (setq truncate-lines t) 491 (setq truncate-lines t)
492 (dolist (color list) 492 (if temp-buffer-show-function
493 (if (consp color) 493 (list-colors-print list)
494 (if (cdr color) 494 ;; Call list-colors-print from temp-buffer-show-hook
495 (setq color (sort color (lambda (a b) 495 ;; to get the right value of window-width in list-colors-print
496 (string< (downcase a) 496 ;; after the buffer is displayed.
497 (downcase b)))))) 497 (add-hook 'temp-buffer-show-hook
498 (setq color (list color))) 498 (lambda () (list-colors-print list)) nil t)))))
499 (put-text-property 499
500 (prog1 (point) 500(defun list-colors-print (list)
501 (insert (car color)) 501 (dolist (color list)
502 (indent-to 22)) 502 (if (consp color)
503 (point) 503 (if (cdr color)
504 'face (cons 'background-color (car color))) 504 (setq color (sort color (lambda (a b)
505 (put-text-property 505 (string< (downcase a)
506 (prog1 (point) 506 (downcase b))))))
507 (insert " " (if (cdr color) 507 (setq color (list color)))
508 (mapconcat 'identity (cdr color) ", ") 508 (put-text-property
509 (car color)) 509 (prog1 (point)
510 "\n")) 510 (insert (car color))
511 (point) 511 (indent-to 22))
512 'face (cons 'foreground-color (car color))))))) 512 (point)
513 'face (cons 'background-color (car color)))
514 (put-text-property
515 (prog1 (point)
516 (insert " " (if (cdr color)
517 (mapconcat 'identity (cdr color) ", ")
518 (car color)))
519 (indent-to (max (- (window-width) 8) 44))
520 (insert (apply 'format " #%02x%02x%02x"
521 (mapcar (lambda (c) (lsh c -8))
522 (color-values (car color)))))
523
524 (insert "\n"))
525 (point)
526 'face (cons 'foreground-color (car color))))
527 (goto-char (point-min)))
513 528
514(defun list-colors-duplicates (&optional list) 529(defun list-colors-duplicates (&optional list)
515 "Return a list of colors with grouped duplicate colors. 530 "Return a list of colors with grouped duplicate colors.