Steve Youngs writes:
* Zajcev Evgeny <zevlg(a)yandex.ru> writes:
> Hello there. I tried to change image of the glyph using
> `set-glyph-image' and found behaviour that i was not expecting.
Yup. Differentiating between glyphs and images was a mistake, and
this is why. It was hoped that certain operations could be more
efficient, but they aren't measurably so, and the confusion caused by
the caching of images is substantial. GNU Emacs doesn't make this
distinction. (They also have much less efficient image code, I have
heard. Maybe these things balance out....)
I personally wouldn't use #'set-glyph-image, but rather do it
| (setq ext (make-extent (point) (point)))
| (setq test (make-glyph (xpm-button-create "test" 1 "green"
| (setq aaaa (make-glyph (xpm-button-create "AAA" 1 "red"
| (set-extent-end-glyph ext test)
| (set-extent-end-glyph ext aaaa)
Yup. Glyphs are lightweight, especially compared to images, which are
quite heavyweight objects. I cannot think of any case where
distinguishing between a glyph and the image it refers to is useful.
Unfortunately the API requires an image in many places. As with
characters which are automatically promoted to integers, it might be a
good idea to change APIs requiring images so that glyphs are accepted
and automatically dereferenced to images.
XEmacs-Beta mailing list