Function: nnselect-request-update-info

nnselect-request-update-info is a byte-compiled function defined in nnselect.el.gz.

Signature

(nnselect-request-update-info GROUP INFO &optional SERVER)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnselect.el.gz
(deffoo nnselect-request-update-info (group info &optional _server)
  (let* ((group (nnselect-add-prefix group))
	 (gnus-newsgroup-selection
	  (or gnus-newsgroup-selection (nnselect-get-artlist group)))
	 newmarks)
    (gnus-info-set-marks info nil)
    (setf (gnus-info-read info) nil)
    (pcase-dolist (`(,artgroup . ,nartids)
		   (ids-by-group
		    (number-sequence 1 (nnselect-artlist-length
					gnus-newsgroup-selection))))
      (let* ((gnus-newsgroup-active nil)
	     (artids (cl-sort nartids #'< :key 'car))
	     (group-info (gnus-get-info artgroup))
	     (marks (gnus-info-marks group-info))
	     (unread (gnus-uncompress-sequence
		      (gnus-range-difference (gnus-active artgroup)
					     (gnus-info-read group-info)))))
	(setf (gnus-info-read info)
	      (gnus-add-to-range
	       (gnus-info-read info)
	       (delq nil (mapcar
                          (lambda (art)
                            (unless (memq (cdr art) unread) (car art)))
			  artids))))
	(pcase-dolist (`(,type . ,mark-list) marks)
	  (let ((mark-type (gnus-article-mark-to-type type)) new)
	    (when
		(setq new
		      (delq nil
			    (cond
			     ((eq mark-type 'tuple)
			      (mapcar
                               (lambda (id)
                                 (let (mark)
                                   (when
                                       (setq mark (assq (cdr id) mark-list))
                                     (cons (car id) (cdr mark)))))
			       artids))
			     (t
			      (setq mark-list
				    (gnus-uncompress-range mark-list))
			      (mapcar
                               (lambda (id)
                                 (when (memq (cdr id) mark-list)
                                   (car id)))  artids)))))
	      (let ((previous (alist-get type newmarks)))
		(if previous
		    (nconc previous new)
		  (push (cons type new) newmarks))))))))

    ;; Clean up the marks: compress lists;
    (pcase-dolist (`(,type . ,mark-list) newmarks)
      (let ((mark-type (gnus-article-mark-to-type type)))
	(unless (eq mark-type 'tuple)
	  (setf (alist-get type newmarks)
		(gnus-compress-sequence mark-list)))))
    ;; and ensure an unexist key.
    (unless (assq 'unexist newmarks)
      (push (cons 'unexist nil) newmarks))

    (gnus-info-set-marks info newmarks)
    (gnus-set-active group (cons 1 (nnselect-artlist-length
				    gnus-newsgroup-selection)))))