emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 10df031: Unbreak `group' option for `mail-sources'


From: Katsumi Yamaoka
Subject: [Emacs-diffs] master 10df031: Unbreak `group' option for `mail-sources'
Date: Tue, 20 Oct 2015 06:11:04 +0000

branch: master
commit 10df0310cb8f43818eace6288cadaae62bd82eb6
Author: Michael Sperber <address@hidden>
Commit: Katsumi Yamaoka <address@hidden>

    Unbreak `group' option for `mail-sources'
    
    * nnml.el (nnml-retrieve-groups, nnml-request-scan):
    * nnmail.el (nnmail-get-new-mail-per-group):
    (nnmail-get-new-mail-1): Unbreak `group' option for `mail-sources'.
---
 lisp/gnus/nnmail.el |    9 ++++++++-
 lisp/gnus/nnml.el   |   27 ++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 7efb154..f3ba169 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1792,6 +1792,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
   "Read new incoming mail."
   (nnmail-get-new-mail-1 method exit-func temp group nil spool-func))
 
+(defun nnmail-get-new-mail-per-group ()
+  "Tell us whether the mail-sources specify that `nnmail-get-new-mail' should
+be called once per group or once for all groups."
+  (or (assq 'group mail-sources)
+      (assq 'directory mail-sources)))
+
 (defun nnmail-get-new-mail-1 (method exit-func temp
                              group in-group spool-func)
   (let* ((sources mail-sources)
@@ -1804,7 +1810,8 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
               sources)
       (while (setq source (pop sources))
        ;; Use group's parameter
-       (when (eq (car source) 'group)
+       (when (and (eq (car source) 'group)
+                  group)
          (let ((mail-sources
                 (list
                  (gnus-group-find-parameter
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index c825e09..33eae1c 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -268,10 +268,35 @@ non-nil.")
                           (max (1+ (- (cdr active) (car active))) 0)
                           (car active) (cdr active) group)))))))
 
+(deffoo nnml-retrieve-groups (groups &optional server)
+  (when nnml-get-new-mail
+    (if (nnmail-get-new-mail-per-group)
+       (dolist (group groups)
+         (nnml-request-scan group server))
+      (nnml-request-scan nil server)))
+  (with-current-buffer nntp-server-buffer
+    (erase-buffer)
+    (dolist (group groups)
+      (let* ((entry (assoc group nnml-group-alist))
+            (active (nth 1 entry)))
+       (if (consp active)
+           (insert (format "211 %d %d %d %s\n"
+                           (max (1+ (- (cdr active) (car active))) 0)
+                           (car active) (cdr active) group))))))
+  'group)
+
 (deffoo nnml-request-scan (&optional group server)
   (setq nnml-article-file-alist nil)
   (nnml-possibly-change-directory group server)
-  (nnmail-get-new-mail 'nnml 'nnml-save-incremental-nov nnml-directory group))
+  (cond
+   (group
+    (nnmail-get-new-mail 'nnml 'nnml-save-incremental-nov nnml-directory 
group))
+   ((nnmail-get-new-mail-per-group)
+    (nnml-request-list)
+    (dolist (entry nnml-group-alist)
+      (nnml-request-scan (car entry) server)))
+   (t
+    (nnmail-get-new-mail 'nnml 'nnml-save-incremental-nov nnml-directory 
nil))))
 
 (deffoo nnml-close-group (group &optional server)
   (setq nnml-article-file-alist nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]