Gnus development mailing list
 help / color / mirror / Atom feed
From: pmlists@free.fr (Peter Münster)
To: ding@gnus.org
Subject: [PATCH] Make it possible to re-scan exactly one level.
Date: Mon, 31 Oct 2011 23:18:02 +0100	[thread overview]
Message-ID: <8739e824bp.fsf@micropit.couberia.bzh> (raw)

* gnus-group.el (gnus-group-get-new-news): New parameter `one-level'
for scanning exactly one level.
* gnus-start.el (gnus-get-unread-articles): Ditto.
---
 lisp/ChangeLog     |    6 ++++++
 lisp/gnus-group.el |    8 +++++---
 lisp/gnus-start.el |    4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ea8d600..38783aa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-31  Peter Münster  <pmrb@free.fr>  (tiny change)
+
+	* gnus-group.el (gnus-group-get-new-news): New parameter `one-level'
+	for scanning exactly one level.
+	* gnus-start.el (gnus-get-unread-articles): Ditto.
+
 2011-10-31  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* nnregistry.el: Remove unnecessary `gnus-registry-enabled' defvar.
diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el
index 4c527ca..64e8047 100644
--- a/lisp/gnus-group.el
+++ b/lisp/gnus-group.el
@@ -4009,11 +4009,13 @@ entail asking the server for the groups."
 	(gnus-activate-foreign-newsgroups level))
     (gnus-group-get-new-news)))
 
-(defun gnus-group-get-new-news (&optional arg)
+(defun gnus-group-get-new-news (&optional arg one-level)
   "Get newly arrived articles.
 If ARG is a number, it specifies which levels you are interested in
 re-scanning.  If ARG is non-nil and not a number, this will force
-\"hard\" re-reading of the active files from all servers."
+\"hard\" re-reading of the active files from all servers.
+If ONE-LEVEL is not nil, then re-scan only the specified level,
+otherwise all levels below ARG will be scanned too."
   (interactive "P")
   (require 'nnmail)
   (let ((gnus-inhibit-demon t)
@@ -4027,7 +4029,7 @@ re-scanning.  If ARG is non-nil and not a number, this will force
     (unless gnus-slave
       (gnus-master-read-slave-newsrc))
 
-    (gnus-get-unread-articles arg)
+    (gnus-get-unread-articles arg nil one-level)
 
     ;; If the user wants it, we scan for new groups.
     (when (eq gnus-check-new-newsgroups 'always)
diff --git a/lisp/gnus-start.el b/lisp/gnus-start.el
index 7c63d5e..0ddab6f 100644
--- a/lisp/gnus-start.el
+++ b/lisp/gnus-start.el
@@ -1606,7 +1606,7 @@ If SCAN, request a scan of that group as well."
 
 ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
 ;; and compute how many unread articles there are in each group.
-(defun gnus-get-unread-articles (&optional level dont-connect)
+(defun gnus-get-unread-articles (&optional level dont-connect one-level)
   (setq gnus-server-method-cache nil)
   (require 'gnus-agent)
   (let* ((newsrc (cdr gnus-newsrc-alist))
@@ -1663,7 +1663,7 @@ If SCAN, request a scan of that group as well."
 	(push (setq method-group-list (list method method-type nil nil))
 	      type-cache))
       ;; Only add groups that need updating.
-      (if (<= (gnus-info-level info)
+      (if (funcall (if one-level #'= #'<=) (gnus-info-level info)
 	      (if (eq (cadr method-group-list) 'foreign)
 		  foreign-level
 		alevel))
-- 
1.7.3.4




             reply	other threads:[~2011-10-31 22:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 22:18 Peter Münster [this message]
2011-11-03 22:33 ` Lars Magne Ingebrigtsen
2011-11-03 23:28   ` Katsumi Yamaoka

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=8739e824bp.fsf@micropit.couberia.bzh \
    --to=pmlists@free.fr \
    --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).