From xemacs-m  Fri May 23 10:55:45 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id KAA13418
	for <xemacs-beta@xemacs.org>; Fri, 23 May 1997 10:55:43 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id RAA08689; Fri, 23 May 1997 17:50:07 +0200 (MET DST)
To: Kyle Jones <kyle_jones@wonderworks.com>
Cc: XEmacs Developers <xemacs-beta@xemacs.org>,
        abraham@dina.kvl.dk (Per Abrahamsen)
Subject: Re: M-x customize doesn't work without TTY support
References: <kig206ytxa0.fsf@jagor.srce.hr> <QQcquc13702.199705231434@crystal.WonderWorks.COM>
X-Save-Project-Gutenberg: <URL:http://www.promo.net/pg/nl/pgny_nov96.html>
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
X-Tom-Swifty: "Any fresh fruit in the kitchen?" Tom asked peeringly.
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 23 May 1997 17:50:06 +0200
In-Reply-To: Kyle Jones's message of Fri, 23 May 1997 10:34:48 -0400 (EDT)
Message-ID: <kigzptmqjbl.fsf@jagor.srce.hr>
Lines: 70
X-Mailer: Gnus v5.4.52/XEmacs 20.2

Kyle Jones <kyle_jones@wonderworks.com> writes:

> Hrvoje Niksic writes:
>  > [...]
>  > The error is that XEmacs rejects setting of the specifiers the
>  > tag of which is invalid.  IMHO this is very wrong, and lots of
>  > lots of Lisp code is broken when running without TTYs or without
>  > X, because of this.  XEmacs should simply ignore the tags it
>  > doesn't know about.  Or just warn about them.  But not kick me
>  > out. :-(
>  > 
>  > Do the others agree with me?  If yes, I can attempt to fix these
>  > bugs.
> 
> I agree with you.

OK, I'll try to go for it.

As for Widget, a better fix would be to specify the xpm itself, and
the string as the fallback if xpm cannot be resolved -- this doesn't
mention `tty' or `x' anywhere, and is thus much much cleaner.

You see, the second argument to `make-glyph' can also be a list of
image instantiators (strings or vectors), which will be tried one by
one.  So, if you want to make a glyph that will be an XPM where xpm-s
are allowed, and "[Set]" string otherwise, you can do something like
this:

(setq a (make-glyph '([xpm :file "~/work/xemacs/xemacs-20.3-b1/etc/recycle.xpm"]
                      [string :data "[Set]"])))

This is not only much cleaner than attaching "[Set]" to a TTY device,
but works out of the box on TTY-less XEmacs.

The glyph can be inserted normally, e.g. like Per does it:

(add-text-properties (1- (point)) (point) `(end-glyph ,a))

Then you can try making a TTY device (via gnuclient), and you'll see
that the X glyph is represented by the string "[Set]", which is
exactly what we wanted to do.

The relevant part of `widget-glyph-insert' might look like this:

	(t
	 ;; A string.  Look it up in.
	 (let ((file (concat widget-glyph-directory 
			    (if (string-match "/\\'" widget-glyph-directory)
				""
			      "/")
			    image)))
	   (if (file-readable-p file)
	       (widget-glyph-insert-glyph
		widget tag
		(make-glyph `(,(vector 'xpm :file (concat file ".xpm"))
			      ,(vector 'xbm :file (concat file ".xbm"))
			      ,(vector 'string :data tag))))
	     ;; File not readable, give up.
	     (insert tag))))))

This would say to try first xpm, then xbm, then ordinary string.

Wow.  The way I'm going, maybe in a few years I'll even begin to
understand specifiers/glyphs/instances/instantiators.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
4.  Thou shalt not warlorde a sig if it bee the sig of Kibo, nor if
    it bee the sig of the Inner Circle.

