[AC21.5] [Bug: 21.5-b21] list-colors-display

Stephen J. Turnbull stephen at xemacs.org
Sun Oct 7 02:54:43 EDT 2007


APPROVE COMMIT 21.5

Not for 21.4.

Please direct further discussion of the patch to XEmacs Patches
<xemacs-patches at xemacs.org>.  Reply-To set.

Stephen J. Turnbull writes:

 > Andreas Röhler writes:
 >  > 
 >  > Command `list-colors-display' fails with error: 
 >  > 
 >  > "Wrong type argument: stringp, ("lightgreen")
 >  > 
 >  > Diff below fixes it for me.
 > 
 > And probably breaks it on TTYs, where it currently works fine.  This
 > requires more in-depth analysis.

What I came up with is below.  Test suite passes, some light
interactive testing works on X11 and TTY devices.  Rationale is in the
comment in x-faces.el.

Please watch for anomolies in color-handling.  Shouldn't be any, AFAIK
this device method is only used for giving the user information.
That's why this bug hasn't been seen before now (it's been there since
2005-01-28).

Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.847
diff -u -U0 -r1.847 ChangeLog
--- lisp/ChangeLog	3 Oct 2007 16:53:38 -0000	1.847
+++ lisp/ChangeLog	7 Oct 2007 05:39:11 -0000
@@ -0,0 +1,5 @@
+2007-10-06  Stephen J. Turnbull  <stephen at xemacs.org>
+
+	* x-faces.el (x-color-list-internal): Should return a list of
+	strings.  Make it so.
+

Index: lisp/x-faces.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/x-faces.el,v
retrieving revision 1.30
diff -u -r1.30 x-faces.el
--- lisp/x-faces.el	30 Sep 2007 11:59:35 -0000	1.30
+++ lisp/x-faces.el	7 Oct 2007 05:39:15 -0000
@@ -603,6 +603,15 @@
 
 (defvar x-color-list-internal-cache)
 
+;; Ben originally coded this in 2005/01 to return a list of lists each
+;; containing a single string.  This is apparently derived from use of
+;; this list in completion, but in fact `read-color-completion-table'
+;; already does this wrapping.  So I'm changing this to return a list of
+;; strings as the TTY code does, and as expected by r-c-c-t.
+;; -- sjt 2007-10-06
+
+;; This function is probably also used by the GTK platform.  Cf.
+;; gtk_color_list in src/objects-gtk.c.
 (defun x-color-list-internal ()
   (if (boundp 'x-color-list-internal-cache)
       x-color-list-internal-cache
@@ -623,12 +632,12 @@
 	    (setq p (point))
 	    (end-of-line)
 	    (setq color (buffer-substring p (point))
-		  clist (cons (list color) clist))
+		  clist (cons color clist))
 	    ;; Ugh.  If we want to be able to complete the lowercase form
 	    ;; of the color name, we need to add it twice!  Yuck.
 	    (let ((dcase (downcase color)))
 	      (or (string= dcase color)
-		  (push (list dcase) clist)))
+		  (push dcase clist)))
 	    (forward-char 1))
 	  (kill-buffer (current-buffer))))
       (setq x-color-list-internal-cache clist)



More information about the XEmacs-Beta mailing list