[patch v2 2/4] lib: add _notmuch_database_reopen

2017-02-25 Thread David Bremner
The main expected use is to recover from a Xapian::DatabaseChanged exception. --- lib/database-private.h | 4 lib/database.cc| 23 +++ lib/notmuch-private.h | 3 +++ 3 files changed, 30 insertions(+) diff --git a/lib/database-private.h b/lib/database-private.h

[patch v2 4/4] lib/message.cc: use view number to invalidate cached metadata

2017-02-25 Thread David Bremner
Currently the view number is incremented by notmuch_database_reopen --- lib/message.cc | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 9bafff0b..007f1171 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -317,1

[patch v2 1/4] test: add known broken test for uncaught DatabaseModifiedError

2017-02-25 Thread David Bremner
There are several of these to track down, but one that is in quite a few code paths is _notmuch_message_ensure_metadata. --- test/T640-database-modified.sh | 67 ++ 1 file changed, 67 insertions(+) create mode 100755 test/T640-database-modified.sh diff --g

[patch v2 3/4] lib: handle DatabaseModifiedError in _n_message_ensure_metadata

2017-02-25 Thread David Bremner
The retries are hardcoded to a small number, and error handling aborts than propagating errors from notmuch_database_reopen. These are both somewhat justified by the assumption that most things that can go wrong in Xapian::Database::reopen are rare and fatal. Here's the brief discussion with Xapian

v2 _notmuch_message_ensure_metadata exception handling

2017-02-25 Thread David Bremner
I tried to address most of Jani's comments on v1 [1]. The bad news is that the test is a bit delicate, it really does need the whole corpus. I did decide to follow the suggestion to make the _reopen function private for now. It would be nice if we could hide that complexity from library users, I g

Re: [PATCH 3/4] lib: handle DatabaseModifiedError in _n_message_ensure_metadata

2017-02-25 Thread Jani Nikula
On Sat, 25 Feb 2017, David Bremner wrote: > Jani Nikula writes: > >> On Fri, 24 Feb 2017, David Bremner wrote: >>> The retries are hardcoded to a small number, and error handling aborts >>> than propagating errors from notmuch_database_reopen. These are both >>> somewhat justified by the assumpt

Re: [PATCH 3/4] lib: handle DatabaseModifiedError in _n_message_ensure_metadata

2017-02-25 Thread David Bremner
Jani Nikula writes: > On Fri, 24 Feb 2017, David Bremner wrote: >> The retries are hardcoded to a small number, and error handling aborts >> than propagating errors from notmuch_database_reopen. These are both >> somewhat justified by the assumption that most things that can go >> wrong in Xapia

Re: [PATCH 2/4] lib: add notmuch_database_reopen

2017-02-25 Thread David Bremner
Jani Nikula writes: > On Fri, 24 Feb 2017, David Bremner wrote: >> The main expected use is to recover from a Xapian::DatabaseChanged >> exception. > > I guess the main question here is if this should be exposed from the > library or not. If the intention is to recover *within* the library, why

Re: [PATCH 1/4] test: add known broken test for uncaught DatabaseModifiedError

2017-02-25 Thread David Bremner
Jani Nikula writes: >> + >> +add_email_corpus > > Is the whole corpus necessary? Just add a single message? Good point, that's actually leftover from a previous failed attempt. >> +test_begin_subtest "catching DatabaseModifiedError in >> _notmuch_message_ensure_metadata" >> +test_subtest_known_

Re: [PATCH] lib: remove notmuch_query_{count, search}_{threads, messages}

2017-02-25 Thread David Bremner
Jani Nikula writes: > On Wed, 22 Feb 2017, David Bremner wrote: >> These 4 functions were originally deprecated in notmuch 0.21, more >> than a year ago. > > This leaves the implementations of the functions as unused code behind. oh oops. > How long until we can add them back with the same sig

Re: [PATCH] lib: remove notmuch_query_{count, search}_{threads, messages}

2017-02-25 Thread Jani Nikula
On Wed, 22 Feb 2017, David Bremner wrote: > These 4 functions were originally deprecated in notmuch 0.21, more > than a year ago. This leaves the implementations of the functions as unused code behind. How long until we can add them back with the same signature as the _st versions, and deprecate

Re: [PATCH 1/4] test: add known broken test for uncaught DatabaseModifiedError

2017-02-25 Thread Jani Nikula
On Fri, 24 Feb 2017, David Bremner wrote: > There are several of these to track down, but one that is in quite a > few code paths is _notmuch_message_ensure_metadata. > --- > test/T640-database-modified.sh | 60 > ++ > 1 file changed, 60 insertions(+) > c

