Re: [notmuch] [PATCH] Store the size of the file for each message

2009-12-19 Thread Marten Veldthuis
On Fri, 18 Dec 2009 21:24:10 -0800, Carl Worth cwo...@cworth.org wrote:
 Currently we're replicating all of our documentation both in the man
 page and in the output from notmuch help. It's annoying to have to
 add everything in two places, but I don't have a good idea for making
 that sharable yet.
 
 Anyone have a solution here?

Something like git help add just opens the manpage for git-add. Can't
we do the same here?

-- 
- Marten
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Store the size of the file for each message

2009-12-19 Thread Carl Worth
On Sat, 19 Dec 2009 09:02:11 +0100, Marten Veldthuis mar...@veldthuis.com 
wrote:
  Anyone have a solution here?
 
 Something like git help add just opens the manpage for git-add. Can't
 we do the same here?

The granularity is different, though. I like that notmuch help show
shows just the documentation for notmuch show. And I also like that
man notmuch shows all the documentation, (without having to have N
different man pages for each of the sub-commands).

Meanwhile, the git approach does mean that one doesn't get any builtin
help unless the external man-based stuff is working and installed. I'm
not sure that I want to depend on that.

-Carl


pgpoF4R79J6hi.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Store the size of the file for each message

2009-12-18 Thread Carl Worth
On Fri, 18 Dec 2009 21:21:03 +, James Westby jw+deb...@jameswestby.net 
wrote:
   Here's the first part, storing the filesize. I'm using
   add_value so that we can make it sortable, is that valid
   for retrieving it as well?

Yes, a value makes sense here and should make the value easy to
retrieve.

   The only thing I'm not sure about is if it works. Is there
   a way to inspect a document to see the values that are
   stored?

I usually use a little tool I wrote called xapian-dump. It currently
exists only in the git history of notmuch. Look at commit:

22691064666c03c5e76bc787395bfe586929f4cc

or so.

 Doing a search isn't working, so I imagine I made a mistake.

Let's see... (just reviewing here, not testing)..

 +struct FilesizeValueRangeProcessor : public Xapian::ValueRangeProcessor {
 +FilesizeValueRangeProcessor() {}
 +
 +Xapian::valueno operator()(std::string begin, std::string ) {
 +if (begin.substr(0, 9) != filesize:)
 +return Xapian::BAD_VALUENO;
 +begin.erase(0, 9);
 +return NOTMUCH_VALUE_FILESIZE;
 +}
 +};

If the file size is just an integer, then you shouldn't need a custom
ValueRangeProcessor. One of the existing processors in Xapian should
work fine.

Having not ever written a custom processor, I can't say whether the one
above is correct or not.

-Carl


pgp7QrUqZ9sn5.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Store the size of the file for each message

2009-12-18 Thread James Westby
On Fri, 18 Dec 2009 16:57:16 -0800, Carl Worth cwo...@cworth.org wrote:
 You can, actually. Just set the NOTMUCH_CONFIG environment variable to
 your alternate configuration file. (And yes, we're missing any mention
 of this in our documentation.)

Sweet. Where would be the best place to document it? Just in the
man page?

Thanks,

James
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch