Import Gnus v5.10.3.
[elisp/gnus.git-] / lisp / gnus-ems.el
index a9ab259..153a02b 100644 (file)
       (setq props (plist-put props :background (face-background face))))
     (apply 'create-image file type data-p props)))
 
-(defun gnus-put-image (glyph &optional string)
-  (insert-image glyph (or string " "))
-  (unless string
-    (put-text-property (1- (point)) (point)
-                      'gnus-image-text-deletable t))
-  glyph)
-
-(defun gnus-remove-image (image)
+(defun gnus-put-image (glyph &optional string category)
+  (let ((point (point)))
+    (insert-image glyph (or string " "))
+    (put-text-property point (point) 'gnus-image-category category)
+    (unless string
+      (put-text-property (1- (point)) (point)
+                        'gnus-image-text-deletable t))
+    glyph))
+
+(defun gnus-remove-image (image &optional category)
   (dolist (position (message-text-with-property 'display))
-    (when (equal (get-text-property position 'display) image)
+    (when (and (equal (get-text-property position 'display) image)
+              (equal (get-text-property position 'gnus-image-category)
+                     category))
       (put-text-property position (1+ position) 'display nil)
       (when (get-text-property position 'gnus-image-text-deletable)
        (delete-region position (1+ position))))))