<<< Date Index >>>     <<< Thread Index >>>

Re: Changing Headers in the Compose screen



On Mon, Jan 19, 2004 at 08:51:52AM EST, Christoph Berg wrote:
> Re: David Yitzchak Cohen in <20040119053602.GP16674@xxxxxxx>

> > > macro   compose   
> > >   <f5> "my_hdr From: William O'Higgins <addy_I_want@xxxxxxxxxxx>"
> > 
> > Nope, that won't work.  When you're in the compose menu, Mutt has already
> > created the message, so it's too late for a my_hdr to take effect.
> > It'll only affect messages you compose after that.
> 
> Changing the From: header in the compose menu is easy:
> 
> macro compose <f5> "<edit-from><kill-line>William O'Higgins 
> <addy_I_want@xxxxxxxxxxx><enter>"

I never noticed the edit-from function ... live and learn :-)

> > macro compose <f5> ":set editor='some_script'\n<edit-headers>:set 
> > editor='vi'"
> > 
> > ...and here's some_script:
> > 
> > #!/bin/sh
> > file=$1
> > (
> >  echo "/From:/s/^.*\$/From: William O'Higgins <addy_I_want@xxxxxxxxxxx>/"
> >  echo "/Reply-To:/s/^.*\$/Reply-To: William O'Higgins 
> > <addy_I_want@xxxxxxxxxxx>/
> > wq"
> > ) | ed $file
> 
> Perl's -i switch is very handy for in-place editing.

Yeah, I know, but a lot of us treat it as a status symbol that we prefer
to automate an ed session :-)

I mean, come on:

#!/usr/bin/perl -in

s/^From:.*\$/From: William O'Higgins <addy_I_want@xxxxxxxxxxx>/;
s/^Reply-To:.*\$/Reply-To: William O'Higgins <addy_I_want@xxxxxxxxxxx>/;


It just doesn't look nearly as cool as my pipeline to ed ;-P

 - Dave [who didn't even think of using perl -i before, to be honest]

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpKSOUXoZGCr.pgp
Description: PGP signature