Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id A4BF340DBC6 for ; Wed, 10 Nov 2010 02:26:57 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=unavailable Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1NEzFkvExjSR for ; Wed, 10 Nov 2010 02:26:45 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 716A940DBE4 for ; Wed, 10 Nov 2010 02:26:45 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id DBD2519F331A; Wed, 10 Nov 2010 11:26:43 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id 31XZSaK0mOWq; Wed, 10 Nov 2010 11:26:41 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id A025F19F331D; Wed, 10 Nov 2010 11:26:41 +0100 (CET) Received: from steelpick.2x.cz (note-sojka.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id BBE6BFA004; Wed, 10 Nov 2010 11:26:40 +0100 (CET) Received: from wsh by steelpick.2x.cz with local (Exim 4.72) (envelope-from ) id 1PG7t2-0003vB-7K; Wed, 10 Nov 2010 11:26:40 +0100 From: Michal Sojka To: Carl Worth , notmuch@notmuchmail.org Subject: Re: [PATCH v4 0/4] Maildir synchronization In-Reply-To: <87lj52knbp.fsf@yoom.home.cworth.org> References: <87tyk3vpxd.fsf@wsheee.2x.cz> <1288560558-18915-1-git-send-email-sojkam1@fel.cvut.cz> <877hgsrjau.fsf@yoom.home.cworth.org> <87d3qhq527.fsf@resox.2x.cz> <874obrmww9.fsf@yoom.home.cworth.org> <87iq066cbd.fsf@steelpick.2x.cz> <87oc9ykzae.fsf@yoom.home.cworth.org> <877hgm2hjg.fsf@steelpick.2x.cz> <87lj52knbp.fsf@yoom.home.cworth.org> User-Agent: Notmuch/0.4-30-ga01dbf0 (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Wed, 10 Nov 2010 11:26:40 +0100 Message-ID: <874obp325b.fsf@steelpick.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2010 10:26:57 -0000 On Wed, 10 Nov 2010, Carl Worth wrote: > > This only fails if the message is in */new and there is no */cur. > > Right. I think that's a little too severe. > > > I do not know if MH format has something special or it is just plain > > files in plain directories. If the latter, the synchronzation should > > work unless one of the directories is named 'new'. > > The MH format is plain files in plain directories. > > But in this case, I would contend that we don't _want_ the > synchronization to work. The files shouldn't be getting renamed at all > unless we are dealing with maildir. Yes, I think this could be easily implemented. > Neither maildir nor mh give us anything extremely reliable that we can > use to unambiguously distinguish between them. But I think a heuristic > of: > > if "cur" and "new" sub-directories exist: > then this directory is maildir; > > And only when this heuristic passes should we be fiddling with filenames > in maildir-specified ways. Agreed. > Meanwhile, I ran into one problem with my proposal. We can't use > notmuch_message_sync_with_maildir_flags since notmuch_message_sync is an > internal interface. The corresponding public interface actually consists > of three or four different functions (notmuch_message_add_tag, > notmuch_message_remove_tag, and notmuch_message_freeze/thaw). I think it > would be quite crazy to add _with_maildir_flags variants of all of > those. > > So maybe we will need a new function for the purpose of synchronizing > the current tags of a message to a maildir filename. So that would be, > perhaps, notmuch_message_tags_to_maildir_flags or so? This sounds good and allows us to get rid of NOTMUCH_MESSAGE_FLAG_TAGS_INVALID. > Finally, I'm also a bit unsettled about the handling of the "S" > flag. For all the other flags it is easy to document that > notmuch_database_add_message_with_maildir_flags simply adds the > corresponding tag to the message. But we can't say that the presence of > the "S" tag prevents this function from adding the "unread" tag, since > this function never does add an "unread" tag. But can we say the the function _removes_ the unread tag if 'S' is present and adds it otherwise? > Instead, the setting of "unread" is taking place at a higher-level, > (inside "notmuch new"). So perhaps the right answer is for the library > function to add a "seen" tag, (making the handling of 'T' consistent > with all other tags and dropping the "inverse" field from the > table). Then, the "notmuch new" program can query the "seen" tag to > decide whether it should add its configured new_tags, ("inbox" and > "unread" by default). > > I do want something like that anyway, because I want to make it so that > someone that first starts with notmuch and a large collection of maildir > messages doesn't end up with every message tagged as "inbox" after their > first run of "notmuch new". I understand your point but this change would break how I use notmuch now. My new_tags contains only "new" tag and if this tag is not added during notmuch new the message would not be properly tagged by my initial tagging script. I want to avoid the situation that I accidentaly view a message in a web-mail client, which adds the 'S' flag and this will lead to exclusion of the message from initial tagging. If we leave the things the way they are now, it should be easy for the user to run notmuch tag -inbox not tag:unread We could also show this hint at the end of notmuch new when it is run for the first time and all messages are tagged by inbox. > > So anyway, I'm currently working on implementing what I described > above. And I may change my mind slightly as I work through things. > > I'll let you know, Great. I've finished the additional tests, which I send as a reply to this mail. Some test are marked as broken because I do not want to touch C sources while you are woking on them. -Michal