Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Michal Nazarewicz
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 +--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>


mm-image-fit-p: Invalid image specification

2012-09-14 Thread Michal Sojka
Hello,

in emacs, I have a problem displaying an email that contain the
following part (--format=json):

{
   "content-type" : "image/svg+xml",
   "filename" : "_logo.svg",
   "id" : 4
}

I see this message "mm-image-fit-p: Invalid image specification" and no
other emails after this one in the thread are shown. This happens in GNU
Emacs 24.2.1 (Debian). Emacs 23 works correctly.

Is this a known issue? If not I'll try to investigate this some time
later.

Regards,
-Michal


Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Justus Winter
Quoting Damien Cassou (2012-09-13 17:15:30)
> On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak
>  wrote:
> > Gmail doesn't have folders, of course, it has labels, which are
> > approximately equivalent to notmuch tags. The key difference being that a
> > message can only be in one folder, but it can have multiple tags/labels.
> 
> Gmail exports its labels as IMAP folders: an email with multiple
> labels will be duplicated in multiple folders (one per label). That's
> why I'm asking if it would be possible to manupale folders from
> Notmuch instead of tags.

Daniel Kreischer contributed a feature to afew called mailmover that
allows one to specify a mapping between IMAP folders and notmuch tags
and move mails accordingly.

Justus


Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Christophe-Marie Duquesne
On Fri, Sep 14, 2012 at 10:37 AM, Rainer M Krug  wrote:
> An API seems to be the way to go, but that one only concerns the settings, 
> not retrieving
> information about individual emails.

Oops. It seems that I misread that.

> But that is definetly a job for somebody else - I am just throwing ideas out.

It was a general "you".


Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 14/09/12 10:32, Christophe-Marie Duquesne wrote:
> You may want to have a look to the google mail API [1]
> 
> [1]: https://developers.google.com/google-apps/email-settings/

An API seems to be the way to go, but that one only concerns the settings, not 
retrieving
information about individual emails.

But that is definetly a job for somebody else - I am just throwing ideas out.

Rainer

> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBS7LwACgkQoYgNqgF2egrBKQCfeISDLr+Pimv5oNWqtnV1WVbB
218AnjCbXLVH2gAbKTfZYlQvaBotMR/j
=sEA+
-END PGP SIGNATURE-



Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Christophe-Marie Duquesne
You may want to have a look to the google mail API [1]

[1]: https://developers.google.com/google-apps/email-settings/


Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Mark Anderson
On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 13/09/12 17:15, Damien Cassou wrote:
> > On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
> >  wrote:
> >> Gmail doesn't have folders, of course, it has labels, which are
> >> approximately equivalent to notmuch tags. The key difference being
> >> that a message can only be in one folder, but it can have multiple
> >> tags/labels.
> > 
> > Gmail exports its labels as IMAP folders: an email with multiple
> > labels will be duplicated in multiple folders (one per
> > label). That's why I'm asking if it would be possible to manupale
> > folders from Notmuch instead of tags.
> > 
> 
> I don't think there is an easy solution. notmuch uses a maildir and
> tags. Gmail needs to be synced to this local maildir earlier, and this
> is where I think the problem comes in: I am not aware of any sync tool
> which maintains the gmail labels, as they are in in the imap context
> folders.
> 
> I think the only real solution woud be:
> 
> Download from gmail -> local:
> 1) download only the "All Mail" folder
> 2) implement a tagging tool which syncs the gmail labels to notmuch tags

Gmail's IMAP protocol does expose a folder hierarchy which you can use
to reverse engineer the tag cloud of each email.  

Using Offlineimap will happily sync a your Gmail such that each mail
will show up in every folder corresponding to the tags with which the
mail is tagged.  When notmuch scans the mail, it will collapse these
multiple mails into one mail message by message-id: and you just need a
script to translate folders into tags.  The incoherence between notmuch
tag and mail folders then communicates something different if you are
pre-sync or post-sync. I am calling the offlineimap call "sync", so once
we run it (the first time for sure) we are in 'post-sync'.


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 

Although strictly speaking it isn't actually necessary to put the 
"and not tag:TagX" term, as this term this is now implicitly added by
notmuch to improve performance and avoid touching database entries that
already have the tag, I include it to demonstrate the coherence between
TagX and FolderX.

