X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-ems.el;h=296a4ca68c91aed305af1323face473894878741;hb=af7c9b7a83765ae38b534d33cec86176ad1cb6c6;hp=c8cf6999165d3610e00c359c4d40329c2ac59b03;hpb=25bfe3ed05cb31f9702cf6143280bf4700fc44e0;p=gnus diff --git a/lisp/gnus-ems.el b/lisp/gnus-ems.el index c8cf69991..296a4ca68 100644 --- a/lisp/gnus-ems.el +++ b/lisp/gnus-ems.el @@ -48,8 +48,6 @@ (autoload 'nnheader-find-etc-directory "nnheader")) (autoload 'smiley-region "smiley") -;; Fixme: shouldn't require message -(autoload 'message-text-with-property "message") (defun gnus-kill-all-overlays () "Delete all overlays in the current buffer." @@ -223,18 +221,26 @@ glyph)) (defun gnus-remove-image (image &optional category) - (let ((regions (message-text-with-property 'display)) - start end) - (while regions - (setq start (caar regions) - end (cdar regions) - regions (cdr regions)) - (when (and (equal (get-text-property start 'display) image) - (equal (get-text-property start 'gnus-image-category) - category)) - (put-text-property start end 'display nil) - (when (get-text-property start 'gnus-image-text-deletable) - (delete-region start end)))))) + "Remove the image matching IMAGE and CATEGORY found first." + (let ((start (point-min)) + val end) + (while (and (not end) + (or (setq val (get-text-property start 'display)) + (and (setq start + (next-single-property-change start 'display)) + (setq val (get-text-property start 'display))))) + (setq end (or (next-single-property-change start 'display) + (point-max))) + (if (and (equal val image) + (equal (get-text-property start 'gnus-image-category) + category)) + (progn + (put-text-property start end 'display nil) + (when (get-text-property start 'gnus-image-text-deletable) + (delete-region start end))) + (unless (= end (point-max)) + (setq start end + end nil)))))) (provide 'gnus-ems)