[comp.emacs] "MM" mail text files to rmail format

katz@VENERA.ISI.EDU (08/31/90)

Hi,

The following is a HACK, but has worked on every MM message I tried it
on.  To run it, put it in a file (say, convert-mm.el), do M-X
load-file, read the MM file into a buffer, and then do M-x convert-mm-rmail.

Make sure you keep a backup copy of the original MM message around in
case something gets messed up!!  

The seen/unseen, flagged, etc infomation is lost in the conversion.
I believe all messages converted will be UNSEEN, and when you first go
to them, RMail will do some more converting (Its been a while since
I've used it).

By the way, MM was a great mail program, but the Unix version has
problems.   (RMail is much better though).

			Alan
				
--------------------------------------------------------
;;
;;   CONVERT-MM.EL
;;
;;   Keyboard macros and code to convert MM files to RMail.
;;            WARNING:  May not ALWAYS do right thing, but seems to work
;;
;;           Alan R. Katz, U.S.C. Information Sciences Institute
;;
;;                   Created: Wed Aug 17 11:30:28 1988
;;
;;                   Changes:
;;                       Katz@Venera.Isi.Edu, Thu Sep 15 15:27:46 1988


(defun convert-mm-rmail()
  "Convert current buffer of MM mail to Rmail format (Rmail will still need
to reformat it, so all messages will be marked unseen.)  Answered, flagged,
etc. information is lost.  DOES NOT save buffer when done."
  (interactive)
  (message "Converting MM messages in buffer to RMail format...")
  (save-excursion
    (goto-char (point-min))
    (while (search-forward ";0000000000" nil t)
      (beginning-of-line)
      (kill-line)
      (insert ?\C-_)
      (insert ?\C-l)
      (insert "\n0,,\n*** EOOH ***"))
    (goto-char (point-max))
    (insert ?\C-_))
  (message "Done."))