Function: nnselect-generate-artlist

nnselect-generate-artlist is a byte-compiled function defined in nnselect.el.gz.

Signature

(nnselect-generate-artlist GROUP &optional SPECS INFO)

Documentation

Generate and return the artlist for GROUP using SPECS.

The artlist is sorted by rsv, lexically over groups, and by article number. SPECS should be an alist including an nnselect-function and an nnselect-args. The former applied to the latter should create the artlist. If SPECS is nil retrieve the specs from the group parameters. If INFO update the group info.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnselect.el.gz
(defun nnselect-generate-artlist (group &optional specs info)
  "Generate and return the artlist for GROUP using SPECS.
The artlist is sorted by rsv, lexically over groups, and by
article number.  SPECS should be an alist including an
`nnselect-function' and an `nnselect-args'.  The former applied
to the latter should create the artlist.  If SPECS is nil
retrieve the specs from the group parameters.  If INFO update the
group info."
  (let* ((specs
          (or specs (gnus-group-get-parameter group 'nnselect-specs t)))
         (function (alist-get 'nnselect-function specs))
         (args (alist-get 'nnselect-args specs)))
    (condition-case-unless-debug err
        (progn
          (let ((gnus-newsgroup-selection
                 (sort
                  (funcall function args)
                  (lambda (x y)
                    (let ((xgroup (nnselect-artitem-group x))
                          (ygroup (nnselect-artitem-group y))
                          (xrsv (nnselect-artitem-rsv x))
                          (yrsv (nnselect-artitem-rsv y)))
                      (or (< xrsv yrsv)
                          (and (eql xrsv yrsv)
                               (or (string<  xgroup ygroup)
                                   (and (string= xgroup ygroup)
                                        (< (nnselect-artitem-number x)
                                           (nnselect-artitem-number y)))))))))))
            (when info
              (if gnus-newsgroup-selection
                  (nnselect-request-update-info group info)
                (gnus-set-active group '(1 . 0))))
            (nnselect-store-artlist group gnus-newsgroup-selection)
            gnus-newsgroup-selection))
      ;; Don't swallow gnus-search errors; the user should be made
      ;; aware of them.
      (gnus-search-error
       (signal (car err) (cdr err)))
      (error
       (gnus-error
        3
        "nnselect-generate-artlist: %s on %s gave error %s" function args err)
       []))))