* gnus.el (gnus-maximum-newsgroup): New variable.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 14 Aug 2007 11:45:48 +0000 (11:45 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 14 Aug 2007 11:45:48 +0000 (11:45 +0000)
* gnus-agent.el (gnus-agent-fetch-headers): Limit the range of articles
 according to gnus-maximum-newsgroup.

* gnus-sum.el (gnus-articles-to-read, gnus-list-of-unread-articles)
(gnus-list-of-read-articles, gnus-sequence-of-unread-articles): Limit the range
 of articles according to gnus-maximum-newsgroup.

lisp/ChangeLog
lisp/gnus-agent.el
lisp/gnus-sum.el
lisp/gnus.el

index 99f0e35..6a22e64 100644 (file)
@@ -1,3 +1,14 @@
+2007-08-14  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus.el (gnus-maximum-newsgroup): New variable.
+
+       * gnus-agent.el (gnus-agent-fetch-headers): Limit the range of articles
+       according to gnus-maximum-newsgroup.
+
+       * gnus-sum.el (gnus-articles-to-read, gnus-list-of-unread-articles)
+       (gnus-list-of-read-articles, gnus-sequence-of-unread-articles): Limit
+       the range of articles according to gnus-maximum-newsgroup.
+
 2007-08-14  Tassilo Horn  <tassilo@member.fsf.org>
 
        * gnus-art.el (gnus-sticky-article): Fixed problems described in
index 61c316d..232f125 100644 (file)
@@ -1874,7 +1874,14 @@ article numbers will be returned."
                                (gnus-agent-find-parameter group
                                                           'agent-predicate)))))
          (articles (if fetch-all
-                       (gnus-uncompress-range (gnus-active group))
+                      (if gnus-maximum-newsgroup
+                          (let ((active (gnus-active group)))
+                            (gnus-uncompress-range
+                             (cons (max (car active)
+                                        (- (cdr active)
+                                           gnus-maximum-newsgroup -1))
+                                   (cdr active))))
+                        (gnus-uncompress-range (gnus-active group)))
                      (gnus-list-of-unread-articles group)))
          (gnus-decode-encoded-word-function 'identity)
         (gnus-decode-encoded-address-function 'identity)
index a3e2c9a..48bdd88 100644 (file)
@@ -5642,7 +5642,13 @@ If SELECT-ARTICLES, only select those articles from GROUP."
              ;; articles in the group, or (if that's nil), the
              ;; articles in the cache.
              (or
-              (gnus-uncompress-range (gnus-active group))
+              (if gnus-maximum-newsgroup
+                  (let ((active (gnus-active group)))
+                    (gnus-uncompress-range
+                     (cons (max (car active)
+                                (- (cdr active) gnus-maximum-newsgroup -1))
+                           (cdr active))))
+                (gnus-uncompress-range (gnus-active group)))
               (gnus-cache-articles-in-group group))
            ;; Select only the "normal" subset of articles.
            (gnus-sorted-nunion
@@ -6699,23 +6705,26 @@ displayed, no centering will be performed."
         (active (or (gnus-active group) (gnus-activate-group group)))
         (last (or (cdr active)
                   (error "Group %s couldn't be activated " group)))
+        (bottom (if gnus-maximum-newsgroup
+                    (max (car active) (- last gnus-maximum-newsgroup -1))
+                  (car active)))
         first nlast unread)
     ;; If none are read, then all are unread.
     (if (not read)
-       (setq first (car active))
+       (setq first bottom)
       ;; If the range of read articles is a single range, then the
       ;; first unread article is the article after the last read
       ;; article.  Sounds logical, doesn't it?
       (if (and (not (listp (cdr read)))
-              (or (< (car read) (car active))
+              (or (< (car read) bottom)
                   (progn (setq read (list read))
                          nil)))
-         (setq first (max (car active) (1+ (cdr read))))
+         (setq first (max bottom (1+ (cdr read))))
        ;; `read' is a list of ranges.
        (when (/= (setq nlast (or (and (numberp (car read)) (car read))
                                  (caar read)))
                  1)
-         (setq first (car active)))
+         (setq first bottom))
        (while read
          (when first
            (while (< first nlast)
@@ -6740,7 +6749,12 @@ displayed, no centering will be performed."
         (gnus-list-range-difference
          (gnus-list-range-difference
           (gnus-sorted-complement
-           (gnus-uncompress-range active)
+           (gnus-uncompress-range
+            (if gnus-maximum-newsgroup
+                (cons (max (car active)
+                           (- (cdr active) gnus-maximum-newsgroup -1))
+                      (cdr active))
+              active))
            (gnus-list-of-unread-articles group))
           (cdr (assq 'dormant marked)))
          (cdr (assq 'tick marked))))))
@@ -6752,23 +6766,26 @@ displayed, no centering will be performed."
   (let* ((read (gnus-info-read (gnus-get-info group)))
         (active (or (gnus-active group) (gnus-activate-group group)))
         (last (cdr active))
+        (bottom (if gnus-maximum-newsgroup
+                    (max (car active) (- last gnus-maximum-newsgroup -1))
+                  (car active)))
         first nlast unread)
     ;; If none are read, then all are unread.
     (if (not read)
-       (setq first (car active))
+       (setq first bottom)
       ;; If the range of read articles is a single range, then the
       ;; first unread article is the article after the last read
       ;; article.  Sounds logical, doesn't it?
       (if (and (not (listp (cdr read)))
-              (or (< (car read) (car active))
+              (or (< (car read) bottom)
                   (progn (setq read (list read))
                          nil)))
-         (setq first (max (car active) (1+ (cdr read))))
+         (setq first (max bottom (1+ (cdr read))))
        ;; `read' is a list of ranges.
        (when (/= (setq nlast (or (and (numberp (car read)) (car read))
                                  (caar read)))
                  1)
-         (setq first (car active)))
+         (setq first bottom))
        (while read
          (when first
             (push (cons first nlast) unread))
index c5038b7..211a22b 100644 (file)
@@ -1515,6 +1515,17 @@ If it is nil, no confirmation is required."
   :type '(choice (const :tag "No limit" nil)
                 integer))
 
+(defcustom gnus-maximum-newsgroup nil
+  "The maximum number of articles a newsgroup.
+If this is a number, old articles in a newsgroup exceeding this number
+are silently ignored.  If it is nil, no article is ignored.  Note that
+setting this variable to a number might prevent you from reading very
+old articles."
+  :group 'gnus-group-select
+  :version "22.2"
+  :type '(choice (const :tag "No limit" nil)
+                integer))
+
 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
   "*Non-nil means that the default name of a file to save articles in is the group name.
 If it's nil, the directory form of the group name is used instead.