Then you'll want to handle TagX being removed on the Gmail side too,
so you'll want to do something like this to remove the notmuch TagX.

  notmuch tag -TagX tag:TagX and not folder:FolderX

Then there's the reverse direction to consider.

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");}'

Then when I see a mail in FolderX without TagX, that indicates that I
have removed the tag from notmuch, so I will want to remove the copy of
the file from FolderX, and only FolderX.

This requires you to scan through the list of filenames associated with
the msg-id and delete the file in FolderX.

Of course this is terrible on performance, as you will have lots of
copies of mails when you have lots of tags on your mail, but here's a
summary of the actions you need to coordinate to keep them in sync.


Stage  FolderXTagX  Action
=  ===  ==
post-sync  No NoNo Action

post-sync  No Yes   Gmail TagX removed caused FolderX copy
to be removed, remove Notmuch TagX

post-sync  YesNoGmail TagX added, add Notmuch TagX

post-sync  YesYes   No Action

pre-sync   No NoNo Action

pre-sync   No Yes   Notmuch TagX added, copy mail to FolderX
to add Gmail TagX corresponding to
notmuch TagX 

pre-sync   YesNoNotmuch TagX removed, delete mail copy
in FolderX

pre-sync   YesYes   No Action

The worst part about this, is that any interrupted action must be
retried until successful, unless we have information about the relative
times of the actions.  If instead of trying to rationalize the two
"states" of my messages, I was trying to synchronize the changes, then I
just 

Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 13/09/12 17:15, Damien Cassou wrote:
> On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
>  wrote:
>> Gmail doesn't have folders, of course, it has labels, which are 
>> approximately equivalent to
>> notmuch tags. The key difference being that a message can only be in one 
>> folder, but it can
>> have multiple tags/labels.
> 
> Gmail exports its labels as IMAP folders: an email with multiple labels will 
> be duplicated in
> multiple folders (one per label). That's why I'm asking if it would be 
> possible to manupale
> folders from Notmuch instead of tags.
> 

I don't think there is an easy solution. notmuch uses a maildir and tags. Gmail 
needs to be synced
to this local maildir earlier, and this is where I think the problem comes in: 
I am not aware of
any sync tool which maintains the gmail labels, as they are in in the imap 
context folders.

I think the only real solution woud be:

Download from gmail -> local:
1) download only the "All Mail" folder
2) implement a tagging tool which syncs the gmail labels to notmuch tags

upload local -> gmail
1) upload "All Mail folder
2) assign on gmail the labels corresponding to the notmuch tags.

The step 1 could be done by any sync tool available for this (offlineimap, ...)

step 2 needs to be developed - no idea how, but it surely would be really 
usefull, because then
notmuch would even become a perfect tool for gmail backup as well.

Cheers,

Rainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBS4akACgkQoYgNqgF2egoGhwCaAgfXQUAK4RK1v22JOhgYXfR1
+C8AnRU892SrxK7IYN9xoxhM865Y+vTA
=ma75
-END PGP SIGNATURE-



Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Jeremy Nickurak
(Apologies for the double-post... got an email asking me to confirm my
address, which I thought meant I posted from the wrong address. Re-posted,
recieved another confirmation email. Confirmed one, and both got through.
Weird.)

On Fri, Sep 14, 2012 at 6:09 AM, Jeremy Nickurak
wrote:

> More relevant:
> https://developers.google.com/google-apps/gmail/imap_extensions
>
> On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne  chmd.fr>wrote:
>
>> You may want to have a look to the google mail API [1]
>>
>> [1]: https://developers.google.com/google-apps/email-settings/
>> ___
>> notmuch mailing list
>> notmuch at notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
>>
>
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120914/77d35b24/attachment.html>


Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Jeremy Nickurak
More relevant:
https://developers.google.com/google-apps/gmail/imap_extensions

On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne wrote:

> You may want to have a look to the google mail API [1]
>
> [1]: https://developers.google.com/google-apps/email-settings/
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120914/e1e57f12/attachment.html>


Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Jeremy Nickurak
More relevant:
https://developers.google.com/google-apps/gmail/imap_extensions

On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne wrote:

