>>>>> "RFP" == Rob Feztaa Park <feztaa@...> writes:
RFP> Alas! Bernard Massot spake thus:
RFP> > On Fri, Apr 19, 2002 at 02:13:31PM -0600, Rob 'Feztaa' Park wrote:
RFP> > > Then use the message-hooks idea that I posted, but replace the
RFP> > > `date +%m` bit with something that gives you the day-of-month of last
RFP> > > monday.
RFP> >
RFP> > I can't be sure the mail was written the previous monday.
RFP> > I may answer an old mail.
RFP>
RFP> Then I guess you'll just have to settle on speaking broken brezhoneg
RFP> then, won't you?
Oh, heavens.
This patch lets any variable that's subjected to %-expansion be a pipe,
just like filenames ($signature, source, etc.) can. With this patch,
Bernard can use
set attribution="~/.mutt/deiziat.sh %[%w] %d, %n en deus skrivet: |"
With something like:
#!/bin/sh
article="ar"
[ "$1" eq 1 ] && article="al"
shift
echo -n "D'$article $*"
and the attribution will be whatever deiziat.sh says. %-expandos are
expanded *before* the piped script is run (so watch your quoting), and
at the time that the variable is evaluated (not when the rcfile is
read).
I've wanted this kind of functionality a few times with other variables,
so maybe this approach is good. At the worst, it makes quoting rules
*much* simpler.
Note that if the text returned by your piped command ends in "%", the
command output will be recycled through the formatter. This means that
you can embed more mutt-style %-expandos in your command output, if you
like, so that the format sequences used can depend on the values of
other format sequences.
Watch out for newlines in your output -- the patch does not discard
them. And watch out for infinite loops. :)
Note also that you do probably do **NOT** want to use a piped command
for variables like $index_format which are evaluated frequently,
although someone might find some neat trick you can achieve with that.
Here's another fun example. "afh.sh" is attached.
set attribution="afh.sh -a '%n' '<%a>' |"
set indent_string="afh.sh -q '%n' |"
--
-D. dgc@... NSIT University of Chicago