"Stephen J. Turnbull" <stephen(a)xemacs.org> writes:
Oops, I noticed this before, but forgot to mention it.
David> Then in the LaTeX-mode-hook, the following gets called
David> (about which I happen to be entirely clueless).
(let ((tb (cdadar (or (specifier-spec-list default-toolbar (current-buffer))
(specifier-spec-list default-toolbar 'global)))))
(unless (assq preview-icon-toolbar-button tb)
Use `member', not `assq'. `memq' probably works, too, but toolbars
are short, the buttons are short and shallow, and this code gets
called rarely (ie, approximately once per LaTeX file).
ARGHHH! Well, _that_ item of the code I was supposed _not_ to be
clueless about. I said I was an idiot all along.
Sorry for that. Jan-Åke, does it help your problem if you replace the
assq by memq (preview-icon-toolbar-button never gets reassigned, so I
would guess memq would be a safe bet) or member? This should be in
prv-xemacs.el in preview-mode-setup.
That should fix your doubled button problem. I don't understand
that code would get called more than once (that might be a bug in
XEmacs), but it's the only hypothesis I can see a fix for offhand.
Well, I don't know either why this should be invoked more than once
(and it really shouldn't unless one does things like revert-buffer or
so), but since the code is explicitly designed to work even in that
case, it should not bungle it. I have enough to worry about without
thinking about rather harmless dubious side effects.
David> Now there is one smaller problem: the glyph is
David> from a PNG file with transparent colors. Displayed in the
David> text, the transparent color is the text background color.
David> Displayed in the toolbar, the transparent color is black
David> instead of the toolbar color.
(make-face 'toolbar-face "Compatibility toolbar face for
XEmacs < 21.5.
Use this face for glyphs used as button icons. Does not affect the
toolbar itself (toolbars get faces in 21.5), and may not affect some
types of glyphs (\"text\" glyphs seem to get the default face; XPMs and
xface glyphs get the right face).
Probably the only property that matters is the background color.")
(set-glyph-face (car (aref preview-icon-toolbar-button 0)) 'toolbar-face)
in the initialization of preview-latex. (This should also work on the
fly if you happen to have a toolbar with the ugly PNG displayed.)
The glyph in the toolbar is the same glyph we use in the text (where
the background color is, as expected, the text background color). I
would probably need to make a copy of the glyph then for the
toolbar? And the effect only comes about because the glyph-face is
not set rather than set to the text face, right, and so in the
toolbar it inherits its face from who knows where?
Thanks for clearing this up.
David Kastrup, Kriemhildstr. 15, 44793 Bochum