+(defun gnus-summary-insert-articles (articles)
+ (when (setq articles
+ (gnus-set-difference articles
+ (mapcar (lambda (h) (mail-header-number h))
+ gnus-newsgroup-headers)))
+ (setq gnus-newsgroup-headers
+ (merge 'list
+ gnus-newsgroup-headers
+ (gnus-fetch-headers articles)
+ 'gnus-article-sort-by-number))
+ ;; Suppress duplicates?
+ (when gnus-suppress-duplicates
+ (gnus-dup-suppress-articles))
+
+ ;; We might want to build some more threads first.
+ (when (and gnus-fetch-old-headers
+ (eq gnus-headers-retrieved-by 'nov))
+ (if (eq gnus-fetch-old-headers 'invisible)
+ (gnus-build-all-threads)
+ (gnus-build-old-threads)))
+ ;; Let the Gnus agent mark articles as read.
+ (when gnus-agent
+ (gnus-agent-get-undownloaded-list))
+ ;; Remove list identifiers from subject
+ (when gnus-list-identifiers
+ (gnus-summary-remove-list-identifiers))
+ ;; First and last article in this newsgroup.
+ (when gnus-newsgroup-headers
+ (setq gnus-newsgroup-begin
+ (mail-header-number (car gnus-newsgroup-headers))
+ gnus-newsgroup-end
+ (mail-header-number
+ (gnus-last-element gnus-newsgroup-headers))))
+ (when gnus-use-scoring
+ (gnus-possibly-score-headers))))
+
+(defun gnus-summary-insert-old-articles (&optional all)
+ "Insert all old articles in this group.
+If ALL is non-nil, already read articles become readable.
+If ALL is a number, fetch this number of articles."
+ (interactive "P")
+ (prog1
+ (let ((old (mapcar 'car gnus-newsgroup-data))
+ (i (car gnus-newsgroup-active))
+ older len)
+ (while (<= i (cdr gnus-newsgroup-active))
+ (or (memq i old) (push i older))
+ (incf i))
+ (setq len (length older))
+ (cond
+ ((null older) nil)
+ ((numberp all)
+ (if (< all len)
+ (setq older (subseq older 0 all))))
+ (all nil)
+ (t
+ (if (and (numberp gnus-large-newsgroup)
+ (> len gnus-large-newsgroup))
+ (let ((input
+ (read-string
+ (format
+ "How many articles from %s (default %d): "
+ (gnus-limit-string
+ (gnus-group-decoded-name gnus-newsgroup-name) 35)
+ len))))
+ (unless (string-match "^[ \t]*$" input)
+ (setq all (string-to-number input))
+ (if (< all len)
+ (setq older (subseq older 0 all))))))))
+ (if (not older)
+ (message "No old news.")
+ (gnus-summary-insert-articles older)
+ (gnus-summary-limit (gnus-union older old))))
+ (gnus-summary-position-point)))
+
+(defun gnus-summary-insert-new-articles ()
+ "Insert all new articles in this group."
+ (interactive)
+ (prog1
+ (let ((old (mapcar 'car gnus-newsgroup-data))
+ (old-active gnus-newsgroup-active)
+ (nnmail-fetched-sources (list t))
+ i new)
+ (setq gnus-newsgroup-active
+ (gnus-activate-group gnus-newsgroup-name 'scan))
+ (setq i (1+ (cdr old-active)))
+ (while (<= i (cdr gnus-newsgroup-active))
+ (push i new)
+ (incf i))
+ (if (not new)
+ (message "No gnus is bad news.")
+ (setq new (nreverse new))
+ (gnus-summary-insert-articles new)
+ (setq gnus-newsgroup-unreads
+ (append gnus-newsgroup-unreads new))
+ (gnus-summary-limit (gnus-union old new))))
+ (gnus-summary-position-point)))
+