Gnus development mailing list
 help / color / mirror / Atom feed
From: Julien Danjou <julien@danjou.info>
To: ding@gnus.org
Cc: Julien Danjou <julien@danjou.info>
Subject: [PATCH] (gnus-html-schedule-image-fetching): Fetch all images in parallel.
Date: Sat, 18 Sep 2010 23:05:27 +0200	[thread overview]
Message-ID: <1284843927-943-1-git-send-email-julien@danjou.info> (raw)

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/ChangeLog    |    5 +++++
 lisp/gnus-html.el |   46 ++++++++++++++++++++++------------------------
 2 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 12a7a07..468f621 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-18  Julien Danjou  <julien@danjou.info>
+
+	* gnus-html.el (gnus-html-schedule-image-fetching): Fetch all images in
+	parallel.
+
 2010-09-18  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* nnimap.el (nnimap-update-info): When doing partial marks update, get
diff --git a/lisp/gnus-html.el b/lisp/gnus-html.el
index 40b74c2..b2ecb5c 100644
--- a/lisp/gnus-html.el
+++ b/lisp/gnus-html.el
@@ -297,34 +297,32 @@ fit these criteria."
 (defun gnus-html-schedule-image-fetching (buffer images)
   (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s"
                 buffer images)
-  (url-retrieve (caar images)
-                'gnus-html-image-fetched
-                (list buffer images)))
+  (dolist (image images)
+    (url-retrieve (car image)
+                  'gnus-html-image-fetched
+                  (list buffer image))))
 
 (defun gnus-html-image-id (url)
   (expand-file-name (sha1 url) gnus-html-cache-directory))
 
-(defun gnus-html-image-fetched (status buffer images)
-  (let ((spec (pop images)))
-    (when (and (buffer-live-p buffer)
-               ;; If the position of the marker is 1, then that
-               ;; means that the text it was in has been deleted;
-               ;; i.e., that the user has selected a different
-               ;; article before the image arrived.
-               (not (= (marker-position (cadr spec)) (point-min))))
-      (let ((file (gnus-html-image-id (car spec))))
-        ;; Search the start of the image data
-        (search-forward "\n\n")
-        ;; Write region (image) silently
-        (write-region (point) (point-max) file nil 1)
-        (kill-buffer)
-        (with-current-buffer buffer
-          (let ((inhibit-read-only t)
-                (string (buffer-substring (cadr spec) (caddr spec))))
-            (delete-region (cadr spec) (caddr spec))
-            (gnus-html-put-image file (cadr spec) string))))
-      (when images
-        (gnus-html-schedule-image-fetching buffer images)))))
+(defun gnus-html-image-fetched (status buffer image)
+  (when (and (buffer-live-p buffer)
+             ;; If the position of the marker is 1, then that
+             ;; means that the text it was in has been deleted;
+             ;; i.e., that the user has selected a different
+             ;; article before the image arrived.
+             (not (= (marker-position (cadr image)) (point-min))))
+    (let ((file (gnus-html-image-id (car image))))
+      ;; Search the start of the image data
+      (search-forward "\n\n")
+      ;; Write region (image) silently
+      (write-region (point) (point-max) file nil 1)
+      (kill-buffer)
+      (with-current-buffer buffer
+        (let ((inhibit-read-only t)
+              (string (buffer-substring (cadr image) (caddr image))))
+          (delete-region (cadr image) (caddr image))
+          (gnus-html-put-image file (cadr image) string))))))
 
 (defun gnus-html-put-image (file point string &optional url alt-text)
   (when (gnus-graphic-display-p)
-- 
1.7.1




             reply	other threads:[~2010-09-18 21:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-18 21:05 Julien Danjou [this message]
2010-09-18 21:11 ` Lars Magne Ingebrigtsen
2010-09-19  3:06 ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1284843927-943-1-git-send-email-julien@danjou.info \
    --to=julien@danjou.info \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).