unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Better Gmail handling by not using Notmuch tags
@ 2012-09-13 14:35 Damien Cassou
  2012-09-13 15:13 ` Jeremy Nickurak
  0 siblings, 1 reply; 16+ messages in thread
From: Damien Cassou @ 2012-09-13 14:35 UTC (permalink / raw)
  To: notmuch

Hi,

I'm a Gmail user and would like to keep using Gmail web interface in
parallel to Notmuch. Basically, I would like Notmuch to mimic Gmail's
behavior. In the notmuch mailing list, users proposed to convert Gmail
folders to Notmuch tags and back (e.g.,
http://notmuchmail.org/pipermail/notmuch/2012/009280.html). However, I
didn't see any out-of-the-box full implementation of this proposal.

Another solution would be to work directly with folders from Notmuch.
Adding a Notmuch tag would just copy the current mail file to a
different folder. Removing a tag would just remove the current mail
file from the folder. Would such a solution work? What would I loose?

Thank you

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-13 14:35 Better Gmail handling by not using Notmuch tags Damien Cassou
@ 2012-09-13 15:13 ` Jeremy Nickurak
  2012-09-13 15:15   ` Damien Cassou
  0 siblings, 1 reply; 16+ messages in thread
From: Jeremy Nickurak @ 2012-09-13 15:13 UTC (permalink / raw)
  To: Damien Cassou; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

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.

On Thu, Sep 13, 2012 at 8:35 AM, Damien Cassou <damien.cassou@gmail.com>wrote:

> Hi,
>
> I'm a Gmail user and would like to keep using Gmail web interface in
> parallel to Notmuch. Basically, I would like Notmuch to mimic Gmail's
> behavior. In the notmuch mailing list, users proposed to convert Gmail
> folders to Notmuch tags and back (e.g.,
> http://notmuchmail.org/pipermail/notmuch/2012/009280.html). However, I
> didn't see any out-of-the-box full implementation of this proposal.
>
> Another solution would be to work directly with folders from Notmuch.
> Adding a Notmuch tag would just copy the current mail file to a
> different folder. Removing a tag would just remove the current mail
> file from the folder. Would such a solution work? What would I loose?
>
> Thank you
>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> "Lambdas are relegated to relative obscurity until Java makes them
> popular by not having them." James Iry
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

[-- Attachment #2: Type: text/html, Size: 2023 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-13 15:13 ` Jeremy Nickurak
@ 2012-09-13 15:15   ` Damien Cassou
  2012-09-14  7:50     ` Rainer M Krug
  2012-09-14 12:05     ` Justus Winter
  0 siblings, 2 replies; 16+ messages in thread
From: Damien Cassou @ 2012-09-13 15:15 UTC (permalink / raw)
  To: Jeremy Nickurak; +Cc: notmuch

On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak
<not-much@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.

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-13 15:15   ` Damien Cassou
@ 2012-09-14  7:50     ` Rainer M Krug
  2012-09-14  8:32       ` Christophe-Marie Duquesne
  2012-09-14 16:27       ` Mark Anderson
  2012-09-14 12:05     ` Justus Winter
  1 sibling, 2 replies; 16+ messages in thread
From: Rainer M Krug @ 2012-09-14  7:50 UTC (permalink / raw)
  To: notmuch; +Cc: Jeremy Nickurak

-----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-much@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-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14  7:50     ` Rainer M Krug
@ 2012-09-14  8:32       ` Christophe-Marie Duquesne
  2012-09-14  8:37         ` Rainer M Krug
                           ` (2 more replies)
  2012-09-14 16:27       ` Mark Anderson
  1 sibling, 3 replies; 16+ messages in thread
From: Christophe-Marie Duquesne @ 2012-09-14  8:32 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Jeremy Nickurak, notmuch

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

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14  8:32       ` Christophe-Marie Duquesne
@ 2012-09-14  8:37         ` Rainer M Krug
  2012-09-14  8:52           ` Christophe-Marie Duquesne
  2012-09-14 13:07         ` Jeremy Nickurak
  2012-09-14 13:09         ` Jeremy Nickurak
  2 siblings, 1 reply; 16+ messages in thread
