Function: gnus-summary-delete-article

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

Signature

(gnus-summary-delete-article &optional N)

Documentation

Delete the N next (mail) articles.

This command actually deletes articles. This is not a marking command. The article will disappear forever from your life, never to return.

If N is negative, delete backwards. If N is nil and articles have been marked with the process mark, delete these instead.

If gnus-novice-user is non-nil you will be asked for confirmation before the articles are deleted.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
(defun gnus-summary-delete-article (&optional n)
  "Delete the N next (mail) articles.
This command actually deletes articles.  This is not a marking
command.  The article will disappear forever from your life, never to
return.

If N is negative, delete backwards.
If N is nil and articles have been marked with the process mark,
delete these instead.

If `gnus-novice-user' is non-nil you will be asked for
confirmation before the articles are deleted."
  (interactive "P" gnus-summary-mode)
  (unless (gnus-check-backend-function 'request-expire-articles
				       gnus-newsgroup-name)
    (error "The current newsgroup does not support article deletion"))
  (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
    (error "Couldn't open server"))
  ;; Compute the list of articles to delete.
  (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) #'<))
	(nnmail-expiry-target 'delete)
	not-deleted)
    (if (and gnus-novice-user
	     (not (gnus-yes-or-no-p
		   (format "Do you really want to delete %s forever? "
			   (if (> (length articles) 1)
			       (format "these %s articles" (length articles))
			     "this article")))))
	()
      ;; Delete the articles.
      (setq not-deleted (gnus-request-expire-articles
			 articles gnus-newsgroup-name 'force))
      (save-excursion
	(while articles
	  (gnus-summary-remove-process-mark (car articles))
	  ;; The backend might not have been able to delete the article
	  ;; after all.
	  (unless (memq (car articles) not-deleted)
	    (gnus-summary-mark-article (car articles) gnus-canceled-mark)
	    (let* ((article (car articles))
		   (ghead  (gnus-data-header (gnus-data-find article))))
	      (run-hook-with-args 'gnus-summary-article-delete-hook
				  'delete ghead gnus-newsgroup-name nil
				  nil)))
	  (setq articles (cdr articles))))
      (when not-deleted
	(gnus-message 4 "Couldn't delete articles %s" not-deleted)))
    (gnus-summary-position-point)
    (gnus-set-mode-line 'summary)
    not-deleted))