Hi folks, This ended up being a longer email than I wanted, so to summarize, my main question is: is it possible to have lei write labels created with `lei-tag` back to the source Maildir which was indexed with `lei-index`? Additional details below:
I'm a Git developer, and I am subscribed to [email protected]. I sync that mail from my corp Gmail account to a local Maildir with mbsync. I would like that single Maildir to be the canonical source of mail, which I generally read with Mutt. Within that Maildir, I would like to be able to quickly find emails about unit tests. I can find these on lore.kernel.org with a query like: "dfn:t/unit-tests OR s:unit OR ((nq:bug OR nq:regression) AND nq:unit)" Ideally, I'd like some sort of automated lei setup to tag messages matching the above query, and then I can use Mutt's built-in filtering to show me only those threads. Since I want the mbsync-ed Maildir to be the canonical source of mail, it sounds like `lei-index` is what I want. I ran `lei index ~/.mail/gmail/git-external` and it seems to be OK. Next I want to see if I can search those indexed mails, so I run `lei q dfn:t/unit-tests OR s:unit OR \(\(nq:bug OR nq:regression\) AND nq:unit\)` and I get some JSON containing email metadata matching the query. So far, so good. Now I want to label those matching messages. After a bit of experimentation, I come up with the following combination of lei-q and lei-tag: ``` lei q -f mboxrd dfn:t/unit-tests OR s:unit OR \(\(nq:bug OR nq:regression\) AND nq:unit\) \ | lei tag -F mboxrd - +L:git-unit-tests ``` To make sure the label was applied, I run `lei q L:git-unit-tests` and I get back the same set of emails I expect. Great. However, now I'm stuck trying to get that label metadata back into my Maildir. I've tried both `lei refresh-mail-sync` and `lei export-kw` with various combinations of options, but nothing is updating the Maildir. I thought that at least one of these commands would update the matching emails with an "X-Label: git-unit-tests" header, although now I can't find any reference to X-Label in the lei docs, so I probably confused myself somehow about that. I *can* get lei-q to write these matching emails to a separate Maildir using `lei q -o /tmp/git-unit-tests dfn:t/unit-tests ...`, but this workflow is more annoying than I'd hoped for, as metadata is not automatically synced between the various Maildirs, and it's a bit slower in Mutt to switch Maildirs than to filter the currently open one. So to repeat my original question, is there any way to get lei to somehow update the source Maildir to reflect the labels on these tagged messages? Thanks in advance for any advice, Josh
