[gnus git] branch master updated: m0-11-115-g447c56a =1= Make moving IMAP articles faster in large groups

Lars <[email protected]> Mon, 26 Jan 2015 03:50:29 +0100
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  447c56af7cb2afac14a0f3ed23f85d907c443a5d (commit)
      from  f718e4e89b7f61c595c829ad4ef7497a0c4efcd8 (commit)


- Log -----------------------------------------------------------------
commit 447c56af7cb2afac14a0f3ed23f85d907c443a5d
Author: Lars Ingebrigtsen <[email protected]>
Date:   Mon Jan 26 13:50:20 2015 +1100

    Make moving IMAP articles faster in large groups
    
    * lisp/gnus-group.el (gnus-group-get-new-news-this-group): Explicitly
    request rescans when being run interactively.
    
    * lisp/gnus-int.el (gnus-request-group-scan): New backend function.
    
    * lisp/nnimap.el (nnimap-request-scan-group): Implement in on IMAP.
    
    * lisp/nnimap.el (nnimap-request-group): Don't rescan the group here,
    because that can be very slow in large groups.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d62bfdf..0001120 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2015-01-26  Lars Ingebrigtsen  <[email protected]>
+
+	* gnus-group.el (gnus-group-get-new-news-this-group): Explicitly
+	request rescans when being run interactively.
+
+	* nnimap.el (nnimap-request-group): Don't rescan the group here,
+	because that can be very slow in large groups.
+
+	* gnus-int.el (gnus-request-group-scan): New backend function.
+
+	* nnimap.el (nnimap-request-scan-group): Implement in on IMAP.
+
 2015-01-25  Lars Ingebrigtsen  <[email protected]>
 
 	* gnus-group.el (gnus-group-suspend): Close all backends.
diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el
index dc11442..e22138b 100644
--- a/lisp/gnus-group.el
+++ b/lisp/gnus-group.el
@@ -4075,7 +4075,9 @@ If DONT-SCAN is non-nil, scan non-activated groups as well."
       (gnus-group-remove-mark group)
       ;; Bypass any previous denials from the server.
       (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
-      (if (gnus-activate-group group (if dont-scan nil 'scan) nil method)
+      (if (or (and (not dont-scan)
+		   (gnus-request-group-scan group (gnus-get-info group)))
+	      (gnus-activate-group group (if dont-scan nil 'scan) nil method))
 	  (let ((info (gnus-get-info group))
 		(active (gnus-active group)))
 	    (when info
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 487b85f..dd938ce 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -439,6 +439,14 @@ If it is down, start it up (again)."
       (funcall (gnus-get-function gnus-command-method func)
 	       (gnus-group-real-name group) (nth 1 gnus-command-method)))))
 
+(defun gnus-request-group-scan (group info)
+  "Request that GROUP get a complete rescan."
+  (let ((gnus-command-method (gnus-find-method-for-group group))
+	(func 'request-group-description))
+    (when (gnus-check-backend-function func group)
+      (funcall (gnus-get-function gnus-command-method func)
+	       (gnus-group-real-name group) (nth 1 gnus-command-method) info))))
+
 (defun gnus-close-group (group)
   "Request the GROUP be closed."
   (let ((gnus-command-method (inline (gnus-find-method-for-group group))))
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index f3a8957..382e490 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -792,13 +792,24 @@ textual parts.")
 	articles active marks high low)
     (with-current-buffer nntp-server-buffer
       (when result
-	(if (and dont-check
-		 (setq active (nth 2 (assoc group nnimap-current-infos))))
+	(when (or (not dont-check)
+		  (not (setq active
+			     (nth 2 (assoc group nnimap-current-infos)))))
+	  (let ((sequences (nnimap-retrieve-group-data-early
+			    server (list info))))
+	    (nnimap-finish-retrieve-group-infos server (list info) sequences
+						t)
+	    (setq active (nth 2 (assoc group nnimap-current-infos)))))
 	(insert (format "211 %d %d %d %S\n"
 			(- (cdr active) (car active))
 			(car active)
 			(cdr active)
 			group))
+	t))))
+
+(deffoo nnimap-request-scan-group (group &optional server info)
+  (setq group (nnimap-decode-gnus-group group))
+  (let (marks high low)
     (with-current-buffer (nnimap-buffer)
       (erase-buffer)
       (let ((group-sequence
@@ -823,11 +834,12 @@ textual parts.")
 			   (nth 3 (car marks)))
 			 0)
 		low (or (nth 4 (car marks)) uidnext 1)))))
+    (with-current-buffer nntp-server-buffer
       (erase-buffer)
       (insert
        (format
-	    "211 %d %d %d %S\n" (1+ (- high low)) low high group)))
-	t))))
+	"211 %d %d %d %S\n" (1+ (- high low)) low high group))
+      t)))
 
 (deffoo nnimap-request-create-group (group &optional server args)
   (setq group (nnimap-decode-gnus-group group))
@@ -1371,7 +1383,8 @@ If LIMIT, first try to limit the search to the N last articles."
 	command
       (nth 2 quirk))))
 
-(deffoo nnimap-finish-retrieve-group-infos (server infos sequences)
+(deffoo nnimap-finish-retrieve-group-infos (server infos sequences
+						   &optional dont-insert)
   (when (and sequences
 	     (nnimap-change-group nil server t)
 	     ;; Check that the process is still alive.
@@ -1391,6 +1404,7 @@ If LIMIT, first try to limit the search to the N last articles."
 			      (nnimap-parse-flags
 			       (nreverse sequences)))
 			     infos)
+	(unless dont-insert
 	  ;; Finally, just return something resembling an active file in
 	  ;; the nntp buffer, so that the agent can save the info, too.
 	  (with-current-buffer nntp-server-buffer
@@ -1403,7 +1417,7 @@ If LIMIT, first try to limit the search to the N last articles."
 				  (decode-coding-string
 				   (gnus-group-real-name group) 'utf-8)
 				  (cdr active)
-				(car active)))))))))))
+				  (car active))))))))))))
 
 (defun nnimap-update-infos (flags infos)
   (dolist (info infos)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog     |   12 ++++++
 lisp/gnus-group.el |    4 +-
 lisp/gnus-int.el   |    8 ++++
 lisp/nnimap.el     |  112 +++++++++++++++++++++++++++++-----------------------
 4 files changed, 86 insertions(+), 50 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project