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

Re: aliasing mailing lists



On (20:16 18/05/06), cga2000 <cga2000@xxxxxxxxxxxxx> put forth the proposition:
> On Thu, May 18, 2006 at 12:07:40PM EDT, David Woodfall wrote:
> > On (14:58 18/05/06), David Woodfall <dave@xxxxxxxxxxxxxxx> put forth the 
> > proposition:
> > > On (03:25 18/05/06), cga2000 <cga2000@xxxxxxxxxxxxx> put forth the 
> > > proposition:
>       
> [..]
> > 
> > This is more complete I think;
> > 
> > ls -1 ~/mail/lists | grep @ |awk -F@ '{print "alias" " " $1 " " "<" $1 "@" 
> > $2 ">"}' > ~/.mutt/lists
> > ls -1 ~/mail/lists | awk '{print "mailboxes +lists/" $1}' >> ~/.mutt/lists
> > ls -1 ~/mail/lists | awk '{print "subscribe " $1}' >> ~/.mutt/lists
> > 
> subscribe `cd ~/mail/lists; ls`
> mailboxes `for file in $(ls ~/mail/lists); do echo -n "+lists/$file "; done`
> 
> .. some trial & error in the shell before I got it to work.

Subscribe doesn't work for me. It needs same format as mailboxes. Try:

subscribe `for file in $(ls ~/mail/lists); do echo -n "$file "; done`
 
> I think it's the better solution because it directly adds the contents
> of my .mutt/lists directory to the list of subscribed mailing lists and
> to the menu.
> > 
> > > 
> > > And in my binds file:
> > > 
> > > macro   generic \ca     "!~/scripts/listalias\n:source ~/.mutt/lists\n"
> > > 
> > > Now the mailboxes commands are sourced from my lists file too. So all I 
> > > do is
> > > keep .procmailrc updated with new list rules and hit ^a in mutt to auto 
> > > update
> > > the aliases and mailboxes.
> 
> Not sure doing it on the fly is the right approach any more, though.
> Maybe this should be done by invoking a script from the .muttrc to
> re-create the alias file prior to sourcing it. 
> 
> Also keep in mind that mailboxes "come and go" .. ie. if you delete all
> the messages in a given mailing list.. the corresponding mailbox
> vanishes.. and will be recreated (in my setyp) when new messages for
> this list are downloaded. The way I currently do it there's an outside
> chance something will be out of sync once in a while. My way to address
> this is that I do not delete the original message from the list
> "Welcome to the ... mailing list.. etc.".. 

set save_empty will keep empty mailbixes, although I tend to keep the original
welcome message for future reference.

> So, if you really want something a little more robust you would probably
> need to keep track of what lists you are subscribed to outside of mutt,
> adding an entry when you subscribe to a mailing list and deleting it
> when you unsubscribe.. And use this "list of subscribed lists" to
> generate the targets of your .muttrc commands (subscribe/mailboxes) as
> well as your alias file. 

If you make a mailinglists file then something like:

subscribe `for entry in $(cat ~/.mutt/mailinglists); do echo -n "$entry "; done`
mailboxes `for entry in $(cat ~/.mutt/mailinglists); do echo -n "+lists/$entry 
"; done`

will work, although I haven't managed to get this to work for aliases:

alias `for entry in $(cat ~/.mutt/mailinglists); do echo $entry | awk -F@ 
'{print $1 " <"$1"@"$2">"}'; done`

This refuses to work. Any ideas?

> Unfortunately I've only been using mutt for a few weeks and I don't
> know enough about its capabilities to decide how best to go about
> setting up such a - hopefully - more robust system.
> 
> Thanks,
> 
> cga

-- 
You couldn't even prove the White House staff sane beyond a reasonable
doubt.
                -- Ed Meese, on the Hinckley verdict