Function: gnus-group-catchup

gnus-group-catchup is a byte-compiled function defined in gnus-group.el.gz.

Signature

(gnus-group-catchup GROUP &optional ALL)

Documentation

Mark all articles in GROUP as read.

If ALL is non-nil, all articles are marked as read. The return value is the number of articles that were marked as read, or nil if no action could be taken.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
(defun gnus-group-catchup (group &optional all)
  "Mark all articles in GROUP as read.
If ALL is non-nil, all articles are marked as read.
The return value is the number of articles that were marked as read,
or nil if no action could be taken."
  (let* ((entry (gnus-group-entry group))
	 (num (car entry))
	 (marks (gnus-info-marks (nth 1 entry)))
	 (unread (gnus-sequence-of-unread-articles group)))
    ;; Remove entries for this group.
    (nnmail-purge-split-history group)
    ;; Do the updating only if the newsgroup isn't killed.
    (if (not (numberp (car entry)))
	(gnus-message 1 "Can't catch up %s; non-active group" group)
      (gnus-update-read-articles group nil)
      (when all
	;; Nix out the lists of marks and dormants.
	(gnus-request-set-mark group (list (list (cdr (assq 'tick marks))
						 'del '(tick))
					   (list (cdr (assq 'dormant marks))
						 'del '(dormant))))
	(setq unread (gnus-range-add (gnus-range-add
                                      unread (cdr (assq 'dormant marks)))
                                     (cdr (assq 'tick marks))))
	(gnus-add-marked-articles group 'tick nil nil 'force)
	(gnus-add-marked-articles group 'dormant nil nil 'force))
      ;; Do auto-expirable marks if that's required.
      (when (and (gnus-group-auto-expirable-p group)
		 (not (gnus-group-read-only-p group)))
        (gnus-range-map
	 (lambda (article)
	   (gnus-add-marked-articles group 'expire (list article))
	   (gnus-request-set-mark group (list (list (list article)
						    'add '(expire)))))
	 unread))
      (let ((gnus-newsgroup-name group))
	(gnus-run-hooks 'gnus-group-catchup-group-hook))
      num)))