Function: nnml-active-number

nnml-active-number is a byte-compiled function defined in nnml.el.gz.

Signature

(nnml-active-number GROUP &optional SERVER)

Documentation

Compute the next article number in GROUP on SERVER.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnml.el.gz
(defun nnml-active-number (group &optional server)
  "Compute the next article number in GROUP on SERVER."
  (let ((active (cadr (assoc-string group nnml-group-alist))))
    ;; The group wasn't known to nnml, so we just create an active
    ;; entry for it.
    (unless active
      ;; Perhaps the active file was corrupt?  See whether
      ;; there are any articles in this group.
      (nnml-possibly-create-directory group server)
      (nnml-possibly-change-directory group server)
      (unless nnml-article-file-alist
	(setq nnml-article-file-alist
	      (sort
	       (nnml-current-group-article-to-file-alist)
	       #'car-less-than-car)))
      (setq active
	    (if nnml-article-file-alist
		(cons (caar nnml-article-file-alist)
		      (caar (last nnml-article-file-alist)))
	      (cons 1 0)))
      (push (list group active) nnml-group-alist))
    (setcdr active (1+ (cdr active)))
    (while (file-exists-p
	    (nnml-group-pathname group (int-to-string (cdr active)) server))
      (setcdr active (1+ (cdr active))))
    (cdr active)))