Function: nnfolder-request-expire-articles

nnfolder-request-expire-articles is a byte-compiled function defined in nnfolder.el.gz.

Signature

(nnfolder-request-expire-articles ARTICLES NEWSGROUP &optional SERVER FORCE)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnfolder.el.gz
(deffoo nnfolder-request-expire-articles (articles newsgroup
						   &optional server force)
  (nnfolder-possibly-change-group newsgroup server)
  (let ((is-old t)
	;; The articles we have deleted so far.
	(deleted-articles nil)
	;; The articles that really exist and will
	;; be expired if they are old enough.
	(maybe-expirable
	 (gnus-sorted-intersection articles (nnfolder-existing-articles)))
	target)
    (nnmail-activate 'nnfolder)

    (with-current-buffer nnfolder-current-buffer
      ;; Since messages are sorted in arrival order and expired in the
      ;; same order, we can stop as soon as we find a message that is
      ;; too old.
      (while (and maybe-expirable is-old)
	(goto-char (point-min))
	(when (and (nnfolder-goto-article (car maybe-expirable))
		   (search-forward (concat "\n" nnfolder-article-marker)
				   nil t))
	  (forward-sexp)
	  (when (setq is-old
		      (nnmail-expired-article-p
		       newsgroup
		       (buffer-substring
			(point) (progn (end-of-line) (point)))
		       force nnfolder-inhibit-expiry))
	    (setq target nnmail-expiry-target)
	    (unless (eq target 'delete)
	      (with-temp-buffer
		(nnfolder-request-article (car maybe-expirable)
					  newsgroup server (current-buffer))
		(let ((nnfolder-current-directory nil))
		  (when (functionp target)
		    (setq target (funcall target newsgroup)))
		  (when (and target (not (eq target 'delete)))
		    (if (or (gnus-request-group target)
			    (gnus-request-create-group target))
			(nnmail-expiry-target-group target newsgroup)
		      (setq target nil)))))
	      (nnfolder-possibly-change-group newsgroup server))
	    (when target
	      (nnheader-message 5 "Deleting article %d in %s..."
				(car maybe-expirable) newsgroup)
	      (nnfolder-delete-mail)
	      (unless (or gnus-nov-is-evil nnfolder-nov-is-evil)
		(nnfolder-nov-delete-article newsgroup (car maybe-expirable)))
	      ;; Must remember which articles were actually deleted
	      (push (car maybe-expirable) deleted-articles))))
	(setq maybe-expirable (cdr maybe-expirable)))
      (unless nnfolder-inhibit-expiry
	(nnheader-message 5 "Deleting articles...done"))
      (nnfolder-save-buffer)
      (nnfolder-adjust-min-active newsgroup)
      (nnfolder-save-active nnfolder-group-alist nnfolder-active-file)
      (nnfolder-save-all-buffers)
      (gnus-sorted-difference articles (nreverse deleted-articles)))))