[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] wrapper to repl vs. replyfilter

From: Ken Hornstein
Subject: Re: [Nmh-workers] wrapper to repl vs. replyfilter
Date: Thu, 14 Feb 2013 16:53:22 -0500

>I use a perl wrapper around "repl" which examines the headers to determine
>which of my accounts received the mail. Based on the account name, the
>wrapper sets environment variables to contain different valies for the
>From, Reply-To, and Fcc headers and the signature, then calls the real

As a side note ... if you wanted to change your wrapper so you didn't have
to set environment variables ... well, I _was_ going to say that you could
use the -from switch to repl, but I didn't make one because I guess I thought
you could embed that in the mh-format.  You _can_ do that, and I do it, but
I'll be the first to admit it can get unwieldly.  Here's a snippet:

%<{delivered-to}%<(match address@hidden)\
From: Ken Hornstein <address@hidden>
%(void(num 1))%|%(void(num))%>

The whole "num 1" thing is done as a flag to indicate later on that I actually
set the From header and my final fallback rule doesn't need to be invoked.
The format language is actually relatively complete considering it's age,
but it doesn't have the power of something like Perl, so I can completely
understand why you'd want to use that instead.  Maybe someday we'll have a
real embedded language in there ...

>Within my mhl reply filter, I use the environment variable "$SIGNATURE", set
>within the wrapper, as in:
>subject:nocompress,nocomponent,formatfield="%(void(getenv SIGNATURE))%(putstr)"
>The problem is that the signature also gets formatted by the replyfilter.

Are you sure?

For various complicated reasons, the replyfilter can only be used with the
"body" component (short answer: mhl is stupid).  So it occurs to me that
your trick of using the subject component to trigger the signature shouldn't
actually be caught by replyfilter at all.  And some experimentation leads
me to believe that is correct .... replyfilter doesn't catch that at all.
Sure, it ends up in the draft, but it doesn't get touched by replyfilter.

Now, it may be that your signature has newlines, tabs, or repeated
spaces in it, and you're finding out those are being converted to single
spaces.  _That_ is happening because you're using %(putstr), which has
that feature.  If you switched to %(putlit) then that wouldn't happen.
In fact ... now that I remember, I added %(putlit) because you asked
for it :-)

But if that doesn't work ....

>I could hack replyfilter to append the value of $SIGNATURE (if defined).

I'm partial to replyfilter since I wrote it, and that's certainly a
reasonable option.  I'd take patches for that.

>I could hack replyfilter to pull in all the functionality of my repl wrapper.

I don't think that's possible, unfortunately.  replyfilter only gets
access to the message body, not the headers (which is why it needs to see
the key MIME headers on the command line).

>I'd prefer using a formatter within replyfilter that will exclude the
>signature block.  Does anyone know if par (or a different formatting
>program) can be told:

I am not aware of such a program.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]