2001-10-31 Simon Josefsson <jas@extundo.com>
authorSimon Josefsson <jas@extundo.com>
Wed, 31 Oct 2001 18:57:17 +0000 (18:57 +0000)
committerSimon Josefsson <jas@extundo.com>
Wed, 31 Oct 2001 18:57:17 +0000 (18:57 +0000)
* gnus-cus.el (gnus-group-parameters): Support integer `display'
parameter.

* gnus-sum.el (gnus-select-newsgroup): If group parameter
`display' is a number (and C-u wasn't used to enter group), only
fetch that number of articles.

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

index 59120b2..2d28e6a 100644 (file)
@@ -1,3 +1,12 @@
+2001-10-31  Simon Josefsson  <jas@extundo.com>
+
+       * gnus-cus.el (gnus-group-parameters): Support integer `display'
+       parameter.
+
+       * gnus-sum.el (gnus-select-newsgroup): If group parameter
+       `display' is a number (and C-u wasn't used to enter group), only
+       fetch that number of articles.
+
 2001-10-31  Matt Armstrong  <matt@lickey.com>
 
        * gnus.el (gnus-find-subscribed-addresses): Doc fix:
index e0e6088..b95f440 100644 (file)
@@ -178,6 +178,7 @@ you to put the admin address somewhere convenient.")
     (display (choice :tag "Display"
                     :value default
                     (const all)
+                    (integer)
                     (const default)
                     (sexp  :tag "Other")) "\
 Which articles to display on entering the group.
@@ -185,6 +186,10 @@ Which articles to display on entering the group.
 `all'
      Display all articles, both read and unread.
 
+`integer'
+     Display the last NUMBER articles in the group.  This is the same as
+     entering the group with C-u NUMBER.
+
 `default'
      Display the default visible articles, which normally includes
      unread and ticked articles.
index 92b0866..ffef484 100644 (file)
@@ -4552,6 +4552,24 @@ If SELECT-ARTICLES, only select those articles from GROUP."
              'gnus-not-ignore)
             ((arrayp display)
              (gnus-summary-display-make-predicate (mapcar 'identity display)))
+            ((numberp display)
+             ;; The following is probably the "correct" solution, but
+             ;; it makes Gnus fetch all headers and then limit the
+             ;; articles (which is slow), so instead we hack the
+             ;; select-articles parameter instead. -- Simon Josefsson
+             ;; <jas@kth.se>
+             ;;
+             ;; (gnus-byte-compile
+             ;;  `(lambda () (> number ,(- (cdr (gnus-active group))
+             ;;                         display)))))
+             (setq select-articles
+                   (gnus-uncompress-range
+                    (cons (let ((tmp (- (cdr (gnus-active group)) display)))
+                            (if (> tmp 0)
+                                tmp
+                              1))
+                          (cdr (gnus-active group)))))
+             nil)
             (t
              nil))))