unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: Carl Worth <cworth@cworth.org>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 1/2] Add 'cat' subcommand
Date: Thu, 22 Apr 2010 08:38:54 +0200	[thread overview]
Message-ID: <871ve8ng8x.fsf@steelpick.2x.cz> (raw)
In-Reply-To: <871ve8wc30.fsf@yoom.home.cworth.org>

On Thu, 22 Apr 2010, Carl Worth wrote:
> On Tue, 20 Apr 2010 12:14:56 +0200, Michal Sojka <sojkam1@fel.cvut.cz> 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
<directory_ID> and then put in the query
file-direntry:<directory_ID>: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

  parent reply	other threads:[~2010-04-22  6:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20  7:16 [PATCH 1/2] Add 'cat' subcommand Michal Sojka
2010-04-20  7:16 ` [PATCH 2/2] emacs: Access raw messages through cat subcommand Michal Sojka
2010-04-20  7:21 ` [PATCH 1/2] Add 'cat' subcommand David Edmondson
2010-04-20  8:09   ` Sebastian Spaeth
2010-04-20 10:14     ` Michal Sojka
2010-04-20 10:53       ` David Edmondson
2010-04-20 11:13         ` Michal Sojka
2010-04-20 11:30           ` David Edmondson
2010-04-20 13:32       ` Jameson Rollins
2010-04-22  0:44       ` Carl Worth
2010-04-22  2:37         ` Dirk Hohndel
2010-04-22  3:13           ` Anthony Towns
2010-04-22  6:57             ` Michal Sojka
2010-04-22  6:38         ` Michal Sojka [this message]
2010-04-23 19:07           ` Carl Worth
  -- strict thread matches above, loose matches on Subject: below --
2010-10-22  9:28 [PATCH 0/2] Notmuch cat v2 Michal Sojka
2010-10-22  9:28 ` [PATCH 1/2] Add 'cat' subcommand Michal Sojka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ve8ng8x.fsf@steelpick.2x.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).