Function: gnus-group-make-articles-read

gnus-group-make-articles-read is a byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-group-make-articles-read GROUP ARTICLES)

Documentation

Update the info of GROUP to say that ARTICLES are read.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-group-make-articles-read (group articles)
  "Update the info of GROUP to say that ARTICLES are read."
  (let* ((num 0)
	 (entry (gnus-group-entry group))
	 (info (nth 1 entry))
	 (active (gnus-active group))
	 (set-marks
	  (gnus-method-option-p
	   (gnus-find-method-for-group group)
	   'server-marks))
	 range)
    (if (not entry)
	;; Group that Gnus doesn't know exists, but still allow the
	;; backend to set marks.
	(when set-marks
	  (gnus-request-set-mark
	   group (list (list (gnus-compress-sequence (sort articles #'<))
			     'add '(read)))))
      ;; Normal, subscribed groups.
      (setq range (gnus-compute-read-articles group articles))
      (with-current-buffer gnus-group-buffer
	(gnus-undo-register
	  `(progn
	     (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
	     (setf (gnus-info-read ',info) ',(gnus-info-read info))
	     (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
	     (when ,set-marks
	       (gnus-request-set-mark
		,group (list (list ',range 'del '(read)))))
	     (gnus-group-jump-to-group ,group)
	     (gnus-group-update-group ,group t))))
      ;; Add the read articles to the range.
      (setf (gnus-info-read info) range)
      (when set-marks
	(gnus-request-set-mark group (list (list range 'add '(read)))))
      ;; Then we have to re-compute how many unread
      ;; articles there are in this group.
      (when active
	(cond
	 ((not range)
	  (setq num (- (1+ (cdr active)) (car active))))
	 ((not (listp (cdr range)))
	  (setq num (- (cdr active) (- (1+ (cdr range))
				       (car range)))))
	 (t
	  (while range
	    (if (numberp (car range))
		(setq num (1+ num))
	      (setq num (+ num (- (1+ (cdar range)) (caar range)))))
	    (setq range (cdr range)))
	  (setq num (- (cdr active) num))))
	;; Update the number of unread articles.
	(setcar entry num)
	;; Update the group buffer.
	(unless (gnus-ephemeral-group-p group)
	  (gnus-group-update-group group t))))))