mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-23 18:47:57 +00:00
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.
This commit is contained in:
parent
b14e3e21ec
commit
fe0fb33e83
@ -1,3 +1,10 @@
|
|||||||
|
2011-03-19 Chong Yidong <cyd@stupidchicken.com>
|
||||||
|
|
||||||
|
* facemenu.el (list-colors-display): Call list-faces-display
|
||||||
|
inside with-help-window.
|
||||||
|
(list-colors-print): Use display property to align the final
|
||||||
|
column, instead of checking window-width.
|
||||||
|
|
||||||
2011-03-19 Eli Zaretskii <eliz@gnu.org>
|
2011-03-19 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* emerge.el (emerge-metachars): Separate value for ms-dos and
|
* emerge.el (emerge-metachars): Separate value for ms-dos and
|
||||||
|
@ -567,18 +567,12 @@ You can change the color sort order by customizing `list-colors-sort'."
|
|||||||
(with-help-window buffer-name
|
(with-help-window buffer-name
|
||||||
(with-current-buffer standard-output
|
(with-current-buffer standard-output
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
|
(list-colors-print list callback)
|
||||||
|
(set-buffer-modified-p nil)
|
||||||
(setq truncate-lines t)))
|
(setq truncate-lines t)))
|
||||||
(let ((buf (get-buffer buffer-name))
|
(when callback
|
||||||
(inhibit-read-only t))
|
(pop-to-buffer buffer-name)
|
||||||
;; Display buffer before generating content, to allow
|
(message "Click on a color to select it.")))
|
||||||
;; `list-colors-print' to get the right window-width.
|
|
||||||
(with-selected-window (or (get-buffer-window buf t) (selected-window))
|
|
||||||
(with-current-buffer buf
|
|
||||||
(list-colors-print list callback)
|
|
||||||
(set-buffer-modified-p nil)))
|
|
||||||
(when callback
|
|
||||||
(pop-to-buffer buf)
|
|
||||||
(message "Click on a color to select it."))))
|
|
||||||
|
|
||||||
(defun list-colors-print (list &optional callback)
|
(defun list-colors-print (list &optional callback)
|
||||||
(let ((callback-fn
|
(let ((callback-fn
|
||||||
@ -595,30 +589,19 @@ You can change the color sort order by customizing `list-colors-sort'."
|
|||||||
(let* ((opoint (point))
|
(let* ((opoint (point))
|
||||||
(color-values (color-values (car color)))
|
(color-values (color-values (car color)))
|
||||||
(light-p (>= (apply 'max color-values)
|
(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))
|
(insert (car color))
|
||||||
(indent-to 22)
|
(indent-to 22)
|
||||||
(put-text-property opoint (point) 'face `(:background ,(car color)))
|
(put-text-property opoint (point) 'face `(:background ,(car color)))
|
||||||
(put-text-property
|
(put-text-property
|
||||||
(prog1 (point)
|
(prog1 (point)
|
||||||
(insert " ")
|
(insert " ")
|
||||||
(if (cdr color)
|
;; Insert all color names.
|
||||||
;; Insert as many color names as possible, fitting max-len.
|
(insert (mapconcat 'identity color ",")))
|
||||||
(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)
|
(point)
|
||||||
'face (list :foreground (car color)))
|
'face (list :foreground (car color)))
|
||||||
(indent-to (max (- (window-width) 8) 44))
|
(insert (propertize " " 'display '(space :align-to (- right 9))))
|
||||||
|
(insert " ")
|
||||||
(insert (propertize
|
(insert (propertize
|
||||||
(apply 'format "#%02x%02x%02x"
|
(apply 'format "#%02x%02x%02x"
|
||||||
(mapcar (lambda (c) (lsh c -8))
|
(mapcar (lambda (c) (lsh c -8))
|
||||||
|
Loading…
Reference in New Issue
Block a user