]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/gnus-async.el
Avoid the obsoleted defmethod
[gnu-emacs] / lisp / gnus / gnus-async.el
index 378b0e063cbb33edda34a476c1c4e0c77c9276b8..ba72d820431d3c25f1c931a790291578459b2887 100644 (file)
@@ -1,6 +1,6 @@
 ;;; gnus-async.el --- asynchronous support for Gnus
 
-;; Copyright (C) 1996-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2016 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -74,8 +74,9 @@ It should return non-nil if the article is to be prefetched."
   "Function called after an article has been prefetched.
 The function will be called narrowed to the region of the article
 that was fetched."
+  :version "24.1"
   :group 'gnus-asynchronous
-  :type 'function)
+  :type '(choice (const nil) function))
 
 ;;; Internal variables.
 
@@ -147,18 +148,13 @@ that was fetched."
     (with-current-buffer gnus-summary-buffer
       (let ((next (caadr (gnus-data-find-list article))))
        (when next
-         (if (not (fboundp 'run-with-idle-timer))
-             ;; This is either an older Emacs or XEmacs, so we
-             ;; do this, which leads to slightly slower article
-             ;; buffer display.
-             (gnus-async-prefetch-article group next summary)
-           (when gnus-async-timer
-             (ignore-errors
-               (nnheader-cancel-timer 'gnus-async-timer)))
-           (setq gnus-async-timer
-                 (run-with-idle-timer
-                  0.1 nil 'gnus-async-prefetch-article
-                  group next summary))))))))
+         (when gnus-async-timer
+           (ignore-errors
+             (nnheader-cancel-timer 'gnus-async-timer)))
+         (setq gnus-async-timer
+               (run-with-idle-timer
+                0.1 nil 'gnus-async-prefetch-article
+                group next summary)))))))
 
 (defun gnus-async-prefetch-article (group article summary &optional next)
   "Possibly prefetch several articles starting with ARTICLE."
@@ -225,9 +221,6 @@ that was fetched."
   `(lambda (arg)
      (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
@@ -253,7 +246,7 @@ that was fetched."
         gnus-async-article-alist
         (cons (list (intern (format "%s-%d" group article)
                             gnus-async-hashtb)
-                    mark (set-marker (make-marker) (point-max))
+                    mark (point-max-marker)
                     group article)
               gnus-async-article-alist))))
     (if (not (gnus-buffer-live-p summary))