diff options
| author | Chong Yidong | 2011-03-19 17:37:21 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-03-19 17:37:21 -0400 |
| commit | fe0fb33e832ea83ffe8cab449eb41ed4acb691d9 (patch) | |
| tree | be6666b348a83ea4141b3fdb76dd9c7ea8ece86b | |
| parent | b14e3e21ec6702d27257a1400681fc36ee10282f (diff) | |
| download | emacs-fe0fb33e832ea83ffe8cab449eb41ed4acb691d9.tar.gz emacs-fe0fb33e832ea83ffe8cab449eb41ed4acb691d9.zip | |
Fix facemenu to populate buffer inside the with-help-window call.
See http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg01193.html
* facemenu.el (list-colors-display): Call list-faces-display from
inside with-help-window.
(list-colors-print): Use display property to align the final
column, instead of checking window-width.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/facemenu.el | 37 |
2 files changed, 17 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 55f0b52bb41..5244e261c11 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-03-19 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * facemenu.el (list-colors-display): Call list-faces-display | ||
| 4 | inside with-help-window. | ||
| 5 | (list-colors-print): Use display property to align the final | ||
| 6 | column, instead of checking window-width. | ||
| 7 | |||
| 1 | 2011-03-19 Eli Zaretskii <eliz@gnu.org> | 8 | 2011-03-19 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * emerge.el (emerge-metachars): Separate value for ms-dos and | 10 | * emerge.el (emerge-metachars): Separate value for ms-dos and |
diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 97862afb678..fffe09a84a5 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el | |||
| @@ -567,18 +567,12 @@ You can change the color sort order by customizing `list-colors-sort'." | |||
| 567 | (with-help-window buffer-name | 567 | (with-help-window buffer-name |
| 568 | (with-current-buffer standard-output | 568 | (with-current-buffer standard-output |
| 569 | (erase-buffer) | 569 | (erase-buffer) |
| 570 | (list-colors-print list callback) | ||
| 571 | (set-buffer-modified-p nil) | ||
| 570 | (setq truncate-lines t))) | 572 | (setq truncate-lines t))) |
| 571 | (let ((buf (get-buffer buffer-name)) | 573 | (when callback |
| 572 | (inhibit-read-only t)) | 574 | (pop-to-buffer buffer-name) |
| 573 | ;; Display buffer before generating content, to allow | 575 | (message "Click on a color to select it."))) |
| 574 | ;; `list-colors-print' to get the right window-width. | ||
| 575 | (with-selected-window (or (get-buffer-window buf t) (selected-window)) | ||
| 576 | (with-current-buffer buf | ||
| 577 | (list-colors-print list callback) | ||
| 578 | (set-buffer-modified-p nil))) | ||
| 579 | (when callback | ||
| 580 | (pop-to-buffer buf) | ||
| 581 | (message "Click on a color to select it.")))) | ||
| 582 | 576 | ||
| 583 | (defun list-colors-print (list &optional callback) | 577 | (defun list-colors-print (list &optional callback) |
| 584 | (let ((callback-fn | 578 | (let ((callback-fn |
| @@ -595,30 +589,19 @@ You can change the color sort order by customizing `list-colors-sort'." | |||
| 595 | (let* ((opoint (point)) | 589 | (let* ((opoint (point)) |
| 596 | (color-values (color-values (car color))) | 590 | (color-values (color-values (car color))) |
| 597 | (light-p (>= (apply 'max color-values) | 591 | (light-p (>= (apply 'max color-values) |
| 598 | (* (car (color-values "white")) .5))) | 592 | (* (car (color-values "white")) .5)))) |
| 599 | (max-len (max (- (window-width) 33) 20))) | ||
| 600 | (insert (car color)) | 593 | (insert (car color)) |
| 601 | (indent-to 22) | 594 | (indent-to 22) |
| 602 | (put-text-property opoint (point) 'face `(:background ,(car color))) | 595 | (put-text-property opoint (point) 'face `(:background ,(car color))) |
| 603 | (put-text-property | 596 | (put-text-property |
| 604 | (prog1 (point) | 597 | (prog1 (point) |
| 605 | (insert " ") | 598 | (insert " ") |
| 606 | (if (cdr color) | 599 | ;; Insert all color names. |
| 607 | ;; Insert as many color names as possible, fitting max-len. | 600 | (insert (mapconcat 'identity color ","))) |
| 608 | (let ((names (list (car color))) | ||
| 609 | (others (cdr color)) | ||
| 610 | (len (length (car color))) | ||
| 611 | newlen) | ||
| 612 | (while (and others | ||
| 613 | (< (setq newlen (+ len 2 (length (car others)))) | ||
| 614 | max-len)) | ||
| 615 | (setq len newlen) | ||
| 616 | (push (pop others) names)) | ||
| 617 | (insert (mapconcat 'identity (nreverse names) ", "))) | ||
| 618 | (insert (car color)))) | ||
| 619 | (point) | 601 | (point) |
| 620 | 'face (list :foreground (car color))) | 602 | 'face (list :foreground (car color))) |
| 621 | (indent-to (max (- (window-width) 8) 44)) | 603 | (insert (propertize " " 'display '(space :align-to (- right 9)))) |
| 604 | (insert " ") | ||
| 622 | (insert (propertize | 605 | (insert (propertize |
| 623 | (apply 'format "#%02x%02x%02x" | 606 | (apply 'format "#%02x%02x%02x" |
| 624 | (mapcar (lambda (c) (lsh c -8)) | 607 | (mapcar (lambda (c) (lsh c -8)) |