Gnus development mailing list
 help / color / mirror / Atom feed
From: Steinar Bang <sb@dod.no>
To: ding@gnus.org
Subject: Re: How to straighten up group unread numbers
Date: Fri, 10 Jul 2009 13:10:40 +0200	[thread overview]
Message-ID: <m3tz1ku72n.fsf@dod.no> (raw)
In-Reply-To: <m31vow850h.fsf@dod.no>

>>>>> 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:"))






      reply	other threads:[~2009-07-10 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-04 20:00 Harry Putnam
2009-07-04 22:20 ` Steinar Bang
2009-07-10 11:10   ` Steinar Bang [this message]

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=m3tz1ku72n.fsf@dod.no \
    --to=sb@dod.no \
    --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).