Function: rmail-convert-babyl-to-mbox

rmail-convert-babyl-to-mbox is a byte-compiled function defined in rmail.el.gz.

Signature

(rmail-convert-babyl-to-mbox)

Documentation

Convert the mail file from Babyl version 5 to mbox.

This function also reinitializes local variables used by Rmail.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-convert-babyl-to-mbox ()
  "Convert the mail file from Babyl version 5 to mbox.
This function also reinitializes local variables used by Rmail."
  (let ((old-file (make-temp-file "rmail"))
	(new-file (make-temp-file "rmail")))
    (unwind-protect
	(progn
	  (kill-all-local-variables)
	  (write-region (point-min) (point-max) old-file)
	  (unrmail old-file new-file)
	  (message "Replacing BABYL format with mbox format...")
	  (let ((inhibit-read-only t)
		(coding-system-for-read 'raw-text)
		(buffer-undo-list t))
	    (erase-buffer)
	    (insert-file-contents new-file)
	    ;; Rmail buffers need to be saved with Unix EOLs, or else
	    ;; the format will not be recognized.
	    (set-buffer-file-coding-system 'raw-text-unix)
	    (rmail-mode-1)
	    (rmail-perm-variables)
	    (rmail-variables)
	    (setq rmail-was-converted t)
	    (rmail-dont-modify-format)
	    (goto-char (point-max))
	    (rmail-set-message-counters))
	  (message "Replacing BABYL format with mbox format...done"))
      (delete-file old-file)
      (delete-file new-file))))