On 2001.08.06, in <[EMAIL PROTECTED]>,
        "Ailbhe Leamy" <[EMAIL PROTECTED]> wrote:
> Hi
> 
> I've been reformatting text using par, before editing it in vi.
> Basically, I've changed my editor to a script that pipes the message
> through par and then opens it in vi. The only trouble with this is that
> it also reformats my signatures at the bottom of the mail.

I'm not sure exactly how you're running par, but I'd think it's possible
to add in something to set its range.

Two thoughts:

1. Invoke par not as a pipeline, but as an argument to vi.  E.g.,
   set editor="vi '+/^>/;!}par" %s
   My vi doesn't do what I'd expect here, but I hope that's a bug in
   my vi. I don't know; I'll play with this some more just because
   I'm curious.

2. Use something more complex as your editor filter. Perl or awk should
   be able to split up the incoming document nicely. I've attached an
   example. This script filters the draft message, then runs the editor
   on it, leaving no temporary files behind.

-- 
 -D.    [EMAIL PROTECTED]        NSIT    University of Chicago
#!/usr/bin/perl

$new = $ARGV[0] . ".2";
open (IN, $ARGV[0]);
open (OUT, ">$new");
while (<IN>) {
        last if (/^>/);
        print OUT $_;
}
close (OUT);
open (OUT, "|par >>$new");
while (<IN>) {
        last if (/^-- /);
        print OUT $_;
}
close (OUT);
open (OUT, ">>$new");
print OUT $_;
while (<IN>) {
        print OUT $_;
}
close (OUT);
close (IN);
rename($new, $ARGV[0]);
system("vi \"$ARGV[0]\"");
exit ($?);

Reply via email to