Next: , Previous: , Up: Miscellaneous  


Q5.1.9: How do I put a glyph as annotation in a buffer?

Here is a solution that will insert the glyph annotation at the beginning of buffer:

(make-annotation (make-glyph '([FORMAT :file FILE]
                               [string :data "fallback-text"]))
                 (point-min)
                 'text
                 (current-buffer))

Replace ‘FORMAT’ with an unquoted symbol representing the format of the image (e.g. xpm, xbm, gif, jpeg, etc.) Instead of ‘FILE’, use the image file name (e.g. /usr/local/lib/sxemacs-22.1.4/etc/recycle.xpm).

You can turn this to a function (that optionally prompts you for a file name), and inserts the glyph at (point) instead of (point-min).