+ 'unread)))
+
+(defun elmo-spam-process-messages-as-mbox (folder numbers number-per-process
+ function &rest args)
+ (with-temp-buffer
+ (while numbers
+ (let ((count 0))
+ (while (and numbers (< count number-per-process))
+ (insert "From MAILER-DAEMON@example.com\n")
+ (let ((begin (point)))
+ (insert
+ (with-temp-buffer
+ (elmo-spam-message-fetch folder (car numbers))
+ (buffer-string)))
+ (goto-char begin)
+ (while (re-search-forward "^>*From " nil t)
+ (goto-char (match-beginning 0))
+ (insert ?>)
+ (forward-line))
+ (goto-char (point-max))
+ (insert "\n\n"))
+ (setq count (1+ count)
+ numbers (cdr numbers)))
+ (apply function count args)
+ (erase-buffer)))))