- (save-excursion
- (gnus-async-set-buffer)
- (gnus-async-with-semaphore
- (push (list ',(intern (format "%s-%d" group article))
- ,mark (set-marker (make-marker)
- (point-max))
- ,group ,article)
- gnus-async-article-alist))
- (if (not (gnus-buffer-live-p ,summary))
- (gnus-async-with-semaphore
- (setq gnus-async-fetch-list nil))
- (gnus-async-prefetch-article ,group ,next ,summary t)))))
+ (gnus-async-article-callback arg ,group ,article ,mark ,summary ,next)))
+
+(eval-when-compile
+ (autoload 'gnus-html-prefetch-images "gnus-html"))
+
+(defun gnus-async-article-callback (arg group article mark summary next)
+ "Function called when an async article is done being fetched."
+ (save-excursion
+ (setq gnus-async-current-prefetch-article nil)
+ (when arg
+ (gnus-async-set-buffer)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region mark (point-max))
+ ;; Prefetch images for the groups that want that.
+ (when (fboundp 'gnus-html-prefetch-images)
+ (gnus-html-prefetch-images summary))
+ (when gnus-async-post-fetch-function
+ (funcall gnus-async-post-fetch-function summary))))
+ (gnus-async-with-semaphore
+ (setq
+ gnus-async-article-alist
+ (cons (list (intern (format "%s-%d" group article)
+ gnus-async-hashtb)
+ mark (set-marker (make-marker) (point-max))
+ group article)
+ gnus-async-article-alist))))
+ (if (not (gnus-buffer-live-p summary))
+ (gnus-async-with-semaphore
+ (setq gnus-async-fetch-list nil))
+ (gnus-async-prefetch-article group next summary t))))
+
+(defun gnus-async-unread-p (data)
+ "Return non-nil if DATA represents an unread article."
+ (gnus-data-unread-p data))