emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103690: Fix facemenu to populate buf


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103690: Fix facemenu to populate buffer inside the with-help-window call.
Date: Sat, 19 Mar 2011 17:37:21 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103690
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2011-03-19 17:37:21 -0400
message:
  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.
modified:
  lisp/ChangeLog
  lisp/facemenu.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-19 18:49:31 +0000
+++ b/lisp/ChangeLog    2011-03-19 21:37:21 +0000
@@ -1,3 +1,10 @@
+2011-03-19  Chong Yidong  <address@hidden>
+
+       * 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  <address@hidden>
 
        * emerge.el (emerge-metachars): Separate value for ms-dos and

=== modified file 'lisp/facemenu.el'
--- a/lisp/facemenu.el  2011-02-27 23:53:41 +0000
+++ b/lisp/facemenu.el  2011-03-19 21:37:21 +0000
@@ -567,18 +567,12 @@
   (with-help-window buffer-name
     (with-current-buffer standard-output
       (erase-buffer)
+      (list-colors-print list callback)
+      (set-buffer-modified-p nil)
       (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)
-      (message "Click on a color to select it."))))
+  (when callback
+    (pop-to-buffer buffer-name)
+    (message "Click on a color to select it.")))
 
 (defun list-colors-print (list &optional callback)
   (let ((callback-fn
@@ -595,30 +589,19 @@
       (let* ((opoint (point))
             (color-values (color-values (car color)))
             (light-p (>= (apply 'max color-values)
-                         (* (car (color-values "white")) .5)))
-            (max-len (max (- (window-width) 33) 20)))
+                         (* (car (color-values "white")) .5))))
        (insert (car color))
        (indent-to 22)
        (put-text-property opoint (point) 'face `(:background ,(car color)))
        (put-text-property
         (prog1 (point)
           (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))))
+          ;; Insert all color names.
+          (insert (mapconcat 'identity color ",")))
         (point)
         'face (list :foreground (car color)))
-       (indent-to (max (- (window-width) 8) 44))
+       (insert (propertize " " 'display '(space :align-to (- right 9))))
+       (insert " ")
        (insert (propertize
                 (apply 'format "#%02x%02x%02x"
                        (mapcar (lambda (c) (lsh c -8))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]