Function: rmail-summary-delete-forward

rmail-summary-delete-forward is an interactive and byte-compiled function defined in rmailsum.el.gz.

Signature

(rmail-summary-delete-forward &optional COUNT)

Documentation

Delete this message and move to next nondeleted one.

Deleted messages stay in the file until the M-x rmail-expunge (rmail-expunge) command is given. A prefix argument serves as a repeat count; a negative argument means to delete and move backward.

Key Bindings

Aliases

Rmail-Summ-delete

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmailsum.el.gz
;; Delete and undelete summary commands.

(defun rmail-summary-delete-forward (&optional count)
  "Delete this message and move to next nondeleted one.
Deleted messages stay in the file until the \\[rmail-expunge] command is given.
A prefix argument serves as a repeat count;
a negative argument means to delete and move backward."
  (interactive "p")
  (unless (numberp count) (setq count 1))
  (let (del-msg
        (backward (< count 0)))
    (while (/= count 0)
      ;; Don't waste time counting down without doing anything if we
      ;; are at the beginning and trying to go backward.
      (if (and backward (bobp))
          (setq count -1))
      (rmail-summary-goto-msg)
      (with-current-buffer rmail-buffer
	(setq del-msg rmail-current-message)
	(rmail-delete-message))
      (rmail-summary-mark-deleted del-msg)
      (while (and (not (if backward (bobp) (eobp)))
		  (save-excursion (beginning-of-line)
				  (looking-at " *[0-9]+D")))
	(forward-line (if backward -1 1)))
      (setq count
	    (if (> count 0) (1- count) (1+ count)))
      ;; It looks ugly to move to the empty line at end of buffer.
      ;; And don't waste time after hitting the end.
      (and (eobp) (not backward)
	   (progn (setq count 0)
		  (forward-line -1))))))