[comp.mail.elm] Elm not reading in RN mail message

wjohn@ux1.cso.uiuc.edu (wesley m john) (07/04/90)

I have a question about a troublesome little matter with rn and elm.  When
using elm as the MAILPOSTER for rn, how do I get it to automatically read in
the article being currently replied to?  

The best I can do right now is bring up elm with `elm -s %t` and then in the
editor, read in the .rnhead file which contains the contents of the current
article.  How do I get elm to automatically bring up the contents of the 
.rnhead file in the edit session?

Any help will be greatly appreciated.

wes
wjohn@uiuc.edu

pdc@sgi.com (Paul Close) (07/14/90)

In article <1990Jul4.165915.2800@ux1.cso.uiuc.edu> wjohn@ux1.cso.uiuc.edu (wesley m john) writes:
>I have a question about a troublesome little matter with rn and elm.  When
>using elm as the MAILPOSTER for rn, how do I get it to automatically read in
>the article being currently replied to?  
>
>The best I can do right now is bring up elm with `elm -s %t` and then in the
>editor, read in the .rnhead file which contains the contents of the current
>article.  How do I get elm to automatically bring up the contents of the 
>.rnhead file in the edit session?

Warning!  Kludge alert!
-----------------------

Note: None of what follows would be necessary if elm had an option to specify
the temporary file.  As an elm developer, I might do something about it, but
don't expect anything soon!  In the mean time, I present the following
kludge:

First, edit your ~/.elm/elmrc file, and comment out the line that sets your
editor:
#editor = vi

Next, define an environment variable EDITOR set to the editor you use (elm
will check this, and use it for editing).  Also (optionally) set RNINIR (this
is where rn will look for definitions):
    setenv EDITOR vi
    setenv RNINIT "$HOME/.rnrc"

Next, add the following lines to RNINT, or define them as environment
variables if you don't want to use the RNINIT mechanism:  (For some reason,
MAILHEADER must be at least a newline)

-------- from .rnrc --------
-EMAILHEADER="
"
-EMAILPOSTER="rn_mail %h \"%(%i=^\$?:Re: )%S\" %t"

Then put rn_mail and fool_elm in a directory in your path (don't forget to
make them executable).

-------- rn_mail --------
#!/bin/sh
# Arguments:
#	$1	data file set up by rn.
#	$2	subject
#	$3	to:
#
# Relys on the fact that elm uses the EDITOR environment variable
# to edit your message.  Our shell file 'fool_elm' gets the necessary
# info from rn (our first argument).
#
EDITOR="fool_elm $1"
export EDITOR
exec elm -s "$2" $3


-------- fool_elm --------
#!/bin/sh
#
# This file is run instead of the editor elm usually uses.  This allows us
# to insert info from rn (via "rn_mail") into elm's temporary file.
#
# The rn header file is removed after inserting it into elm's temp file
# so that multiple E)dits from elm won't continually insert the header.
#
rn_headers=$1
elm_tmp=$2
our_tmp=$2.$$
if [ -f $rn_headers ]; then
    mv $elm_tmp $our_tmp
    cat $rn_headers $our_tmp > $elm_tmp
    rm -f $our_tmp $rn_headers
fi
exec vi $elm_tmp
--
Paul Close	     pdc@sgi.com	   ...!{ames, decwrl, ucbvax}!sgi!pdc

   A diplomat is someone who can tell you to go to hell in such a way that
   you will look forward to the trip.