On 2010-09-21, Rob Browning wrote: > Conceptually what I'd like for it to do, is reference count -- only mark > the message deleted if every occurrence (across all maildirs) is marked > trashed (T). Right, but that is trickier than might appear at first sight. I parse those file names which notmuch is giving me (by default for mails from the last 30 days, as reparsing ALL your mails every time would be horribly expensive and often unneeded). notmuch is only able to give me one file name (+path) per mail id, so that is what I examine. If that is the one copy that has the mail dir flag "expired/trashed", I tag the message as "deleted". There is little else that notmuchsync can do here. I ask for new messages and their file path and if they are expired mark it as such. I have no way of finding out if there are other mails with the same mail id from notmuch (unless I am very much mistaken). Doing reference counting would require me/notmuchsync to parse ALL your mails by itself and finding out the often horribly mail id from the mail headers myself... something that notmuchsync does not want to get into. See the problem? I could do reference counting if notmuch were able to tell me how many file names/paths are associated with a mail id. > Though even there I can imagine corner cases: imagine that notmuch > doesn't initially see all your maildirs -- perhaps because you're using > a folder filter in offlineimap, and so there are untrashed copies in the > maildirs it hasn't seen yet. Right that would be a problem. But I cannot do reference counting unless notmuch can give me the number of copies it knows about for a given mail id (and internally it does know all associated file paths, so it would be a simple API extension a la, "get_all_message_file_paths" or similar, or a get_number_of_mail_files(mailid) to start with. > > And what should --revsync do when it finds a mail file that is marked > > as expired. What should notmuch do BTW if there are 2 copies and 1 is expired and 1 not? Mark as "deleted" or not? > Looks like you got cut off there. Right, it was 5pm and I left the computer :). I had intented to rant about the deficiencies of the notmuch 1 document per mail id approach here, but I don't see a better approach. All that would be useful from the notmuch side is to get all associated filenames with a mail id. sebastian