> You may want to have a look to the google mail API [1]
>
> [1]: https://developers.google.com/google-apps/email-settings/
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120914/760d9fc0/attachment-0001.html>


[alot] announcing v0.3.3

2012-09-14 Thread Sepp Tannhuber
Quoting Sepp Tannhuber (2012-09-12 16:17:45)
> my abook is working now. I don't know why it did not yesterday. Probably it 
> was
> not a bug but rather something stupid with my config.
Neither bug nor stupid config! It did not work because the completion is case
sensitive. Is it possible to change it?

Cheers
Joseph


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 13/09/12 17:15, Damien Cassou wrote:
 On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
 not-m...@trk.nickurak.ca wrote:
 Gmail doesn't have folders, of course, it has labels, which are 
 approximately equivalent to
 notmuch tags. The key difference being that a message can only be in one 
 folder, but it can
 have multiple tags/labels.
 
 Gmail exports its labels as IMAP folders: an email with multiple labels will 
 be duplicated in
 multiple folders (one per label). That's why I'm asking if it would be 
 possible to manupale
 folders from Notmuch instead of tags.
 

I don't think there is an easy solution. notmuch uses a maildir and tags. Gmail 
needs to be synced
to this local maildir earlier, and this is where I think the problem comes in: 
I am not aware of
any sync tool which maintains the gmail labels, as they are in in the imap 
context folders.

I think the only real solution woud be:

Download from gmail - local:
1) download only the All Mail folder
2) implement a tagging tool which syncs the gmail labels to notmuch tags

upload local - gmail
1) upload All Mail folder
2) assign on gmail the labels corresponding to the notmuch tags.

The step 1 could be done by any sync tool available for this (offlineimap, ...)

step 2 needs to be developed - no idea how, but it surely would be really 
usefull, because then
notmuch would even become a perfect tool for gmail backup as well.

Cheers,

Rainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBS4akACgkQoYgNqgF2egoGhwCaAgfXQUAK4RK1v22JOhgYXfR1
+C8AnRU892SrxK7IYN9xoxhM865Y+vTA
=ma75
-END PGP SIGNATURE-

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Christophe-Marie Duquesne
You may want to have a look to the google mail API [1]

[1]: https://developers.google.com/google-apps/email-settings/
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 14/09/12 10:32, Christophe-Marie Duquesne wrote:
 You may want to have a look to the google mail API [1]
 
 [1]: https://developers.google.com/google-apps/email-settings/

An API seems to be the way to go, but that one only concerns the settings, not 
retrieving
information about individual emails.

But that is definetly a job for somebody else - I am just throwing ideas out.

Rainer

 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBS7LwACgkQoYgNqgF2egrBKQCfeISDLr+Pimv5oNWqtnV1WVbB
218AnjCbXLVH2gAbKTfZYlQvaBotMR/j
=sEA+
-END PGP SIGNATURE-

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Christophe-Marie Duquesne
On Fri, Sep 14, 2012 at 10:37 AM, Rainer M Krug r.m.k...@gmail.com wrote:
 An API seems to be the way to go, but that one only concerns the settings, 
 not retrieving
 information about individual emails.

Oops. It seems that I misread that.

 But that is definetly a job for somebody else - I am just throwing ideas out.

It was a general you.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Justus Winter
Quoting Damien Cassou (2012-09-13 17:15:30)
 On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak
 not-m...@trk.nickurak.ca wrote:
  Gmail doesn't have folders, of course, it has labels, which are
  approximately equivalent to notmuch tags. The key difference being that a
  message can only be in one folder, but it can have multiple tags/labels.
 
 Gmail exports its labels as IMAP folders: an email with multiple
 labels will be duplicated in multiple folders (one per label). That's
 why I'm asking if it would be possible to manupale folders from
 Notmuch instead of tags.

Daniel Kreischer contributed a feature to afew called mailmover that
allows one to specify a mapping between IMAP folders and notmuch tags
and move mails accordingly.

Justus
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Jeremy Nickurak
More relevant:
https://developers.google.com/google-apps/gmail/imap_extensions

On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne c...@chmd.frwrote:

 You may want to have a look to the google mail API [1]

 [1]: https://developers.google.com/google-apps/email-settings/
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Jeremy Nickurak
More relevant:
https://developers.google.com/google-apps/gmail/imap_extensions

