Re: macro for mailman moderation?
On Tue, Sep 20, 2005 at 03:12:52PM -0500, David Champion wrote:
> * On 2005.09.20, in <20050920192701.GI13423@xxxxxxxxxxxxxxxxxxxxxxx>,
> * "Will Yardley" <mutt-users@xxxxxxxxxxxxxxxxx> wrote:
> > Right - that's what I do. The problem (w/ writing a macro) is that it's
> > the last messaage/rfc822 attachment - I think in most cases, it's the
> > second, so I guess I could search twice.
>
> <last-entry>
> <search-reverse>
> > What I'm most confused about is how to do the editor thing. I tried "set
> > editor=builtin<enter><reply>.<enter>
> If you're looking for full automation, that's always tedious. I think
> the suggestion is almost always to write a script that performs the
> edits you want (i.e., the moderation task) and saves the file back to
> the location it was read from.
I know this is from almost a year ago... anyway, first attempt. Feedback
welcome. Thought I'd post here in case it's useful to anyone. After
everyone tells me how it can be better, I'll post to the Mailman list in
case it's helpful to folks there.
http://veggiechinese.net/mutt_mailman_approve.txt
It's a perl script; it requires File::Copy, File::Temp and
Term::ReadLine, which should all be pretty standard, I think. I'm sure
it could be done in other languages too... this is just how I ended up
doing it.
Basically, to use this for approving / rejecting messages from the
Mailman list manager, setup macros for the pager / index like the
following:
macro index M ":set editor=~/bin/mutt_mailman_approve.pl<enter> \
<view-attachments><last-entry><search-reverse>message/rfc822<enter> \
<reply><send-message>:set editor=\"vim +'/^$/+2'\"<enter><exit>"
(where ~/bin/mutt_mailman_approve.pl is the path to the script)
- replacing "vim ...." with your normal editor.
You could also presumably use message-hooks so that just hitting "r"
would run this.
w