(featurep (if (eq type 'pbm) 'xbm type))))
(defun gnus-xmas-create-image (file &optional type data-p &rest props)
- (let ((type (if type
- (symbol-name type)
- (car (last (split-string file "[.]")))))
+ (let ((type (cond
+ (type
+ (symbol-name type))
+ ((string-match "[.]" file)
+ (car (last (split-string file "[.]"))))))
(face (plist-get props :face))
glyph)
(when (equal type "pbm")
(insert-file-contents-literally file))
(make-glyph
(vector
- (or (intern type)
- (mm-image-type-from-buffer))
+ (if type
+ (intern type)
+ (mm-image-type-from-buffer))
:data (buffer-string))))))
(when face
(set-glyph-face glyph face))
glyph))
-(defun gnus-xmas-put-image (glyph &optional string category point)
+(defun gnus-xmas-put-image (glyph &optional string category)
"Insert STRING, but display GLYPH.
Warning: Don't insert text immediately after the image."
- (let ((begin (or point (point)))
+ (let ((begin (point))
extent)
- (save-excursion
- (goto-char begin)
- (if (and (bobp) (not string))
- (setq string " "))
- (if string
- (insert string)
- (setq begin (1- begin)))
- (setq extent (make-extent begin (point)))
- (set-extent-property extent 'gnus-image category)
- (set-extent-property extent 'duplicable t)
- (if string
- (set-extent-property extent 'invisible t))
- (set-extent-property extent 'end-glyph glyph)))
+ (if (and (bobp) (not string))
+ (setq string " "))
+ (if string
+ (insert string)
+ (setq begin (1- begin)))
+ (setq extent (make-extent begin (point)))
+ (set-extent-property extent 'gnus-image category)
+ (set-extent-property extent 'duplicable t)
+ (if string
+ (set-extent-property extent 'invisible t))
+ (set-extent-property extent 'end-glyph glyph))
glyph)
(defun gnus-xmas-remove-image (image &optional category)
(provide 'gnus-xmas)
-;;; arch-tag: 4e84de3f-ea0a-4ee3-bfeb-e03d46fcacef
;;; gnus-xmas.el ends here