On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne c...@chmd.frwrote:

 You may want to have a look to the google mail API [1]

 [1]: https://developers.google.com/google-apps/email-settings/
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


mm-image-fit-p: Invalid image specification

2012-09-14 Thread Michal Sojka
Hello,

in emacs, I have a problem displaying an email that contain the
following part (--format=json):

{
   content-type : image/svg+xml,
   filename : _logo.svg,
   id : 4
}

I see this message mm-image-fit-p: Invalid image specification and no
other emails after this one in the thread are shown. This happens in GNU
Emacs 24.2.1 (Debian). Emacs 23 works correctly.

Is this a known issue? If not I'll try to investigate this some time
later.

Regards,
-Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Mark Anderson
On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug r.m.k...@gmail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 13/09/12 17:15, Damien Cassou wrote:
  On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
  not-m...@trk.nickurak.ca wrote:
  Gmail doesn't have folders, of course, it has labels, which are
  approximately equivalent to notmuch tags. The key difference being
  that a message can only be in one folder, but it can have multiple
  tags/labels.
  
  Gmail exports its labels as IMAP folders: an email with multiple
  labels will be duplicated in multiple folders (one per
  label). That's why I'm asking if it would be possible to manupale
  folders from Notmuch instead of tags.
  
 
 I don't think there is an easy solution. notmuch uses a maildir and
 tags. Gmail needs to be synced to this local maildir earlier, and this
 is where I think the problem comes in: I am not aware of any sync tool
 which maintains the gmail labels, as they are in in the imap context
 folders.
 
 I think the only real solution woud be:
 
 Download from gmail - local:
 1) download only the All Mail folder
 2) implement a tagging tool which syncs the gmail labels to notmuch tags

Gmail's IMAP protocol does expose a folder hierarchy which you can use
to reverse engineer the tag cloud of each email.  

Using Offlineimap will happily sync a your Gmail such that each mail
will show up in every folder corresponding to the tags with which the
mail is tagged.  When notmuch scans the mail, it will collapse these
multiple mails into one mail message by message-id: and you just need a
script to translate folders into tags.  The incoherence between notmuch
tag and mail folders then communicates something different if you are
pre-sync or post-sync. I am calling the offlineimap call sync, so once
we run it (the first time for sure) we are in 'post-sync'.


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 

Although strictly speaking it isn't actually necessary to put the 
and not tag:TagX term, as this term this is now implicitly added by
notmuch to improve performance and avoid touching database entries that
already have the tag, I include it to demonstrate the coherence between
TagX and FolderX.

Then you'll want to handle TagX being removed on the Gmail side too,
so you'll want to do something like this to remove the notmuch TagX.
 
  notmuch tag -TagX tag:TagX and not folder:FolderX

Then there's the reverse direction to consider.

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);}'

Then when I see a mail in FolderX without TagX, that indicates that I
have removed the tag from notmuch, so I will want to remove the copy of
the file from FolderX, and only FolderX.

This requires you to scan through the list of filenames associated with
the msg-id and delete the file in FolderX.

Of course this is terrible on performance, as you will have lots of
copies of mails when you have lots of tags on your mail, but here's a
summary of the actions you need to coordinate to keep them in sync.


Stage  FolderXTagX  Action
=  ===  ==
post-sync  No NoNo Action

post-sync  No Yes   Gmail TagX removed caused FolderX copy
to be removed, remove Notmuch TagX

post-sync  YesNoGmail TagX added, add Notmuch TagX

post-sync  YesYes   No Action

pre-sync   No NoNo Action

pre-sync   No Yes   Notmuch TagX added, copy mail to FolderX
to add Gmail TagX corresponding to
notmuch TagX 

pre-sync   YesNoNotmuch TagX removed, delete mail copy
in FolderX

pre-sync   YesYes   No Action

The worst part about this, is that any interrupted action must be
retried until successful, unless we have information about the relative
times of the actions.  If instead of trying to rationalize the two
states of my messages, I was trying to synchronize the changes, then I
just need to go 

Re: Better Gmail handling by not using Notmuch tags

2012-09-14 Thread Michal Nazarewicz
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: m...@google.com--ooO--(_)--Ooo--

pgprq2ljWQNfB.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch