Subject: [PATCH] agent confused by homonymous groups

From: Wolfgang Jenkner <[email-masked]>
Date: Thu, 22 Dec 2011 05:35:03 +0100

Let ~/.gnus consist of

(setq gnus-select-method
      '(nntp "news.gnus.org"))

(add-to-list 'gnus-secondary-select-methods
	     '(nntp "nntp.aioe.org"))

Now start gnus, agentize both news servers, subscribe to comp.emacs from
news.gnus.org, get new articles, read an article, then subscribe to the
same newsgroup from nntp.aioe.org and get new articles

ESC x g n u s RET ^ n J a J a q
S s c o m p . e m a c s RET g 1 SPC q
S s ESC p n n t p + n n t p . a i o e . o r g : RET g

You will see something like

   25091: nntp+nntp.aioe.org:comp.emacs
   29190: comp.emacs

but if you try to read an article from nntp+nntp.aioe.org:comp.emacs

. 1 SPC

you just get the message "No unread news".

Actually, the number Gnus reports for this group is bogus:

$ echo "GROUP comp.emacs" | nc nntp.aioe.org 119
200 nntp.aioe.org InterNetNews NNRP server INN 2.5.2 ready (posting ok)
211 146 4101 4247 comp.emacs

You'll see below that I don't care at all about the cost of reading or
writing agent.lib/local some more but, of course, YMMV.

No Gnus v0.18
GNU Emacs 24.0.92.1 (amd64-portbld-freebsd9.0, GTK+ Version 2.24.6)
 of 2011-12-04 on iznogoud.viz

2011-12-07  Wolfgang Jenkner  <[email-masked]>

	* gnus-agent.el (gnus-agent-load-local): Recompute
	`gnus-agent-article-local' if its +method does not match
	`gnus-command-method'.

-- >8 --
Subject: [PATCH] Recompute gnus-agent-article-local on changing method.

This prevents gnus-agent-save-local from saving a stale symbol-value
corresponding to some homonymous group (belonging to a different
method).
---
 lisp/gnus-agent.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
index 849f66b..a0321f9 100644
--- a/lisp/gnus-agent.el
+++ b/lisp/gnus-agent.el
@@ -2235,7 +2235,10 @@ doesn't exist, to valid the overview buffer."
 article counts for each of the method's subscribed groups."
   (let ((gnus-command-method (or method gnus-command-method)))
     (when (or (null gnus-agent-article-local-times)
-	      (zerop gnus-agent-article-local-times))
+	      (zerop gnus-agent-article-local-times)
+	      (not (gnus-methods-equal-p
+		    gnus-command-method
+		    (symbol-value (intern "+method" gnus-agent-article-local)))))
       (setq gnus-agent-article-local
 	    (gnus-cache-file-contents
 	     (gnus-agent-lib-file "local")
-- 
1.7.8