Function: rmail-expunge

rmail-expunge is an interactive and byte-compiled function defined in rmail.el.gz.

Signature

(rmail-expunge &optional DONT-SHOW)

Documentation

Erase deleted messages from Rmail file and summary buffer.

This always shows a message (so as not to leave the Rmail buffer unswapped), and always updates any summary (so that it remains consistent with the Rmail buffer). If DONT-SHOW is non-nil, it does not pop any summary buffer.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
;; The DONT-SHOW argument is new in 23.  Does not seem very important.
(defun rmail-expunge (&optional dont-show)
  "Erase deleted messages from Rmail file and summary buffer.
This always shows a message (so as not to leave the Rmail buffer
unswapped), and always updates any summary (so that it remains
consistent with the Rmail buffer).  If DONT-SHOW is non-nil, it
does not pop any summary buffer."
  (interactive)
  (when (rmail-expunge-confirmed)
    (rmail-modify-format)
    (let ((was-deleted (rmail-message-deleted-p rmail-current-message))
	  (was-swapped (rmail-buffers-swapped-p)))
      (rmail-only-expunge t)
      ;; We always update the summary buffer, so that the contents
      ;; remain consistent with the rmail buffer.
      ;; The only difference is, in the dont-show case, we use a
      ;; cut-down version of rmail-select-summary that does not pop
      ;; the summary buffer.  It's only used by rmail-quit, which is
      ;; just going to bury any summary immediately after.  If we made
      ;; rmail-quit bury the summary first, dont-show could be removed.
      ;; But the expunge might not be confirmed...
      (if (rmail-summary-exists)
	  (if dont-show
	      (let ((total rmail-total-messages))
		(with-current-buffer rmail-summary-buffer
		  (let ((rmail-total-messages total))
		    (rmail-update-summary))))
	    (rmail-select-summary (rmail-update-summary))))
      ;; We always show a message, because (rmail-only-expunge t)
      ;; leaves the rmail buffer unswapped.
      ;; If we expunged the current message, a new one is current now,
      ;; so show it.  If we weren't showing a message, show it.
      (if (or was-deleted (not was-swapped))
	  (rmail-show-message-1 rmail-current-message)
	;; We can just show the same message that was being shown before.
	(rmail-display-labels)
	(rmail-swap-buffers)
	(setq rmail-buffer-swapped t)))))