Gnus development mailing list
 help / color / mirror / Atom feed
From: Michael Sperber <sperber@deinprogramm.de>
To: ding@gnus.org
Subject: PATCH: Unbreak `group' option for `mail-sources'
Date: Sun, 18 Oct 2015 18:03:06 +0200	[thread overview]
Message-ID: <y9l7fmkrwp1.fsf@deinprogramm.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]


The `group' option for `mail-sources' has been broken for quite a while.
The attached patch fixes it.  Could someone apply and push?

-- 
Regards,
Mike

[-- Attachment #2: Type: text/plain, Size: 3343 bytes --]

commit d164741a74ba8145476c478f2079c9e3d9d69567
Author: Mike Sperber <sperber@deinprogramm.de>
Date:   Sun Oct 18 17:39:34 2015 +0200

    	* 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'.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2f7fd2b..979a845 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
 2015-10-18  Michael Sperber  <mike@xemacs.org>
 
+	* 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'.
+
+2015-10-18  Michael Sperber  <mike@xemacs.org>
+
 	* message.el (message-get-reply-headers): In addition to
 	`mail-dont-reply-to-names', bind `rmail-dont-reply-to-names', which is
 	used in XEmacs.
diff --git a/lisp/nnmail.el b/lisp/nnmail.el
index 7efb154..f3ba169 100644
--- a/lisp/nnmail.el
+++ b/lisp/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/nnml.el b/lisp/nnml.el
index c825e09..33eae1c 100644
--- a/lisp/nnml.el
+++ b/lisp/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	other threads:[~2015-10-18 16:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-18 16:03 Michael Sperber [this message]
2015-10-19 14:33 ` Katsumi Yamaoka
2015-10-19 16:48   ` Wolfgang Jenkner
2015-10-20  1:06     ` Katsumi Yamaoka
2015-10-20  6:12       ` Katsumi Yamaoka
2015-10-20  6:41   ` Michael Sperber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=y9l7fmkrwp1.fsf@deinprogramm.de \
    --to=sperber@deinprogramm.de \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).