Use the summary-local version of the mm-w3m-safe-url-regexp variable
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 29 Aug 2010 18:21:52 +0000 (20:21 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 29 Aug 2010 18:21:52 +0000 (20:21 +0200)
to only download images in the groups where we want that to happen.

lisp/ChangeLog
lisp/gnus-async.el
lisp/gnus-html.el

index ff4d9e4..2b6eeea 100644 (file)
@@ -1,5 +1,9 @@
 2010-08-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-html.el (gnus-html-prefetch-images): Use the summary-local
+       version of the mm-w3m-safe-url-regexp variable to only download images
+       in the groups where we want that to happen.
+
        * gnus-sum.el (gnus-summary-stop-at-end-of-message): New variable.
 
        * gnus-art.el (gnus-article-beginning-of-window): Make into defun for
index a39821c..95ea488 100644 (file)
@@ -238,7 +238,7 @@ that was fetched."
        (save-excursion
          (save-restriction
            (narrow-to-region mark (point-max))
-           (funcall gnus-async-post-fetch-function))))
+           (funcall gnus-async-post-fetch-function summary))))
       (gnus-async-with-semaphore
        (setq
         gnus-async-article-alist
index a559679..8aa99d1 100644 (file)
          (decf total-size (cadr file))
          (delete-file (nth 2 file)))))))
 
-(defun gnus-html-prefetch-images ()
-  (save-match-data
-    (let (urls)
-      (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)
-       (let ((url (match-string 1)))
-         (when (or (null mm-w3m-safe-url-regexp)
-                   (string-match mm-w3m-safe-url-regexp url))
-           (unless (file-exists-p (gnus-html-image-id url))
-             (push url urls)
-             (push (gnus-html-image-id url) urls)
-             (push "-o" urls)))))
-      (apply 'start-process 
-            "images" nil "curl"
-            "-s" "--create-dirs"
-            "--location"
-            urls))))
+(defun gnus-html-prefetch-images (summary)
+  (let (safe-url-regexp urls)
+    (when (buffer-live-p summary)
+      (save-excursion
+       (set-buffer summary)
+       (setq safe-url-regexp mm-w3m-safe-url-regexp))
+      (save-match-data
+       (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)
+         (let ((url (match-string 1)))
+           (when (or (null safe-url-regexp)
+                     (string-match safe-url-regexp url))
+             (unless (file-exists-p (gnus-html-image-id url))
+               (push url urls)
+               (push (gnus-html-image-id url) urls)
+               (push "-o" urls)))))
+       (apply 'start-process 
+              "images" nil "curl"
+              "-s" "--create-dirs"
+              "--location"
+              urls)))))
 
 ;;; gnus-html.el ends here