Subject: [sup-talk] Dynamic list of maildir folders as sources

From: [email-masked] (Amit Kucheria)
Date: Thu, 3 Sep 2009 17:26:40 +0300

Hi,

I've been watching sup for a while and finally decided to take the plunge
today.  Apologies for the long-winded explanation before the real question,
but I guess if something in my workflow could be optimised, someone might be
able to point it out here.

I'll be running sup on a bunch of maildir folders downloaded via offlineimap.

All my mail comes as IMAP from 3 gmail accounts. When I subscribe to a new
mailing list, I simply create a new filter in gmail to add a new tag to email
from that list and skip the inbox. This shows up as a new maildir folder on my
local machine.

Mutt finds this new folder using the following folder-hook hack I have in my
.muttrc:

folder-hook +foo.* mailboxes `find ~/Mail/foo -type d
-name cur -type d -printf '%h\n' | sort | tr '\012' ' '`

, where foo is one of my mailboxes. So I have ~/Mail/bar and ~/Mail/foobar for
my other accounts. Each of these have several maildir folder in them.

I've run sup-config and it seems to expect that I list every maildir folder
I've got. Is there a way to generate this dynamically?

Regards,
Amit
p.s. sup-sync has been at it on my lkml folder with ~40K mail messages for
30mins now.
-- 
------------------------------------------------------------
Amit Kucheria
------------------------------------------------------------

---

From: [email-masked] (William Morgan)
Date: Thu, 03 Sep 2009 08:37:50 -0700

Reformatted excerpts from Amit Kucheria's message of 2009-09-03:
> I've been watching sup for a while and finally decided to take the
> plunge today.

Welcome!

> I've run sup-config and it seems to expect that I list every maildir
> folder I've got. Is there a way to generate this dynamically?

If you can generate the list (e.g. with the find command you cited), you
can add maildir sources with sup-add directly, instead of having to go
through sup-config.

If you want to automatically detect and add new folders, we could d
something similar in the startup hook. Something like (completely
untested):

  dirs = `find ~/Mail/whatever...`
  dirs.each do |d|
    uri = "maildir:#{d}"
    log "trying #{uri}..."
    unless SourceManager.source_for uri
      source = Maildir.new uri
      SourceManager.add_source source
      log "Added #{uri}"
    end
  end

> p.s. sup-sync has been at it on my lkml folder with ~40K mail messages
> for 30mins now.

Yep, indexing stuff is slow. FWIW, you only have to do it once, and
there are new index backends that are significantly faster. (But still
far from instantaneous.)
-- 
William <wmorgan-sup at masanjin.net>