- ;; We create a glyph with the file as the default image
- ;; instantiator, and the TAG fallback
- (let ((glyph (make-glyph `([,(caar formats) :file ,file]
- [string :data ,tag]))))
- ;; Cache the glyph
- (laxputf widget-glyph-cache image glyph)
- ;; ...and return it
- glyph)))))
+ (let* ((extension (concat "." (file-name-extension file)))
+ (format (car (rassoc* extension
+ widget-image-file-name-suffixes
+ :test #'member))))
+ ;; We create a glyph with the file as the default image
+ ;; instantiator, and the TAG fallback
+ (let ((glyph (make-glyph `([,format :file ,file]
+ [string :data ,tag]))))
+ ;; Cache the glyph
+ (laxputf widget-glyph-cache image glyph)
+ ;; ...and return it
+ glyph))))))