Function: gnus-summary-expire-articles

gnus-summary-expire-articles is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-expire-articles &optional NOW)

Documentation

Expire all articles that are marked as expirable in the current group.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-expire-articles (&optional now)
  "Expire all articles that are marked as expirable in the current group."
  (interactive nil gnus-summary-mode)
  (when (and (not gnus-group-is-exiting-without-update-p)
	     (gnus-check-backend-function
	      'request-expire-articles gnus-newsgroup-name))
    ;; This backend supports expiry.
    (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
	   (expirable
	    (gnus-list-range-difference
	     (if total
		 (progn
		   ;; We need to update the info for
		   ;; this group for `gnus-list-of-read-articles'
		   ;; to give us the right answer.
		   (gnus-run-hooks 'gnus-exit-group-hook)
		   (gnus-summary-update-info)
		   (gnus-list-of-read-articles gnus-newsgroup-name))
	       (setq gnus-newsgroup-expirable
		     (sort gnus-newsgroup-expirable #'<)))
	     gnus-newsgroup-unexist))
	   (expiry-wait (if now 'immediate
			  (gnus-group-find-parameter
			   gnus-newsgroup-name 'expiry-wait)))
	   (nnmail-expiry-target
	    (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
		nnmail-expiry-target))
	   es)
      (when expirable
	;; There are expirable articles in this group, so we run them
	;; through the expiry process.
	(gnus-message 6 "Expiring articles...")
	(when (gnus-check-group gnus-newsgroup-name)
	  ;; The list of articles that weren't expired is returned.
	  (save-excursion
	    (if expiry-wait
		(let ((nnmail-expiry-wait-function nil)
		      (nnmail-expiry-wait expiry-wait))
		  (setq es (gnus-request-expire-articles
			    expirable gnus-newsgroup-name)))
	      (setq es (gnus-request-expire-articles
			expirable gnus-newsgroup-name)))
	    (unless total
	      (setq gnus-newsgroup-expirable es))
	    ;; We go through the old list of expirable, and mark all
	    ;; really expired articles as nonexistent.
	    (unless (eq es expirable) ;If nothing was expired, we don't mark.
	      (let ((gnus-use-cache nil))
		(dolist (article expirable)
		  (when (and (not (memq article es))
			     (gnus-data-find article))
		    (gnus-summary-mark-article article gnus-canceled-mark)
		    (run-hook-with-args
		     'gnus-summary-article-expire-hook
		     'delete
		     (gnus-data-header (gnus-data-find article))
		     gnus-newsgroup-name
		     (cond
		      ((stringp nnmail-expiry-target) nnmail-expiry-target)
		      ((eq nnmail-expiry-target 'delete) nil)
		      (t
		       (let ((rescall (funcall nnmail-expiry-target
					       gnus-newsgroup-name)))
			 (if (stringp rescall) rescall nil))))
		     nil)))))))
	(gnus-message 6 "Expiring articles...done")))))