Insert masses of cached articles faster.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 24 Nov 2010 22:45:44 +0000 (23:45 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 24 Nov 2010 22:47:27 +0000 (23:47 +0100)
lisp/ChangeLog
lisp/gnus-cache.el
lisp/gnus-sum.el

index 6670686..0fd36de 100644 (file)
@@ -1,5 +1,9 @@
 2010-11-24  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-cache.el (gnus-summary-insert-cached-articles): Use it.
+
+       * gnus-sum.el (gnus-summary-include-articles): New function.
+
        * message.el (message-goto-body): called-interactively-p needs a
        parameter, so use `any'.
 
index 8229960..50ab1c6 100644 (file)
@@ -383,9 +383,14 @@ Returns the list of articles removed."
   "Insert all the articles cached for this group into the current buffer."
   (interactive)
   (let ((gnus-verbose (max 6 gnus-verbose)))
-    (if (not gnus-newsgroup-cached)
-       (gnus-message 3 "No cached articles for this group")
-      (gnus-summary-goto-subjects gnus-newsgroup-cached))))
+    (cond
+     ((not gnus-newsgroup-cached)
+      (gnus-message 3 "No cached articles for this group"))
+     ;; This is faster if there are few articles to insert.
+     ((< (length gnus-newsgroup-cached) 20)
+      (gnus-summary-goto-subjects gnus-newsgroup-cached))
+     (t
+      (gnus-summary-include-articles gnus-newsgroup-cached)))))
 
 (defun gnus-summary-limit-include-cached ()
   "Limit the summary buffer to articles that are cached."
index 4858448..72b6d40 100644 (file)
@@ -8500,6 +8500,18 @@ fetched for this group."
       (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
     (gnus-summary-position-point)))
 
+(defun gnus-summary-include-articles (articles)
+  "Fetch the headers for ARTICLES and then display the summary lines."
+  (let ((gnus-inhibit-demon t)
+       (gnus-agent nil)
+       (gnus-read-all-available-headers t))
+    (setq gnus-newsgroup-headers
+         (gnus-merge
+          'list gnus-newsgroup-headers
+          (gnus-fetch-headers articles nil t)
+          'gnus-article-sort-by-number))
+    (gnus-summary-limit (append articles gnus-newsgroup-limit))))
+
 (defun gnus-summary-limit-exclude-dormant ()
   "Hide all dormant articles."
   (interactive)