The post-new hook might no longer be needed or run very often if notmuch insert is being used. Therefore a post-insert hook is needed (arguably pre-insert not so much, so don't add one). Also add the --no-hooks option to skip hooks. --- notmuch-insert.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/notmuch-insert.c b/notmuch-insert.c index f27b9cb..adadd12 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -444,6 +444,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) const char *folder = NULL; notmuch_bool_t create_folder = FALSE; notmuch_bool_t keep = FALSE; + notmuch_bool_t no_hooks = FALSE; notmuch_bool_t synchronize_flags; const char *maildir; char *newpath; @@ -454,6 +455,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) { NOTMUCH_OPT_STRING, &folder, "folder", 0, 0 }, { NOTMUCH_OPT_BOOLEAN, &create_folder, "create-folder", 0, 0 }, { NOTMUCH_OPT_BOOLEAN, &keep, "keep", 0, 0 }, + { NOTMUCH_OPT_BOOLEAN, &no_hooks, "no-hooks", 'n', 0 }, { NOTMUCH_OPT_END, 0, 0, 0, 0 } }; @@ -541,5 +543,10 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_database_destroy (notmuch); + if (! no_hooks && status == NOTMUCH_STATUS_SUCCESS) { + /* Ignore hook failures. */ + notmuch_run_hook (db_path, "post-insert"); + } + return status ? EXIT_FAILURE : EXIT_SUCCESS; } -- 1.7.2.5 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch