[comp.emacs] RMAIL to mail format?

robert@eva.slu.se (06/08/90)

	I like to test the ELM mail system...
	How do I convert RMAIL with 150 messages to ordinary mail format?

						thanks in advace
						Robert Olsson

piet@cs.ruu.nl (Piet van Oostrum) (06/08/90)

In article <7193.266eb0d6@eva.slu.se>, robert@eva writes:
 |
 |	I like to test the ELM mail system...
 |	How do I convert RMAIL with 150 messages to ordinary mail format?
 |
This is how I do it:

First I go to the first message, and enter a keyboard macro that saves this
message to a certain file, and deletes the message.

Then I call the keyboard macro with numeric argument 149.

Something like this:

C-X ( C-O f i l e n a m e <RET> d C-X ) C-U 1 4 9 C-X e
-- 
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31-30-531806   Uucp:   uunet!mcsun!ruuinf!piet
Telefax:   +31-30-513791   Internet:  piet@cs.ruu.nl   (*`Pete')

jr@bbn.com (John Robinson) (06/08/90)

In article <3403@ruuinf.cs.ruu.nl>, piet@cs (Piet van Oostrum) writes:
>First I go to the first message, and enter a keyboard macro that saves this
>message to a certain file, and deletes the message.
>
>Then I call the keyboard macro with numeric argument 149.
>
>Something like this:
>
>C-X ( C-O f i l e n a m e <RET> d C-X ) C-U 1 4 9 C-X e

A handy feature of C-X ) [end-kbd-macro] is that it takes an argument
for how many times to repeat the macro right away.  Hence the
suggestion could be shortened to:

 C-X ( C-O f i l e n a m e <RET> d C-U 1 4 9 C-X )

.. just repeating something I first heard here long ago ...
--
/jr, nee John Robinson     Life did not take over the globe by combat,
jr@bbn.com or bbn!jr          but by networking -- Lynn Margulis

kaul@icarus.eng.ohio-state.edu (Rich Kaul) (06/08/90)

In article <7193.266eb0d6@eva.slu.se> robert@eva.slu.se writes:
	   I like to test the ELM mail system...
	   How do I convert RMAIL with 150 messages to ordinary mail format?

I use the following little shell script.  It has the advantage that
you can use your emacs for other things while you convert whole
directories... 

-rich

#!/bin/sh
#
# usage:	rmail-to-mail file1 file2 ...
#
# result:	file1~     is the original Babyl file
#		file1      is an empty Babyl file
#		file1.mail is a UNIX mail file with the messages from file1

cat > /tmp/$$.el << EOF
;;;
;;; Author:  Nathan Hess  (woodstock@hobbes.intel.com)
;;;
;;

(let ((file-to-be-converted (buffer-file-name))
      (message-count 0)
      (rmail-delete-after-output t)
      (unix-style-file-name (concat (buffer-file-name) ".mail")))
  (kill-buffer (current-buffer))
  (rmail file-to-be-converted)
  (rmail-show-message 1)
  (while (not (rmail-output unix-style-file-name))
    (setq message-count (1+ message-count)))
  (rmail-quit))
EOF

for f in "$@" ; do
    echo ">>> Doing $f"
    emacs -batch $f -l /tmp/$$.el -kill
    echo ">>> Done"
    mv -f $f.mail $f
    rm -f $f~
done

rm -f /tmp/$$.el

exit 0
-=-
Rich Kaul                         | "Every man is given the key to the door
kaul@icarus.eng.ohio-state.edu    |  of heaven; unfortunately, the same key
or ...!osu-cis!kaul		  |  opens the door to hell."

jr@bbn.com (John Robinson) (06/08/90)

In article <57163@bbn.BBN.COM>, jr@bbn (John Robinson) writes:
>A handy feature of C-X ) [end-kbd-macro] is that it takes an argument
>for how many times to repeat the macro right away.  Hence the
>suggestion could be shortened to:
>
> C-X ( C-O f i l e n a m e <RET> d C-U 1 4 9 C-X )
>
>.. just repeating something I first heard here long ago ...

... and incorrctly.  Reading the whole help for C-X ), I see that the
first iteration is already counted, so I should have said:

  C-X ( C-O f i l e n a m e <RET> d C-U 1 5 0 C-X )

to get a total of 150 iterations.  I missed the final line of the help
buffer because its window was small.  Here's the explanation:

  end-kbd-macro:
  Finish defining a keyboard macro.
  The definition was started by C-x (.
  The macro is now available for use via C-x e,
  or it can be given a name with M-x name-last-kbd-macro and then invoked
  under that name.
  With numeric arg, repeat macro now that many times,
  counting the definition just completed as the first repetition.

... back to the well of souls.
--
/jr, nee John Robinson     Life did not take over the globe by combat,
jr@bbn.com or bbn!jr          but by networking -- Lynn Margulis