From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68691 Path: news.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.gnus.general Subject: Re: How to straighten up group unread numbers Date: Fri, 10 Jul 2009 13:10:40 +0200 Organization: Probably a good idea Message-ID: References: <87ljn4dxra.fsf@newsguy.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1247224328 12473 80.91.229.12 (10 Jul 2009 11:12:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Jul 2009 11:12:08 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M17118@lists.math.uh.edu Fri Jul 10 13:12:01 2009 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1MPE1I-0004et-On for ding-account@gmane.org; Fri, 10 Jul 2009 13:12:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1MPE0S-0004nY-9K; Fri, 10 Jul 2009 06:11:08 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1MPE0Q-0004nK-VQ for ding@lists.math.uh.edu; Fri, 10 Jul 2009 06:11:06 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1MPE0P-0006u0-LM for ding@lists.math.uh.edu; Fri, 10 Jul 2009 06:11:06 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1MPE0w-0000zD-00 for ; Fri, 10 Jul 2009 13:11:38 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MPE0N-0002SV-Vu for ding@gnus.org; Fri, 10 Jul 2009 11:11:04 +0000 Original-Received: from ti0064a380-0723.bb.online.no ([88.90.107.215]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Jul 2009 11:11:03 +0000 Original-Received: from sb by ti0064a380-0723.bb.online.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Jul 2009 11:11:03 +0000 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ti0064a380-0723.bb.online.no Mail-Copies-To: never User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:COF7GJELhTWJd5GUk0bBqLrSaTA= X-Spam-Score: -3.6 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:68691 Archived-At: >>>>> Steinar Bang : > 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:"))