[PATCH v2 1/2] cli: introduce the concept of user defined hooks

2011-12-04 Thread Jani Nikula
Add mechanism for running user defined hooks. Hooks are executables or symlinks to executables stored under the new notmuch hooks directory, /.notmuch/hooks. No hooks are introduced here, but adding support for a hook is now a simple matter of calling the new notmuch_run_hook() function at an appr

[PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Jani Nikula
Run notmuch new pre and post hooks, named "pre-new" and "post-new", if present in the notmuch hooks directory. The hooks will be run before and after incorporating new messages to the database. Typical use cases for pre-new and post-new hooks are fetching or delivering new mail to the maildir, and

[DRAFT PATCH] emacs: support limiting the number of results shown in search results

2011-12-04 Thread Aneesh Kumar K.V
On Thu, 17 Nov 2011 22:07:38 +0200, Jani Nikula wrote: > Add support for limiting the maximum number of results initially displayed > in search results. When enabled, the search results will contain push > buttons to double the number of results displayed or to show unlimited > results. > > The a

[PATCH v2 1/2] cli: introduce the concept of user defined hooks

2011-12-04 Thread Jani Nikula
On Sat, 3 Dec 2011 22:42:10 -0500, Austin Clements wrote: > I like it. See below for some nits. Thanks for the review! > Quoth Jani Nikula on Dec 04 at 1:16 am: > > Add mechanism for running user defined hooks. Hooks are executables or > > symlinks to executables stored under the new notmuch h

No subject

2011-12-04 Thread David Bremner
I decided to start a new thread since the other one id:"1322808114-11854-1-git-send-email-david at tethera.net" was getting pretty long, and there was no actual relevant discussion there. I think these patches are getting close to ready. One thing to discuss is the inclusion of single element op

[PATCH 2/4] notmuch-dump: convert to notmuch-opts argument handling.

2011-12-04 Thread David Bremner
From: David Bremner The output file is handled via positional arguments. There are currently no "normal" options. --- notmuch-dump.c | 32 1 files changed, 20 insertions(+), 12 deletions(-) diff --git a/notmuch-dump.c b/notmuch-dump.c index a490917..6fbdc81 10

[PATCH 4/4] notmuch-search: convert to notmuch-opts argument parsing.

2011-12-04 Thread David Bremner
From: David Bremner The switch on format_sel is slightly clunky, but it doesn't seem worth special casing argument processing for function pointers, when I think the function pointer approach will be modified/abandoned. --- notmuch-search.c | 110

[PATCH 1/4] notmuch-opts.[ch]: new argument parsing framework for notmuch.

2011-12-04 Thread David Bremner
From: David Bremner As we noticed when Jani kindly converted things to getopt_long, much of the work in argument parsing in notmuch is due to the the key-value style arguments like --format=(raw|json|text). In this version I implement Austin Clements' suggestion of basing the main API on taking

[PATCH 3/4] notmuch-restore: convert to notmuch-opts argument handling.

2011-12-04 Thread David Bremner
From: David Bremner The new argument handling is a bit more concise, and bit more flexible. It allows the input file name to go before the --accumulate option. --- notmuch-restore.c | 38 -- 1 files changed, 16 insertions(+), 22 deletions(-) diff --git a/n

[PATCH] test: add test-binaries target

2011-12-04 Thread David Bremner
From: David Bremner The goal here is to have a simple way of making sure all of the binaries needed to run tests are available. --- test/Makefile.local |5 - test/README |3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Makefile.local b/test/Makefile

[PATCH v2 1/2] cli: introduce the concept of user defined hooks

2011-12-04 Thread Austin Clements
Quoth Jani Nikula on Dec 04 at 2:35 pm: > > > +int > > > +notmuch_run_hook (const char *db_path, const char *hook) > > > +{ > > > +char *hook_path; > > > +int status = 0; > > > > You use status as both a notmuch_status_t and for generic C library > > results. This seems a little weird.

[PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Tom Prince
On Sun, 4 Dec 2011 01:16:49 +0200, Jani Nikula wrote: > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if > present in the notmuch hooks directory. The hooks will be run before and > after incorporating new messages to the database. > > Typical use cases for pre-new and post

notmuch seg. fault on _thread_add_message

2011-12-04 Thread Kazuo Teramoto
Hi! Following an alot bug report [1] I created a small python script that causes a segmentation fault in notmuch: #!/usr/bin/env python2 import notmuch db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE) q_new = notm

notmuch seg. fault on _thread_add_message

2011-12-04 Thread David Bremner
On Sun, 4 Dec 2011 15:35:39 -0200, Kazuo Teramoto wrote: > Hi! > > Following an alot bug report [1] I created a small python script that > causes a segmentation fault in notmuch: > > #!/usr/bin/env python2 > import notmuch >

notmuch seg. fault on _thread_add_message

2011-12-04 Thread Austin Clements
Quoth David Bremner on Dec 04 at 2:14 pm: > On Sun, 4 Dec 2011 15:35:39 -0200, Kazuo Teramoto > wrote: > > Hi! > > > > Following an alot bug report [1] I created a small python script that > > causes a segmentation fault in notmuch: > > ==

[PATCH 2/4] Introduce a generic tree-like abstraction for MIME traversal.

2011-12-04 Thread Austin Clements
Thanks for the review. A new version is on its way... Quoth Jani Nikula on Nov 29 at 9:11 pm: > > +mctx->stream = g_mime_stream_file_new (mctx->file); > > AFAICT the GMimeStreamFile object owns the FILE * pointer now, and > closes it later. Calling fclose() on it in _mime_node_context_free(

[PATCH v2 0/4] First step of 'show' rewrite

2011-12-04 Thread Austin Clements
This version addresses the comments in Jani's review (id:8739d6u4ju.fsf at nikula.org).

[PATCH 1/4] show: Pass notmuch_message_t instead of path to show_message_body.

2011-12-04 Thread Austin Clements
In addition to simplifying the code, we'll need the notmuch_message_t* in show_message_body shortly. --- notmuch-client.h |2 +- notmuch-reply.c |3 +-- notmuch-show.c |3 +-- show-message.c |3 ++- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/notmuch-client.

[PATCH 3/4] Utility function to seek in MIME trees in depth-first order.

2011-12-04 Thread Austin Clements
This function matches how we number parts for the --part argument to show. It will allow us to jump directly to the desired part, rather than traversing the entire tree and carefully tracking whether or not we're "in the zone". --- mime-node.c | 25 + notmuch-client

[PATCH 2/4] Introduce a generic tree-like abstraction for MIME traversal.

2011-12-04 Thread Austin Clements
This wraps all of the complex MIME part handling in a single, simple function that gets part N from *any* MIME object, so traversing a MIME part tree becomes a two-line for loop. Furthermore, the MIME node structure provides easy access to envelopes for message parts as well as cryptographic infor

[PATCH 4/4] show: Rewrite show_message_body to use the MIME tree interface.

2011-12-04 Thread Austin Clements
This removes all of the MIME traversal logic from show_message_body and leaves only its interaction with the format callbacks. Besides isolating concerns, since traversal happens behind a trivial interface, there is now much less code duplication in show_message_part. Also, this uses mime_node_se

[PATCH] lib: call g_type_init from notmuch_database_open

2011-12-04 Thread David Bremner
From: David Bremner We want to make sure g_type_init is called before any GObject functionality is used. --- This seems to fix the segfault for me. Any other comments/experiences? lib/database.cc |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/database.cc b/lib/d

[PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Jani Nikula
On Sat, 3 Dec 2011 23:00:47 -0500, Austin Clements wrote: > Quoth Jani Nikula on Dec 04 at 1:16 am: > > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if > > present in the notmuch hooks directory. The hooks will be run before and > > after incorporating new messages to the d

[PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Tom Prince
On Sun, 04 Dec 2011 21:36:21 +0200, Jani Nikula wrote: > > > +if (run_hooks && !ret && !interrupted) > > > + ret = notmuch_run_hook (db_path, "post-new"); > > > > Does it matter at this point if the hook fails? I'm not sure. > > I wasn't sure either, but I ended up thinking that the hooks b

[PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Jani Nikula
On Sun, 04 Dec 2011 11:46:38 -0500, Tom Prince wrote: > On Sun, 4 Dec 2011 01:16:49 +0200, Jani Nikula wrote: > > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if > > present in the notmuch hooks directory. The hooks will be run before and > > after incorporating new messa

[PATCH] test: add tests for python bindings

2011-12-04 Thread David Bremner
From: David Bremner We start modestly, with a (slightly modified) test case from Kazuo Teramoto. Originally it just made sure the bindings didn't crash; here we check that by comparing the output with that of notmuch search. --- test/notmuch-test |1 + test/python | 20 ++

Re: [PATCH v2 1/2] cli: introduce the concept of user defined hooks

2011-12-04 Thread Jani Nikula
On Sat, 3 Dec 2011 22:42:10 -0500, Austin Clements wrote: > I like it. See below for some nits. Thanks for the review! > Quoth Jani Nikula on Dec 04 at 1:16 am: > > Add mechanism for running user defined hooks. Hooks are executables or > > symlinks to executables stored under the new notmuch h

[no subject]

2011-12-04 Thread David Bremner
I decided to start a new thread since the other one id:"1322808114-11854-1-git-send-email-da...@tethera.net" was getting pretty long, and there was no actual relevant discussion there. I think these patches are getting close to ready. One thing to discuss is the inclusion of single element optio

[PATCH 2/4] notmuch-dump: convert to notmuch-opts argument handling.

2011-12-04 Thread David Bremner
From: David Bremner The output file is handled via positional arguments. There are currently no "normal" options. --- notmuch-dump.c | 32 1 files changed, 20 insertions(+), 12 deletions(-) diff --git a/notmuch-dump.c b/notmuch-dump.c index a490917..6fbdc81 10

[PATCH 4/4] notmuch-search: convert to notmuch-opts argument parsing.

2011-12-04 Thread David Bremner
From: David Bremner The switch on format_sel is slightly clunky, but it doesn't seem worth special casing argument processing for function pointers, when I think the function pointer approach will be modified/abandoned. --- notmuch-search.c | 110

[PATCH 1/4] notmuch-opts.[ch]: new argument parsing framework for notmuch.

2011-12-04 Thread David Bremner
From: David Bremner As we noticed when Jani kindly converted things to getopt_long, much of the work in argument parsing in notmuch is due to the the key-value style arguments like --format=(raw|json|text). In this version I implement Austin Clements' suggestion of basing the main API on taking

[PATCH 3/4] notmuch-restore: convert to notmuch-opts argument handling.

2011-12-04 Thread David Bremner
From: David Bremner The new argument handling is a bit more concise, and bit more flexible. It allows the input file name to go before the --accumulate option. --- notmuch-restore.c | 38 -- 1 files changed, 16 insertions(+), 22 deletions(-) diff --git a/n

[PATCH] test: add test-binaries target

2011-12-04 Thread David Bremner
From: David Bremner The goal here is to have a simple way of making sure all of the binaries needed to run tests are available. --- test/Makefile.local |5 - test/README |3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Makefile.local b/test/Makefile

Re: [PATCH v2 1/2] cli: introduce the concept of user defined hooks

2011-12-04 Thread Austin Clements
Quoth Jani Nikula on Dec 04 at 2:35 pm: > > > +int > > > +notmuch_run_hook (const char *db_path, const char *hook) > > > +{ > > > +char *hook_path; > > > +int status = 0; > > > > You use status as both a notmuch_status_t and for generic C library > > results. This seems a little weird.

Re: [PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Tom Prince
On Sun, 4 Dec 2011 01:16:49 +0200, Jani Nikula wrote: > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if > present in the notmuch hooks directory. The hooks will be run before and > after incorporating new messages to the database. > > Typical use cases for pre-new and post

notmuch seg. fault on _thread_add_message

2011-12-04 Thread Kazuo Teramoto
Hi! Following an alot bug report [1] I created a small python script that causes a segmentation fault in notmuch: #!/usr/bin/env python2 import notmuch db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE) q_new = notm

Re: notmuch seg. fault on _thread_add_message

2011-12-04 Thread David Bremner
On Sun, 4 Dec 2011 15:35:39 -0200, Kazuo Teramoto wrote: > Hi! > > Following an alot bug report [1] I created a small python script that > causes a segmentation fault in notmuch: > > #!/usr/bin/env python2 > import notmuch >

Re: notmuch seg. fault on _thread_add_message

2011-12-04 Thread Austin Clements
Quoth David Bremner on Dec 04 at 2:14 pm: > On Sun, 4 Dec 2011 15:35:39 -0200, Kazuo Teramoto wrote: > > Hi! > > > > Following an alot bug report [1] I created a small python script that > > causes a segmentation fault in notmuch: > > =

Re: [PATCH 2/4] Introduce a generic tree-like abstraction for MIME traversal.

2011-12-04 Thread Austin Clements
Thanks for the review. A new version is on its way... Quoth Jani Nikula on Nov 29 at 9:11 pm: > > +mctx->stream = g_mime_stream_file_new (mctx->file); > > AFAICT the GMimeStreamFile object owns the FILE * pointer now, and > closes it later. Calling fclose() on it in _mime_node_context_free(

[PATCH v2 0/4] First step of 'show' rewrite

2011-12-04 Thread Austin Clements
This version addresses the comments in Jani's review (id:8739d6u4ju@nikula.org). ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch

[PATCH 1/4] show: Pass notmuch_message_t instead of path to show_message_body.

2011-12-04 Thread Austin Clements
In addition to simplifying the code, we'll need the notmuch_message_t* in show_message_body shortly. --- notmuch-client.h |2 +- notmuch-reply.c |3 +-- notmuch-show.c |3 +-- show-message.c |3 ++- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/notmuch-client.

[PATCH 3/4] Utility function to seek in MIME trees in depth-first order.

2011-12-04 Thread Austin Clements
This function matches how we number parts for the --part argument to show. It will allow us to jump directly to the desired part, rather than traversing the entire tree and carefully tracking whether or not we're "in the zone". --- mime-node.c | 25 + notmuch-client

[PATCH 2/4] Introduce a generic tree-like abstraction for MIME traversal.

2011-12-04 Thread Austin Clements
This wraps all of the complex MIME part handling in a single, simple function that gets part N from *any* MIME object, so traversing a MIME part tree becomes a two-line for loop. Furthermore, the MIME node structure provides easy access to envelopes for message parts as well as cryptographic infor

[PATCH 4/4] show: Rewrite show_message_body to use the MIME tree interface.

2011-12-04 Thread Austin Clements
This removes all of the MIME traversal logic from show_message_body and leaves only its interaction with the format callbacks. Besides isolating concerns, since traversal happens behind a trivial interface, there is now much less code duplication in show_message_part. Also, this uses mime_node_se

[PATCH] lib: call g_type_init from notmuch_database_open

2011-12-04 Thread David Bremner
From: David Bremner We want to make sure g_type_init is called before any GObject functionality is used. --- This seems to fix the segfault for me. Any other comments/experiences? lib/database.cc |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/database.cc b/lib/d

Re: [PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Jani Nikula
On Sat, 3 Dec 2011 23:00:47 -0500, Austin Clements wrote: > Quoth Jani Nikula on Dec 04 at 1:16 am: > > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if > > present in the notmuch hooks directory. The hooks will be run before and > > after incorporating new messages to the d

Re: [PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Tom Prince
On Sun, 04 Dec 2011 21:36:21 +0200, Jani Nikula wrote: > > > +if (run_hooks && !ret && !interrupted) > > > + ret = notmuch_run_hook (db_path, "post-new"); > > > > Does it matter at this point if the hook fails? I'm not sure. > > I wasn't sure either, but I ended up thinking that the hooks b

Re: [PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

2011-12-04 Thread Jani Nikula
On Sun, 04 Dec 2011 11:46:38 -0500, Tom Prince wrote: > On Sun, 4 Dec 2011 01:16:49 +0200, Jani Nikula wrote: > > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if > > present in the notmuch hooks directory. The hooks will be run before and > > after incorporating new messag

[PATCH] test: add tests for python bindings

2011-12-04 Thread David Bremner
From: David Bremner We start modestly, with a (slightly modified) test case from Kazuo Teramoto. Originally it just made sure the bindings didn't crash; here we check that by comparing the output with that of notmuch search. --- test/notmuch-test |1 + test/python | 20 ++