Better Gmail handling by not using Notmuch tags

Michal Nazarewicz mina86 at mina86.com
Fri Sep 14 10:57:12 PDT 2012


On Fri, Sep 14 2012, Mark Anderson wrote:
> You might want to take this chance to make your tag cloud coherent
> between Notmuch and what exists in the folders, which works out to
> something like this for every tag/folder pair in your gmail IMAP
> directory (assuming it's synced to a Maildir repository) and notmuch DB.
>
>   notmuch tag +TagX folder:FolderX and not tag:TagX 

I guess adding “and tag:new” won't hurt.

> When I see TagX in notmuch, and using FolderX as the proxy for Gmail
> tags, then I assume that the user added TagX in notmuch and I need to
> synchronize the change.  This one is a bit trickier.
>
>   notmuch search --output=files tag:TagX and not folder:FolderX 
>
> will give me the list of filenames, but I need to add them to a folder,
> so it's time for bash, or your favorite script language.  Spaces in
> filenames or tags are your bane here, then you'll want to do something
> fancier than just the $() interpolation.
>
> notmuch search --output=files tag:notmuch and not folder:notmuch |
> xargs perl -e'while (defined($_ = shift(@ARGV))) {my $file =
> filename($_); system("cp $_ $MAILDIR/notmuch/cur/$file");}'

(You've mised FolderX in the cp command).

What's wrong with

	notmuch search --output=files ... |
		xargs --no-run-if-empty \
		cp -t "$MAILDIR/notmuch/FolderX/cur/" --

expect that --no-run-if-empty is not POSIX and I'm not sure about -t.

I'm also wondering if it would make sense to link the files instead of
copying:

	notmuch search --output=files ... |
		xargs --no-run-if-empty \
		ln -t "$MAILDIR/notmuch/FolderX/cur/" --

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn at google.com>--------------ooO--(_)--Ooo--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120914/762b4692/attachment-0001.pgp>


More information about the notmuch mailing list