From: Rainer M Krug @ 2012-09-14  8:37 UTC (permalink / raw)
  To: notmuch; +Cc: Jeremy Nickurak

-----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-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14  8:37         ` Rainer M Krug
@ 2012-09-14  8:52           ` Christophe-Marie Duquesne
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe-Marie Duquesne @ 2012-09-14  8:52 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: notmuch, Jeremy Nickurak

On Fri, Sep 14, 2012 at 10:37 AM, Rainer M Krug <R.M.Krug@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".

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-13 15:15   ` Damien Cassou
  2012-09-14  7:50     ` Rainer M Krug
@ 2012-09-14 12:05     ` Justus Winter
  1 sibling, 0 replies; 16+ messages in thread
From: Justus Winter @ 2012-09-14 12:05 UTC (permalink / raw)
  To: Damien Cassou, Jeremy Nickurak; +Cc: notmuch

Quoting Damien Cassou (2012-09-13 17:15:30)
> On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak
> <not-much@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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14  8:32       ` Christophe-Marie Duquesne
  2012-09-14  8:37         ` Rainer M Krug
@ 2012-09-14 13:07         ` Jeremy Nickurak
  2012-09-14 13:09         ` Jeremy Nickurak
  2 siblings, 0 replies; 16+ messages in thread
From: Jeremy Nickurak @ 2012-09-14 13:07 UTC (permalink / raw)
  To: Christophe-Marie Duquesne; +Cc: Jeremy Nickurak, notmuch, Rainer M Krug

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

More relevant:
https://developers.google.com/google-apps/gmail/imap_extensions

On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne <chmd@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

[-- Attachment #2: Type: text/html, Size: 1036 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14  8:32       ` Christophe-Marie Duquesne
  2012-09-14  8:37         ` Rainer M Krug
  2012-09-14 13:07         ` Jeremy Nickurak
@ 2012-09-14 13:09         ` Jeremy Nickurak
  2012-09-14 14:40           ` Jeremy Nickurak
  2 siblings, 1 reply; 16+ messages in thread
From: Jeremy Nickurak @ 2012-09-14 13:09 UTC (permalink / raw)
  To: Christophe-Marie Duquesne; +Cc: Jeremy Nickurak, notmuch, Rainer M Krug

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

More relevant:
https://developers.google.com/google-apps/gmail/imap_extensions

On Fri, Sep 14, 2012 at 1:32 AM, Christophe-Marie Duquesne <chmd@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

