(while all-files
(let ((opoint (point))
(new-messages 0)
+ (rsf-number-of-spam 0)
(delete-files ())
;; If buffer has not changed yet, and has not been saved yet,
;; don't replace the old backup file now.
(progn (goto-char opoint)
(if (or file-name rmail-inbox-list)
(message "(No new mail has arrived)")))
- (if (rmail-summary-exists)
+ ;; check new messages to see if any of them is spam:
+ (if rmail-use-spam-filter
+ (let*
+ ((old-messages (- rmail-total-messages new-messages))
+ (rsf-scanned-message-number (1+ old-messages))
+ ;; save deletion flags of old messages: vector starts
+ ;; at zero (is one longer that no of messages),
+ ;; therefore take 1+ old-messages
+ (save-deleted
+ (substring rmail-deleted-vector 0 (1+
+ old-messages))))
+ ;; set all messages to undeleted
+ (setq rmail-deleted-vector
+ (make-string (1+ rmail-total-messages) ?\ ))
+ (while (<= rsf-scanned-message-number
+ rmail-total-messages)
+ (progn
+ (if (not (rmail-spam-filter rsf-scanned-message-number))
+ (progn (setq rsf-number-of-spam (1+ rsf-number-of-spam)))
+ )
+ (setq rsf-scanned-message-number (1+ rsf-scanned-message-number))
+ ))
+ (if (> rsf-number-of-spam 0)
+ (progn
+ (when (rmail-expunge-confirmed)
+ (rmail-only-expunge t))
+ ))
+ (setq rmail-deleted-vector
+ (concat
+ save-deleted
+ (make-string (- rmail-total-messages old-messages)
+ ?\ )))
+ ))
+ (if (rmail-summary-exists)
(rmail-select-summary
(rmail-update-summary)))
- (message "%d new message%s read"
- new-messages (if (= 1 new-messages) "" "s"))
+ (message "%d new message%s read%s"
+ new-messages (if (= 1 new-messages) "" "s")
+ ;; print out a message on number of spam messages found:
+ (if (and rmail-use-spam-filter (> rsf-number-of-spam 0))
+ (if (= 1 new-messages)
+ (format ", and found to be a spam message"
+ rsf-number-of-spam)
+ (if (> rsf-number-of-spam 1)
+ (format ", %d of which found to be spam messages"
+ rsf-number-of-spam)
+ (format ", one of which found to be a spam message"
+ rsf-number-of-spam)))
+ ""))
+ (if (and rmail-use-spam-filter (> rsf-number-of-spam 0))
+ (progn (if rmail-spam-filter-beep (beep t))
+ (sleep-for rmail-spam-sleep-after-message)))
+
;; Move to the first new message
;; unless we have other unseen messages before it.
(rmail-show-message (rmail-first-unseen-message))
(funcall rmail-confirm-expunge
"Erase deleted messages from Rmail file? ")))
-(defun rmail-only-expunge ()
+(defun rmail-only-expunge (&optional dont-show)
"Actually erase all deleted messages in the file."
(interactive)
(set-buffer rmail-buffer)
(message "Expunging deleted messages...done")
(if (not win)
(narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)))
- (rmail-show-message
- (if (zerop rmail-current-message) 1 nil))
- (if rmail-enable-mime
- (goto-char (+ (point-min) opoint))
- (goto-char (+ (point) opoint))))))
+ (if (not dont-show)
+ (rmail-show-message
+ (if (zerop rmail-current-message) 1 nil)
+ (if rmail-enable-mime
+ (goto-char (+ (point-min) opoint))
+ (goto-char (+ (point) opoint))))))))
(defun rmail-expunge ()
"Erase deleted messages from Rmail file and summary buffer."