X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-html.el;h=770904fa1c4cf2bd31b716b470076587b9bf8c32;hb=873ba7b51ddfb07246cd874b7de72662308236c9;hp=a4c4fa55d9a199b0d13e344490a2ca69904616ed;hpb=f31044c21918bdf9ccc0366b5896f03b14a3ced6;p=gnus diff --git a/lisp/gnus-html.el b/lisp/gnus-html.el index a4c4fa55d..770904fa1 100644 --- a/lisp/gnus-html.el +++ b/lisp/gnus-html.el @@ -1,6 +1,6 @@ ;;; gnus-html.el --- Render HTML in a buffer. -;; Copyright (C) 2010-2011 Free Software Foundation, Inc. +;; Copyright (C) 2010-2012 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: html, web @@ -38,6 +38,7 @@ (require 'url-cache) (require 'xml) (require 'browse-url) +(require 'mm-util) (eval-and-compile (unless (featurep 'xemacs) (require 'help-fns))) (defcustom gnus-html-image-cache-ttl (days-to-time 7) @@ -389,7 +390,7 @@ Use ALT-TEXT for the image string." (if (fboundp 'url-queue-retrieve) (url-queue-retrieve (car image) 'gnus-html-image-fetched - (list buffer image) t) + (list buffer image) t t) (ignore-errors (url-retrieve (car image) 'gnus-html-image-fetched @@ -398,15 +399,16 @@ Use ALT-TEXT for the image string." (defun gnus-html-image-fetched (status buffer image) "Callback function called when image has been fetched." (unless (plist-get status :error) - (when gnus-html-image-automatic-caching - (url-store-in-cache (current-buffer))) (when (and (or (search-forward "\n\n" nil t) (search-forward "\r\n\r\n" nil t)) - (buffer-live-p buffer)) - (let ((data (buffer-substring (point) (point-max)))) - (with-current-buffer buffer - (let ((inhibit-read-only t)) - (gnus-html-put-image data (car image) (cadr image))))))) + (not (eobp))) + (when gnus-html-image-automatic-caching + (url-store-in-cache (current-buffer))) + (when (buffer-live-p buffer) + (let ((data (buffer-substring (point) (point-max)))) + (with-current-buffer buffer + (let ((inhibit-read-only t)) + (gnus-html-put-image data (car image) (cadr image)))))))) (kill-buffer (current-buffer))) (defun gnus-html-get-image-data (url) @@ -488,7 +490,7 @@ Return a string with image data." ,url image-displayer (lambda (url start end) - (gnus-html-display-image ,url ,start ,(point) + (gnus-html-display-image url start end ,alt-text))))) (gnus-add-image 'external image) t)