Function: nnvirtual-update-read-and-marked

nnvirtual-update-read-and-marked is a byte-compiled function defined in nnvirtual.el.gz.

Signature

(nnvirtual-update-read-and-marked READ-P UPDATE-P)

Documentation

Copy marks from the virtual group to the component groups.

If READ-P is not nil, update the (un)read status of the components. If UPDATE-P is not nil, call gnus-group-update-group on the components.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnvirtual.el.gz
(defun nnvirtual-update-read-and-marked (read-p update-p)
  "Copy marks from the virtual group to the component groups.
If READ-P is not nil, update the (un)read status of the components.
If UPDATE-P is not nil, call `gnus-group-update-group' on the
components."
  (when nnvirtual-current-group
    (let ((unreads (and read-p
			(nnvirtual-partition-sequence
			 (gnus-list-of-unread-articles
			  (nnvirtual-current-group)))))
	  (type-marks
	   (delq nil
		 (mapcar (lambda (ml)
			   (if (eq (car ml) 'score)
			       nil
			     (cons (car ml)
				   (nnvirtual-partition-sequence (cdr ml)))))
			 (gnus-info-marks (gnus-get-info
					   (nnvirtual-current-group))))))
	  type groups info)

      ;; Ok, atomically move all of the (un)read info, clear any old
      ;; marks, and move all of the current marks.  This way if someone
      ;; hits C-g, you won't leave the component groups in a half-way state.
      (progn
	;; move (un)read
	;; bind for workaround guns-update-read-articles
	(let ((gnus-newsgroup-active nil))
	  (dolist (entry unreads)
	    (gnus-update-read-articles (car entry) (cdr entry))))

	;; clear all existing marks on the component groups
	(dolist (group nnvirtual-component-groups)
	  (when (and (setq info (gnus-get-info group))
		     (gnus-info-marks info))
	    (setf (gnus-info-marks info)
		  (if (assq 'score (gnus-info-marks info))
		      (list (assq 'score (gnus-info-marks info)))
		    nil))))

	;; Ok, currently type-marks is an assq list with keys of a mark type,
	;; with data of an assq list with keys of component group names
	;; and the articles which correspond to that key/group pair.
	(dolist (mark type-marks)
	  (setq type (car mark))
	  (setq groups (cdr mark))
	  (dolist (carticles groups)
	    (gnus-add-marked-articles (car carticles) type (cdr carticles)
				      nil t))))

      ;; possibly update the display, it is really slow
      (when update-p
	(dolist (group nnvirtual-component-groups)
	  (gnus-group-update-group group t))))))