[-- Attachment #2: Type: text/html, Size: 1416 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14 13:09         ` Jeremy Nickurak
@ 2012-09-14 14:40           ` Jeremy Nickurak
  0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Nickurak @ 2012-09-14 14:40 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 768 bytes --]

(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
<not-much@trk.nickurak.ca>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@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@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
>>
>
>

[-- Attachment #2: Type: text/html, Size: 1901 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14  7:50     ` Rainer M Krug
  2012-09-14  8:32       ` Christophe-Marie Duquesne
@ 2012-09-14 16:27       ` Mark Anderson
  2012-09-14 17:57         ` Michal Nazarewicz
  2012-09-17  7:55         ` Rainer M Krug
  1 sibling, 2 replies; 16+ messages in thread
From: Mark Anderson @ 2012-09-14 16:27 UTC (permalink / raw)
  To: Rainer M Krug, notmuch; +Cc: Jeremy Nickurak

On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug <R.M.Krug@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-much@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      FolderX    TagX      Action
=====      =======    ====      ======
post-sync  No         No        No Action

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

post-sync  Yes        No        Gmail TagX added, add Notmuch TagX

post-sync  Yes        Yes       No Action

pre-sync   No         No        No Action

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

pre-sync   Yes        No        Notmuch TagX removed, delete mail copy
                                in FolderX

pre-sync   Yes        Yes       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 down the list of changes and take the appropriate action.

You might have other actions, such as a true delete in Notmuch, which
should remove all copies of the email before doing a mail sync.

The benefit of using the mail sync is it uses a widely distributed mail
synchronization model, but it really tags expensive to synchronize.  It
gets better if you use the Gmail imap extensions that can list the tags
without your client requesting a copy of the entire email for each tag
the mail has.  However, Even when you have that, you don't have
bulletproof mail, because the actions need to be guaranteed to complete
before synchronization and after synchronization, and any user changes
need to be held off, as they _will_ be interpreted incorrectly if they
take place during the pre-sync, sync, post-sync window.

You can simplify this if you make guarantees in your usage model.  That
you will never do tagging operations during a pre-, sync, post- cycle,
or that you only do synchronization one way or the other, instead of
full bidirectional sync.

It's a difficult problem, I look forward to seeing other solutions
proposed.

Thanks,
-Mark Anderson

> 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
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14 16:27       ` Mark Anderson
@ 2012-09-14 17:57         ` Michal Nazarewicz
  2012-09-17  7:55         ` Rainer M Krug
  1 sibling, 0 replies; 16+ messages in thread
From: Michal Nazarewicz @ 2012-09-14 17:57 UTC (permalink / raw)
  To: Mark Anderson, Rainer M Krug, notmuch; +Cc: Jeremy Nickurak

[-- Attachment #1: Type: text/plain, Size: 1892 bytes --]

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@google.com>--------------ooO--(_)--Ooo--

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-14 16:27       ` Mark Anderson
  2012-09-14 17:57         ` Michal Nazarewicz
@ 2012-09-17  7:55         ` Rainer M Krug
  2012-09-17 14:23           ` Rainer M Krug
  1 sibling, 1 reply; 16+ messages in thread
From: Rainer M Krug @ 2012-09-17  7:55 UTC (permalink / raw)
  To: notmuch
  Cc: public-notmuch-gxuj+Tv9EO5zyzON3hdc1g, Rainer M Krug,
	Jeremy Nickurak

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14/09/12 18:27, Mark Anderson wrote:
> On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug
> <R.M.Krug@gmail.com> wrote: On 13/09/12 17:15, Damien Cassou
> wrote:
>>>> On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
>>>> <not-much@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.
> 

<<SNIP a lot>>

Wow - I learned a lot about notmuch and how things can be done - thanks for this explanation.

>> Of course this is terrible on performance, as you will have lots of

I guess this will be the problem: a typical gmail user, keeps the emails - one has 10GB as
storage, so why delete potentially important mails?

So I guess this would be a case for e.g. offlineimap.

>> 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.

<SNIP>>

>> The benefit of using the mail sync is it uses a widely distributed mail synchronization
>> model, but it really tags expensive to synchronize.  It gets better if you use the Gmail imap
>> extensions that can list the tags without your client requesting a copy of the entire email
>> for each tag the mail has.  However, Even when you have that, you don't have bulletproof
>> mail, because the actions need to be guaranteed to complete before synchronization and after
>> synchronization, and any user changes need to be held off, as they _will_ be interpreted
>> incorrectly if they take place during the pre-sync, sync, post-sync window.

It would then definitely be useful to include this in offlineimap - effectively have a "tagging"
sync model, where only the "All Mail" folder is synched, and for the tags, a database is kept,
which contains the tags for each message-id. This could then be used from notmuch (or other
clients) to set the tags of the email.

For the moment I guess I will stick with my only-"All Mails"-sync-and-ignore-tags approach.

Thanks,

Rainer


> 
>> You can simplify this if you make guarantees in your usage model.  That you will never do
>> tagging operations during a pre-, sync, post- cycle, or that you only do synchronization one
>> way or the other, instead of full bidirectional sync.
> 
>> It's a difficult problem, I look forward to seeing other solutions proposed.
> 
>> Thanks, -Mark Anderson
> 
> 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
>> 
>> _______________________________________________ notmuch mailing list 
>> notmuch@notmuchmail.org 
>> http://notmuchmail.org/mailman/listinfo/notmuch
>> 
> 

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

iEYEARECAAYFAlBW12EACgkQoYgNqgF2egqd6QCeLW0rFHJY0aeazTgbjo9aUphJ
HWAAnjIowdSbIM/UZ7zhCuVHPK4GL1hG
=lXST
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-17  7:55         ` Rainer M Krug
@ 2012-09-17 14:23           ` Rainer M Krug
  2012-10-03  8:10             ` Rainer M Krug
  0 siblings, 1 reply; 16+ messages in thread
From: Rainer M Krug @ 2012-09-17 14:23 UTC (permalink / raw)
  To: notmuch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 17/09/12 09:55, Rainer M Krug wrote:
> On 14/09/12 18:27, Mark Anderson wrote:
>> On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug 
>> <R.M.Krug@gmail.com> wrote: On 13/09/12 17:15, Damien Cassou 
>> wrote:
>>>>> On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
>>>>> <not-much@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.
> 
> 
> <<SNIP a lot>>
> 
> Wow - I learned a lot about notmuch and how things can be done - thanks for this explanation.

Thinking about it again - wouldn't it be possible, that notmuch automatically is doing the "folder
- --> tag" step (when a corresponding option is set), and automatically adds all the folders to the
message tags when the same message-id is encountered in different folders?

Rainer

> 
>>> Of course this is terrible on performance, as you will have lots of
> 
> I guess this will be the problem: a typical gmail user, keeps the emails - one has 10GB as 
> storage, so why delete potentially important mails?
> 
> So I guess this would be a case for e.g. offlineimap.
> 
>>> 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.
> 
> <SNIP>>
> 
>>> The benefit of using the mail sync is it uses a widely distributed mail synchronization 
>>> model, but it really tags expensive to synchronize.  It gets better if you use the Gmail
>>> imap extensions that can list the tags without your client requesting a copy of the entire
>>> email for each tag the mail has.  However, Even when you have that, you don't have
>>> bulletproof mail, because the actions need to be guaranteed to complete before
>>> synchronization and after synchronization, and any user changes need to be held off, as
>>> they _will_ be interpreted incorrectly if they take place during the pre-sync, sync,
>>> post-sync window.
> 
> It would then definitely be useful to include this in offlineimap - effectively have a
> "tagging" sync model, where only the "All Mail" folder is synched, and for the tags, a database
> is kept, which contains the tags for each message-id. This could then be used from notmuch (or
> other clients) to set the tags of the email.
> 
> For the moment I guess I will stick with my only-"All Mails"-sync-and-ignore-tags approach.
> 
> Thanks,
> 
> Rainer
> 
> 
> 
>>> You can simplify this if you make guarantees in your usage model.  That you will never do 
>>> tagging operations during a pre-, sync, post- cycle, or that you only do synchronization
>>> one way or the other, instead of full bidirectional sync.
> 
>>> It's a difficult problem, I look forward to seeing other solutions proposed.
> 
>>> Thanks, -Mark Anderson
> 
>> 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
>>> 
>>> _______________________________________________ notmuch mailing list 
>>> notmuch@notmuchmail.org 
>>> http://notmuchmail.org/mailman/listinfo/notmuch
>>> 
> 
> 
> 

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

iEYEARECAAYFAlBXMlQACgkQoYgNqgF2ego59QCgg7JO0GY6HtgMmQB1VfD9pFNW
2l8An1v/ba05y6bq7ovZP4S/KSDedVBh
=d8Ga
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Better Gmail handling by not using Notmuch tags
  2012-09-17 14:23           ` Rainer M Krug
@ 2012-10-03  8:10             ` Rainer M Krug
  0 siblings, 0 replies; 16+ messages in thread
From: Rainer M Krug @ 2012-10-03  8:10 UTC (permalink / raw)
  To: notmuch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just to let you know, on the offlineimap there is also a discussion going on about gmail labels /
folders / sync and it looks as if something is happening on that side:

http://article.gmane.org/gmane.mail.imap.offlineimap.general/5915

Would be nice, if this could work together nicely with notmuch.

Cheers,

Rainer



On 17/09/12 16:23, Rainer M Krug wrote:
> On 17/09/12 09:55, Rainer M Krug wrote:
>> On 14/09/12 18:27, Mark Anderson wrote:
>>> On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug 
>>> <R.M.Krug@gmail.com> wrote: On 13/09/12 17:15, Damien Cassou
>>>  wrote:
>>>>>> On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak 
>>>>>> <not-much@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.
> 
> 
>> <<SNIP a lot>>
> 
>> Wow - I learned a lot about notmuch and how things can be done - thanks for this
>> explanation.
> 
> Thinking about it again - wouldn't it be possible, that notmuch automatically is doing the
> "folder --> tag" step (when a corresponding option is set), and automatically adds all the
> folders to the message tags when the same message-id is encountered in different folders?
> 
> Rainer
> 
> 
>>>> Of course this is terrible on performance, as you will have lots of
> 
>> I guess this will be the problem: a typical gmail user, keeps the emails - one has 10GB as 
>> storage, so why delete potentially important mails?
> 
>> So I guess this would be a case for e.g. offlineimap.
> 
>>>> 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.
> 
>> <SNIP>>
> 
>>>> The benefit of using the mail sync is it uses a widely distributed mail synchronization 
>>>> model, but it really tags expensive to synchronize.  It gets better if you use the Gmail 
>>>> imap extensions that can list the tags without your client requesting a copy of the
>>>> entire email for each tag the mail has.  However, Even when you have that, you don't
>>>> have bulletproof mail, because the actions need to be guaranteed to complete before 
>>>> synchronization and after synchronization, and any user changes need to be held off, as 
>>>> they _will_ be interpreted incorrectly if they take place during the pre-sync, sync, 
>>>> post-sync window.
> 
>> It would then definitely be useful to include this in offlineimap - effectively have a 
>> "tagging" sync model, where only the "All Mail" folder is synched, and for the tags, a
>> database is kept, which contains the tags for each message-id. This could then be used from
>> notmuch (or other clients) to set the tags of the email.
> 
>> For the moment I guess I will stick with my only-"All Mails"-sync-and-ignore-tags approach.
> 
>> Thanks,
> 
>> Rainer
> 
> 
> 
>>>> You can simplify this if you make guarantees in your usage model.  That you will never do
>>>>  tagging operations during a pre-, sync, post- cycle, or that you only do
>>>> synchronization one way or the other, instead of full bidirectional sync.
> 
>>>> It's a difficult problem, I look forward to seeing other solutions proposed.
> 
>>>> Thanks, -Mark Anderson
> 
>>> 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
>>>> 
>>>> _______________________________________________ notmuch mailing list 
>>>> notmuch@notmuchmail.org 
>>>> http://notmuchmail.org/mailman/listinfo/notmuch
>>>> 
> 
> 
> 
> 
> 

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

iEYEARECAAYFAlBr8u8ACgkQoYgNqgF2ego61QCfdmtzB1qPuShRYxFpRoNLspzT
pfAAn05wVADqKB5qy031TK0+p32ICrBD
=54M8
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-10-03  8:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-13 14:35 Better Gmail handling by not using Notmuch tags Damien Cassou
2012-09-13 15:13 ` Jeremy Nickurak
2012-09-13 15:15   ` Damien Cassou
2012-09-14  7:50     ` Rainer M Krug
2012-09-14  8:32       ` Christophe-Marie Duquesne
2012-09-14  8:37         ` Rainer M Krug
2012-09-14  8:52           ` Christophe-Marie Duquesne
2012-09-14 13:07         ` Jeremy Nickurak
2012-09-14 13:09         ` Jeremy Nickurak
2012-09-14 14:40           ` Jeremy Nickurak
2012-09-14 16:27       ` Mark Anderson
2012-09-14 17:57         ` Michal Nazarewicz
2012-09-17  7:55         ` Rainer M Krug
2012-09-17 14:23           ` Rainer M Krug
2012-10-03  8:10             ` Rainer M Krug
2012-09-14 12:05     ` Justus Winter

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).