Function: rmail-unrmail-new-mail-maybe

rmail-unrmail-new-mail-maybe is a byte-compiled function defined in rmail.el.gz.

Signature

(rmail-unrmail-new-mail-maybe FILE SIZE)

Documentation

If newly read mail from FILE is in Babyl format, convert it to mbox format.

SIZE is the original size of the newly read mail. Value is the size of the newly read mail after conversion.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-unrmail-new-mail-maybe (file size)
  "If newly read mail from FILE is in Babyl format, convert it to mbox format.

SIZE is the original size of the newly read mail.
Value is the size of the newly read mail after conversion."
  ;; Detect previous Babyl format files.
  (let ((case-fold-search nil)
	(old-file file))
    (cond ((looking-at "BABYL OPTIONS:")
	   ;; The new mail is in Babyl version 5 format.  Use unrmail
	   ;; to convert it.
	   (setq size (rmail-unrmail-new-mail old-file)))
	  ((looking-at "Version: 5\n")
	   ;; New mail is in Babyl format made by old version of
	   ;; Rmail.  Fix the babyl file header and use unrmail to
	   ;; convert it.
	   (let ((buffer-read-only nil)
		 (write-region-annotate-functions nil)
		 (write-region-post-annotation-function nil)
		 (old-file  (make-temp-file "rmail")))
	     (insert "BABYL OPTIONS: -*- rmail -*-\n")
	     (forward-line -1)
	     (write-region (point) (point-max) old-file)
	     (setq size (rmail-unrmail-new-mail old-file))
	     (delete-file old-file))))
    size))