From df7f0d0b10ce31a6f1a8b7e979e120c695699d5a Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 27 Feb 2011 18:53:41 -0500 Subject: [PATCH] * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048). --- lisp/ChangeLog | 4 ++++ lisp/facemenu.el | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 02e6c3c56ba..94ff6303901 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2011-02-27 Chong Yidong + + * facemenu.el (list-colors-display): Use with-help-window (Bug#8048). + 2011-02-27 Prestoo Ten * term/screen.el: New file (Bug#2650). diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 360383aa32b..97862afb678 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -562,17 +562,23 @@ You can change the color sort order by customizing `list-colors-sort'." (let ((lc (nthcdr (1- (display-color-cells)) list))) (if lc (setcdr lc nil))))) - (let ((buf (get-buffer-create "*Colors*"))) - (with-current-buffer buf + (unless buffer-name + (setq buffer-name "*Colors*")) + (with-help-window buffer-name + (with-current-buffer standard-output (erase-buffer) - (setq truncate-lines t) - ;; Display buffer before generating content to allow - ;; `list-colors-print' to get the right window-width. + (setq truncate-lines t))) + (let ((buf (get-buffer buffer-name)) + (inhibit-read-only t)) + ;; Display buffer before generating content, to allow + ;; `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) - (list-colors-print list callback) - (set-buffer-modified-p nil))) - (if callback - (message "Click on a color to select it."))) + (message "Click on a color to select it.")))) (defun list-colors-print (list &optional callback) (let ((callback-fn -- 2.39.2