Gnus development mailing list
 help / color / mirror / Atom feed
* How to straighten up group unread numbers
@ 2009-07-04 20:00 Harry Putnam
  2009-07-04 22:20 ` Steinar Bang
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Putnam @ 2009-07-04 20:00 UTC (permalink / raw)
  To: ding

When dealing with the agent and gmane... how can I fix the disparate
numbers that develop on some groups when I hit enter to enter them.

Gnus might tell me there are 250 unread when really its 6.

The number shown in group buffer is right but I might be asked if I
want to get 250.

I know this is a long standing issue... .I'm not interested in
fighting with code to fix it...or seeing anyone else do that either.
I just want to know if I can edit something every now and then to fix
that gap?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to straighten up group unread numbers
  2009-07-04 20:00 How to straighten up group unread numbers Harry Putnam
@ 2009-07-04 22:20 ` Steinar Bang
  2009-07-10 11:10   ` Steinar Bang
  0 siblings, 1 reply; 3+ messages in thread
From: Steinar Bang @ 2009-07-04 22:20 UTC (permalink / raw)
  To: ding

One approach I've thought about:
 - have a loop that goes through all interesting groups (in my case all
   nnimap, and gmane nntp groups), and for each group
  - Open the group, and loop through and read all unread articles
  - Loop through the recently visited articles, and all articles not
    marked as expired will be marked as unread
  - exit the group

This should:
 - Correct the read count (for nnimap this would be articles read by a
   different gnus, which is handled just by visiting the group, and
   articles that are permanently deleted, which appear as expired after
   an attempted read.  For gmane nntp groups, just visiting the group
   will remove the articles crossposted to gmane.spam.detected (because
   I score them down), and reading each article will remove those
   articles reported as spam)
 - Cache all articles in agent (if that actually works for me now)

Note that just visiting each group will handle everything except the
expired articles (permanently deleted IMAP articles, and reported spam
in gmane), and would be a lot simpler.

Perhaps that could be a first iteration?  The visiting of the
interesting group logic, would be the same.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to straighten up group unread numbers
  2009-07-04 22:20 ` Steinar Bang
@ 2009-07-10 11:10   ` Steinar Bang
  0 siblings, 0 replies; 3+ messages in thread
From: Steinar Bang @ 2009-07-10 11:10 UTC (permalink / raw)
  To: ding

>>>>> Steinar Bang <sb@dod.no>:

> Note that just visiting each group will handle everything except the
> expired articles (permanently deleted IMAP articles, and reported spam
> in gmane), and would be a lot simpler.

> Perhaps that could be a first iteration?  The visiting of the
> interesting group logic, would be the same.

Here's some code that seems to do the trick.  An annoying side effect is
that it opens all topics containing groups that are to be visited.

I have to toggle topics off, to find the group names for a server, and
toggle it back on afterwords.  I guess I could do the same thing before
visiting the groups...?  A bit annoying that it doesn't seem to be
possible to specify that topics should be off or on.  Ie. that one have
to assume a state before toggling.

Any simpler approaches would be welcome here.

(defun sb-list-all-groups-of-a-server (server-regexp)
  (let ((server-groups ()))
    (set-buffer gnus-group-buffer)
    (gnus-topic-mode nil t)
    (goto-char (point-min))
    (while (re-search-forward server-regexp nil t)
      (let ((current-group (gnus-group-group-name)))
            (setq server-groups (append (list current-group) server-groups))))
    (gnus-topic-mode nil t)
    server-groups))

(defun sb-visit-group-to-update-read-count (group-name)
  (gnus-group-read-group nil t group-name)
  (gnus-summary-exit))

(defun sb-visit-all-groups-of-a-server (server-regexp)
  (let ((server-groups (sb-list-all-groups-of-a-server server-regexp)))
    (mapc 
     'sb-visit-group-to-update-read-count
     server-groups)))

(defun sb-visit-gmane ()
  (interactive)
  (sb-visit-all-groups-of-a-server "nntp\\+news\\.gmane\\.org:"))

(defun sb-visit-home ()
  (interactive)
  (sb-visit-all-groups-of-a-server "nnimap\\+home:"))






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-10 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-04 20:00 How to straighten up group unread numbers Harry Putnam
2009-07-04 22:20 ` Steinar Bang
2009-07-10 11:10   ` Steinar Bang

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).