changeset 42355:6a1a8da1ad47

(widget-toggle-value-create): Don't eval actual images (which are lists too).
author Miles Bader <miles@gnu.org>
date Thu, 27 Dec 2001 15:07:21 +0000
parents 97b1dcf7ef60
children bccfe69ee76a
files lisp/wid-edit.el
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wid-edit.el	Thu Dec 27 11:27:27 2001 +0000
+++ b/lisp/wid-edit.el	Thu Dec 27 15:07:21 2001 +0000
@@ -2001,21 +2001,20 @@
 (defun widget-toggle-value-create (widget)
   "Insert text representing the `on' and `off' states."
   (if (widget-value widget)
-      (progn
+      (let ((image (widget-get widget :on-glyph)))
 	(and (display-graphic-p)
-	     (listp (widget-get widget :on-glyph))
-	     (widget-put widget :on-glyph
-			 (eval (widget-get widget :on-glyph))))
+	     (listp image)
+	     (not (eq (car image) 'image))
+	     (widget-put widget :on-glyph (setq image (eval image))))
 	(widget-image-insert widget
 			     (widget-get widget :on)
-			     (widget-get widget :on-glyph)))
-    (and (display-graphic-p)
-	 (listp (widget-get widget :off-glyph))
-	 (widget-put widget :off-glyph
-		     (eval (widget-get widget :off-glyph))))
-    (widget-image-insert widget
-			 (widget-get widget :off)
-			 (widget-get widget :off-glyph))))
+			     image))
+    (let ((image (widget-get widget :off-glyph)))
+      (and (display-graphic-p)
+	   (listp image)
+	   (not (eq (car image) 'image))
+	   (widget-put widget :off-glyph (setq image (eval image))))
+      (widget-image-insert widget (widget-get widget :off) image))))
 
 (defun widget-toggle-action (widget &optional event)
   ;; Toggle value.