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 5307A4196F2 for ; Wed, 21 Apr 2010 23:38:59 -0700 (PDT) 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 Uwzf2fyqVF5I for ; Wed, 21 Apr 2010 23:38:57 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 5574D431FC1 for ; Wed, 21 Apr 2010 23:38:57 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 8518619F33B8; Thu, 22 Apr 2010 08:38:56 +0200 (CEST) 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 COHVWyzCROfp; Thu, 22 Apr 2010 08:38:55 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 4CFBB19F339B; Thu, 22 Apr 2010 08:38:55 +0200 (CEST) Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id 19C4115C062; Thu, 22 Apr 2010 08:38:54 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.71) (envelope-from ) id 1O4q3q-0001vm-Cz; Thu, 22 Apr 2010 08:38:54 +0200 From: Michal Sojka To: Carl Worth Subject: Re: [PATCH 1/2] Add 'cat' subcommand In-Reply-To: <871ve8wc30.fsf@yoom.home.cworth.org> References: <1271747793-17507-1-git-send-email-sojkam1@fel.cvut.cz> <87pr1u7fnu.fsf@ut.hh.sledj.net> <87fx2qmtok.fsf@SSpaeth.de> <4BCD7EA0.3080505@fel.cvut.cz> <871ve8wc30.fsf@yoom.home.cworth.org> Date: Thu, 22 Apr 2010 08:38:54 +0200 Message-ID: <871ve8ng8x.fsf@steelpick.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: notmuch@notmuchmail.org 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: Thu, 22 Apr 2010 06:39:00 -0000 On Thu, 22 Apr 2010, Carl Worth wrote: > On Tue, 20 Apr 2010 12:14:56 +0200, Michal Sojka wrote: > > On 20.4.2010 09:21, David Edmondson wrote: > > > I'm puzzled why you chose to pass a filename as the argument to 'cat' > > > rather than a message id (id:foo@bar.com)? > > > > The reason is that I want be able to distinguish between several > > messages with the same id. > > All other commands currently accept the generic search terms to specify > messages, (even a command like "notmuch reply" for which it would have > been natural to accept only a single message). > > So I'd prefer to have this command behave just like all others and use > the same naming. > > The question of how to unambiguously refer to a single file is > orthogonal, (and similarly applies to all commands, such as "notmuch > tag" etc.). I would recommend supporting a search syntax something like: > > filename:/complete/path/to/file > > for that use case. And this should work fine whether the filenames are > actual filenames or keys into some abstract file store of some sort. > > What do you think? It sounds reasonable. I looked at the code to see how this could be implemented and I have a few questions: If a filename:dir/file term is present in the query, it will be necessary to first query the database for directory:dir to find the and then put in the query file-direntry::file. This conversion is already implemented in _notmuch_database_filename_to_direntry(). Right? _notmuch_database_filename_to_direntry() requires writable database as it creates the directory document if it doesn't exist. This is probably not what we want for filename: queries - if the user types the filename incorrectly, the nonexisting directory document could be added to the database. So I think that _notmuch_database_find_directory_id() should be modified to not modify the database. The directory documents should be created somewhere else in notmuch new path. Do you agree? -Michal