X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/2238127283d703f38765f9b3f6a64f799d18e9e5..6ccb9cab43613632ece4f62d9ee28d694bc1d666:/lisp/gnus/gnus-html.el diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index d3da6aab1b..a5625dfed8 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/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-2013 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: html, web @@ -45,7 +45,10 @@ "Time used to determine if we should use images from the cache." :version "24.1" :group 'gnus-art - :type 'integer) + ;; FIXME hardly the friendliest type. The allowed value is actually + ;; any time value, but we are assuming no-one cares about USEC and + ;; PSEC here. It would be better to eg make it a number of minutes. + :type '(list integer integer)) (defcustom gnus-html-image-automatic-caching t "Whether automatically cache retrieve images." @@ -390,7 +393,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 @@ -399,15 +402,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)