Re: [PATCH 4/4] lib/message.cc: use view number to invalidate cached metadata

2017-02-25 Thread Jani Nikula
On Fri, 24 Feb 2017, David Bremner wrote: > Currently the view number is incremented by notmuch_database_reopen > --- > lib/message.cc | 25 +++-- > 1 file changed, 11 insertions(+), 14 deletions(-) > > diff --git a/lib/message.cc b/lib/message.cc > index 15e2f528..bfb95917 10

Re: [PATCH 3/4] lib: handle DatabaseModifiedError in _n_message_ensure_metadata

2017-02-25 Thread Jani Nikula
On Fri, 24 Feb 2017, David Bremner wrote: > The retries are hardcoded to a small number, and error handling aborts > than propagating errors from notmuch_database_reopen. These are both > somewhat justified by the assumption that most things that can go > wrong in Xapian::Database::reopen are rare

Re: [PATCH 2/4] lib: add notmuch_database_reopen

2017-02-25 Thread Jani Nikula
On Fri, 24 Feb 2017, David Bremner wrote: > The main expected use is to recover from a Xapian::DatabaseChanged > exception. I guess the main question here is if this should be exposed from the library or not. If the intention is to recover *within* the library, why add new API? > --- > lib/data

Re: notmuch version/Python bindings

2017-02-25 Thread David Bremner
Sebastian Spaeth writes: > Hi there, > just tried to delete the notmuch packagr on pypi. While I am listed as the > author, I do not own the package and it lists "Package Index Owner: Julian". > > It might be that I have already transferred the ownership of the package, but > I don't remember w

v5 of nondestructive includes patches

2017-02-25 Thread David Bremner
More or less by blind luck, it turns out the need for a status return from notmuch_query_add_tag_exclude is somewhat mitigated by the lazy query parsing introduced in patch 2/3. In particular the query is not marked parsed, and later attempts to parse it will report the error. interdiff follows, o

[PATCH 3/3] lib: query make exclude handling non-destructive

2017-02-25 Thread David Bremner
We filter added exclude at add time, rather than modifying the query by count search. As noted in the comments, there are several ignored conditions here. --- lib/query.cc | 55 -- test/T060-count.sh | 1 - 2 files changed, 37 insertions(+

[PATCH 1/3] lib: eagerly parse queries

2017-02-25 Thread David Bremner
Rather than waiting for a call to count/search, parse the query string when the notmuch_query_t is created. This is a small reduction in duplicated code, and a potential efficiency improvement if many count/search operations are called on the same query (although the latter sounds a bit unusual). T

[PATCH 2/3] lib/query: make query parsing lazy again, keep centralized.

2017-02-25 Thread David Bremner
This is mainly to fix the nasty error path introduced in the last commit, by moving the parsing into functions where the API is already set up to return error status. It preserves the feature of having a pre-parsed query available for further processing. --- lib/query.cc | 37

[PATCH 1/2] cli/show: list all filenames of a message in the formatted output

2017-02-25 Thread Jani Nikula
Instead of just having the first filename for the message, list all duplicate filenames of the message as a list in the formatted outputs. This bumps the format version to 3. --- v2: fix tests, and fix bugs found by the added tests :) I presume the UI could do fancy things with this to highlight

[PATCH 2/2] test: test format version difference between v2 and v3

2017-02-25 Thread Jani Nikula
Schemata v3 changed message filename field to a list. Test both versions 2 and 3. --- test/T160-json.sh | 67 +++ 1 file changed, 67 insertions(+) diff --git a/test/T160-json.sh b/test/T160-json.sh index 099632b4a286..85b9b41f314c 100755 --- a/t

Re: bug report

2017-02-25 Thread David Bremner
Andy Wills writes: > Hi, > > I've been consistently getting an error of this form: > > andy@andy-x200:~/work/talks/2017/icps$ notmuch new > Processed 230 total files in 7s (29 files/sec.). > Added 212 new messages to the database. Removed 85 messages. Detected 18 file > renames. > Error: A Xapi

[PATCH 2/2] emacs/desktop: update to use notmuch-emacs-mua and handle mailto

2017-02-25 Thread Jani Nikula
With the mailto: handling in notmuch-emacs-mua, we can update the desktop file to advertize we can be set as the default application to handle email. While at it, add GenericName and Comment to be more informative. With --hello, notmuch-emacs-mua will run (notmuch) if mailto: url is not given. ---

[PATCH 1/2] completion: complete notmuch emacs-mua

2017-02-25 Thread Jani Nikula
With subcommand handling for external commands we can easily complete 'notmuch emacs-mua' using the existing completion system. --- v3: complete --hello option --- completion/notmuch-completion.bash | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --