Do path: searches handle spaces correctly?

2014-09-22 Thread Keith Amidon
I'm trying to update an archiving tool that used the old folder: search terms to use the newer folder: or path: terms. From playing around with it, I think that the path: term is what I want to use. However, I am getting some behavior I don't understand unless path: searches don't properly

[PATCH 1/5] cli: Refactor option passing in the search command

2014-09-22 Thread Michal Sojka
Many functions that implement the search command need to access command line options. Instead of passing each option in a separate variable, put them in a structure and pass only this structure. This will become handy in the following patches. --- notmuch-search.c | 122

[PATCH 5/5] cli: Add tests for 'search --output=addresses' and similar

2014-09-22 Thread Michal Sojka
--- test/T090-search-output.sh | 59 +++ test/T095-search-unique.sh | 63 ++ 2 files changed, 122 insertions(+) create mode 100755 test/T095-search-unique.sh diff --git a/test/T090-search-output.sh

[PATCH 2/5] cli: Extend the search command for --output=addresses and similar

2014-09-22 Thread Michal Sojka
The new outputs allow printing senders, recipients or both of matching messages. This code based on a patch from Jani Nikula. --- completion/notmuch-completion.bash | 2 +- completion/notmuch-completion.zsh | 3 +- doc/man1/notmuch-search.rst| 22 +++- notmuch-search.c

[PATCH 0/5] notmuch search --output=addresses

2014-09-22 Thread Michal Sojka
Hello all, this patch series adds support for --output=addresses and similar arguments in notmuch search. It is a reworked and extended version of id:1410021689-15901-1-git-send-email-j...@nikula.org. Compared to Jani's patches, I do not use keyword-flag command line parser for the --output

[PATCH 03/11] cli/insert: move add_file_to_database to a better place

2014-09-22 Thread Jani Nikula
Move add_file_to_database around to keep the filesystem related functions grouped together, improving readability. No functional changes. --- notmuch-insert.c | 92 +++--- 1 files changed, 46 insertions(+), 46 deletions(-) diff --git

[PATCH 01/11] lib: actually return failures from notmuch_message_tags_to_maildir_flags

2014-09-22 Thread Jani Nikula
The function takes great care to preserve the first error status it encounters, yet fails to return that status to the caller. Fix it. --- lib/message.cc |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 68f7e68..7e82548 100644 ---

[PATCH 02/11] cli/insert: rename check_folder_name to is_valid_folder_name

2014-09-22 Thread Jani Nikula
An is something predicate conveys the meaning better. While at it, improve the function documentation and error message. Besides the error message change, no functional changes. --- notmuch-insert.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git

[PATCH 06/11] cli/insert: use a single recursive mkdir function

2014-09-22 Thread Jani Nikula
Combine make_directory() and make_directory_and_parents() into a single recursive mkdir_recursive() function. Clarify the code and improve error handling. Improve error messages. Switch to using the new function in maildir_create_folder(). Constify talloc context. --- notmuch-insert.c | 131

[PATCH 04/11] cli/insert: rename file copy function

2014-09-22 Thread Jani Nikula
The copying has nothing to do with stdin, so call it copy_fd instead. While at it, improve documentation and reverse the parameters, as destination is traditionally the first parameter. --- notmuch-insert.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git

[PATCH 05/11] cli/insert: clean up sync_dir

2014-09-22 Thread Jani Nikula
Clarify the code slightly, improve error messages. Apart from the error message changes, no functional changes. --- notmuch-insert.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/notmuch-insert.c b/notmuch-insert.c index 5d47806..7375c54 100644 ---

[PATCH 07/11] cli/insert: abstract temporary filename generation

2014-09-22 Thread Jani Nikula
This will clean up the usage. There's the slight functional change of potentially ending up doing extra gethostname and getpid calls, but this is neglible. --- notmuch-insert.c | 39 +++ 1 files changed, 27 insertions(+), 12 deletions(-) diff --git

[PATCH 09/11] cli/insert: add fail path to add_file_to_database

2014-09-22 Thread Jani Nikula
Handle failures gracefully in add_file_to_database, renamed simply add_file while at it. Add keep option to not remove the message from database if tagging or tag syncing to maildir flags fails. Expand the function documentation to cover the changes. --- notmuch-insert.c | 89

[PATCH 10/11] cli/insert: require succesful message indexing for success status

2014-09-22 Thread Jani Nikula
Add --keep option to keep any remaining stuff in index or file. We could distinguish between failures to index and failures to apply tags or maildir sync, but for simplicity just have one. --- notmuch-insert.c| 20 +++- test/T070-insert.sh |2 +- 2 files changed, 16

Re: [PATCH] Add configurable changed tag to messages that have been changed on disk

2014-09-22 Thread Gaute Hope
Excerpts from Gaute Hope's message of August 6, 2014 10:29: Austin Clements amdra...@mit.edu wrote on Fri, 01 Aug 2014 14:55:05 -0400: I have a prototype implementation of message modification times on my lastmod-v1 branch at https://github.com/aclements/notmuch/tree/lastmod-v1 It builds on

Re: Do path: searches handle spaces correctly?

2014-09-22 Thread Austin Clements
Quoth Keith Amidon on Sep 22 at 7:42 am: On Mon, 2014-09-22 at 11:20 +0200, David Bremner wrote: Keith Amidon ke...@awakenetworks.com writes: notmuch search --output=files path:'dir/INBOX/INBOX/Sent Items' I don't get any results, but it seems like the two results above should

Re: [PATCH] Add configurable changed tag to messages that have been changed on disk

2014-09-22 Thread Tomi Ollila
On Mon, Sep 22 2014, Gaute Hope e...@gaute.vetsj.com wrote: Excerpts from Gaute Hope's message of August 6, 2014 10:29: Austin Clements amdra...@mit.edu wrote on Fri, 01 Aug 2014 14:55:05 -0400: I have a prototype implementation of message modification times on my lastmod-v1 branch at

Re: [PATCH] Add configurable changed tag to messages that have been changed on disk

2014-09-22 Thread Austin Clements
On Mon, 22 Sep 2014, Gaute Hope e...@gaute.vetsj.com wrote: Excerpts from Gaute Hope's message of August 6, 2014 10:29: Austin Clements amdra...@mit.edu wrote on Fri, 01 Aug 2014 14:55:05 -0400: I have a prototype implementation of message modification times on my lastmod-v1 branch at

[PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread Austin Clements
In Xapian, closing a database implicitly aborts any outstanding transaction and commits changes. For historical reasons, notmuch_database_close had grown to almost, but not quite duplicate this behavior. Before closing the database, it would explicitly (and unnecessarily) commit it. However, if

Re: [PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread W. Trevor King
On Mon, Sep 22, 2014 at 11:43:35AM -0400, Austin Clements wrote: This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and read/write databases, takes care of committing changes, unifies the exception handling path, and codifies aborting

Re: [announce] nmhive v0.1.0, a bookmarklet/server for nmbug tags

2014-09-22 Thread W. Trevor King
On Mon, Sep 22, 2014 at 10:19:35AM -0700, W. Trevor King wrote: I like nmbug's distributed tag maintenance, but not everyone has notmuch/nmbug installed locally (yet ;). However, everyone that I know does have a browser and a mail client. They can submit messages with their mail client

Re: [PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread Austin Clements
Quoth W. Trevor King on Sep 22 at 9:59 am: On Mon, Sep 22, 2014 at 11:43:35AM -0400, Austin Clements wrote: This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and read/write databases, takes care of committing changes, unifies the

Re: [PATCH] emacs: jump: fix compile warning on emacs 23

2014-09-22 Thread Austin Clements
LGTM. I'm a little surprised this is necessary, but whatever. I think the eval-and-compile has to be top-level; it's certainly not wrong for it to be top-level. (I like the comment in the eval-and-compile implementation: ;; Remember, it's magic.) On Thu, 04 Sep 2014, Mark Walters

Re: [PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread W. Trevor King
On Mon, Sep 22, 2014 at 06:50:50PM +, Austin Clements wrote: Quoth W. Trevor King on Sep 22 at 9:59 am: On Mon, Sep 22, 2014 at 11:43:35AM -0400, Austin Clements wrote: This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and

Re: Do path: searches handle spaces correctly?

2014-09-22 Thread Keith Amidon
On Mon, 2014-09-22 at 15:06 +, Austin Clements wrote: I assume you're doing this from the command line? Does the following work? notmuch search --output=files 'path:dir/INBOX/INBOX/Sent Items/**' Shell quoting and Xapian quoting interact in often confusing ways. In your original

Do path: searches handle spaces correctly?

2014-09-22 Thread David Bremner
Keith Amidon writes: > > notmuch search --output=files path:'dir/INBOX/INBOX/Sent Items' > > I don't get any results, but it seems like the two results above should > be shown, right? Am I doing something wrong here? If it looks like I'm > doing it correctly, what can I do to help troubleshoot

[PATCH 1/5] cli: Refactor option passing in the search command

2014-09-22 Thread Michal Sojka
Many functions that implement the search command need to access command line options. Instead of passing each option in a separate variable, put them in a structure and pass only this structure. This will become handy in the following patches. --- notmuch-search.c | 122

[PATCH 5/5] cli: Add tests for 'search --output=addresses' and similar

2014-09-22 Thread Michal Sojka
--- test/T090-search-output.sh | 59 +++ test/T095-search-unique.sh | 63 ++ 2 files changed, 122 insertions(+) create mode 100755 test/T095-search-unique.sh diff --git a/test/T090-search-output.sh

[PATCH 3/5] cli: Add support for parsing command line "flag" options

2014-09-22 Thread Michal Sojka
This allows having multiple flags as a value of a command line option (e.g. --foo=bar,baz). The values of the given flags are OR'd together. This was inspired by a similar patch from Jani Nikula. --- command-line-arguments.c | 40

[PATCH 4/5] cli: Add configurable address deduplication for --output=addresses

2014-09-22 Thread Michal Sojka
The code here is an extended version of a path from Jani Nikula. --- completion/notmuch-completion.bash | 6 ++- completion/notmuch-completion.zsh | 3 +- doc/man1/notmuch-search.rst| 33 notmuch-search.c | 101 ++--- 4

[PATCH 2/5] cli: Extend the search command for --output=addresses and similar

2014-09-22 Thread Michal Sojka
The new outputs allow printing senders, recipients or both of matching messages. This code based on a patch from Jani Nikula. --- completion/notmuch-completion.bash | 2 +- completion/notmuch-completion.zsh | 3 +- doc/man1/notmuch-search.rst| 22 +++- notmuch-search.c

[PATCH 0/5] notmuch search --output=addresses

2014-09-22 Thread Michal Sojka
Hello all, this patch series adds support for --output=addresses and similar arguments in notmuch search. It is a reworked and extended version of id:1410021689-15901-1-git-send-email-jani at nikula.org. Compared to Jani's patches, I do not use keyword-flag command line parser for the --output

[PATCH 00/11] notmuch insert updates

2014-09-22 Thread Jani Nikula
This series refactors and cleans up insert, improves error handling and reporting, and adds post-insert hook. I intend to add documentation and more tests, but the code is ready for review. Also, at least some of the cleanups and fixes in the beginning of the series could go in without additional

[PATCH 01/11] lib: actually return failures from notmuch_message_tags_to_maildir_flags

2014-09-22 Thread Jani Nikula
The function takes great care to preserve the first error status it encounters, yet fails to return that status to the caller. Fix it. --- lib/message.cc |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 68f7e68..7e82548 100644 ---

[PATCH 02/11] cli/insert: rename check_folder_name to is_valid_folder_name

2014-09-22 Thread Jani Nikula
An "is something" predicate conveys the meaning better. While at it, improve the function documentation and error message. Besides the error message change, no functional changes. --- notmuch-insert.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git

[PATCH 03/11] cli/insert: move add_file_to_database to a better place

2014-09-22 Thread Jani Nikula
Move add_file_to_database around to keep the filesystem related functions grouped together, improving readability. No functional changes. --- notmuch-insert.c | 92 +++--- 1 files changed, 46 insertions(+), 46 deletions(-) diff --git

[PATCH 04/11] cli/insert: rename file copy function

2014-09-22 Thread Jani Nikula
The copying has nothing to do with stdin, so call it copy_fd instead. While at it, improve documentation and reverse the parameters, as destination is traditionally the first parameter. --- notmuch-insert.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git

[PATCH 05/11] cli/insert: clean up sync_dir

2014-09-22 Thread Jani Nikula
Clarify the code slightly, improve error messages. Apart from the error message changes, no functional changes. --- notmuch-insert.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/notmuch-insert.c b/notmuch-insert.c index 5d47806..7375c54 100644 ---

[PATCH 06/11] cli/insert: use a single recursive mkdir function

2014-09-22 Thread Jani Nikula
Combine make_directory() and make_directory_and_parents() into a single recursive mkdir_recursive() function. Clarify the code and improve error handling. Improve error messages. Switch to using the new function in maildir_create_folder(). Constify talloc context. --- notmuch-insert.c | 131

[PATCH 08/11] cli/insert: rehash file writing functions

2014-09-22 Thread Jani Nikula
Make the function calls make more sense as independent building blocks of the big picture, with clear inputs and outputs. Split up write_message into two. Improve function documentation. Cleanup and clarify the error paths. --- notmuch-insert.c | 127

[PATCH 09/11] cli/insert: add fail path to add_file_to_database

2014-09-22 Thread Jani Nikula
Handle failures gracefully in add_file_to_database, renamed simply add_file while at it. Add keep option to not remove the message from database if tagging or tag syncing to maildir flags fails. Expand the function documentation to cover the changes. --- notmuch-insert.c | 89

[PATCH 10/11] cli/insert: require succesful message indexing for success status

2014-09-22 Thread Jani Nikula
Add --keep option to keep any remaining stuff in index or file. We could distinguish between failures to index and failures to apply tags or maildir sync, but for simplicity just have one. --- notmuch-insert.c| 20 +++- test/T070-insert.sh |2 +- 2 files changed, 16

[PATCH 11/11] cli/insert: add post-insert hook

2014-09-22 Thread Jani Nikula
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

[PATCH] Add configurable changed tag to messages that have been changed on disk

2014-09-22 Thread Gaute Hope
Excerpts from Gaute Hope's message of August 6, 2014 10:29: > Austin Clements wrote on Fri, 01 Aug 2014 14:55:05 > -0400: >> I have a prototype implementation of message modification times on my >> lastmod-v1 branch at >> >> https://github.com/aclements/notmuch/tree/lastmod-v1 >> >> It

Do path: searches handle spaces correctly?

2014-09-22 Thread Keith Amidon
On Mon, 2014-09-22 at 11:20 +0200, David Bremner wrote: > Keith Amidon writes: > > > > notmuch search --output=files path:'dir/INBOX/INBOX/Sent Items' > > > > I don't get any results, but it seems like the two results above should > > be shown, right? Am I doing something wrong here? If it

Do path: searches handle spaces correctly?

2014-09-22 Thread Austin Clements
Quoth Keith Amidon on Sep 22 at 7:42 am: > On Mon, 2014-09-22 at 11:20 +0200, David Bremner wrote: > > Keith Amidon writes: > > > > > > notmuch search --output=files path:'dir/INBOX/INBOX/Sent Items' > > > > > > I don't get any results, but it seems like the two results above should > > > be

[PATCH] Add configurable changed tag to messages that have been changed on disk

2014-09-22 Thread Tomi Ollila
On Mon, Sep 22 2014, Gaute Hope wrote: > Excerpts from Gaute Hope's message of August 6, 2014 10:29: >> Austin Clements wrote on Fri, 01 Aug 2014 14:55:05 >> -0400: >>> I have a prototype implementation of message modification times on my >>> lastmod-v1 branch at >>> >>>

[PATCH] Add configurable changed tag to messages that have been changed on disk

2014-09-22 Thread Austin Clements
On Mon, 22 Sep 2014, Gaute Hope wrote: > Excerpts from Gaute Hope's message of August 6, 2014 10:29: >> Austin Clements wrote on Fri, 01 Aug 2014 14:55:05 >> -0400: >>> I have a prototype implementation of message modification times on my >>> lastmod-v1 branch at >>> >>>

[PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread Austin Clements
In Xapian, closing a database implicitly aborts any outstanding transaction and commits changes. For historical reasons, notmuch_database_close had grown to almost, but not quite duplicate this behavior. Before closing the database, it would explicitly (and unnecessarily) commit it. However, if

[PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread W. Trevor King
lication/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140922/e44bf0ac/attachment.pgp>

[announce] nmhive v0.1.0

2014-09-22 Thread W. Trevor King
was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140922/b07e5322/attachment.pgp>

[announce] nmhive v0.1.0, a bookmarklet/server for nmbug tags

2014-09-22 Thread W. Trevor King
ipedia.org/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140922/de3e518b/attachment.pgp>

[PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread Austin Clements
Quoth W. Trevor King on Sep 22 at 9:59 am: > On Mon, Sep 22, 2014 at 11:43:35AM -0400, Austin Clements wrote: > > This patch simplifies notmuch_database_close to just call > > Database::close. This works for both read-only and read/write > > databases, takes care of committing changes, unifies

[PATCH] emacs: jump: fix compile warning on emacs 23

2014-09-22 Thread Austin Clements
LGTM. I'm a little surprised this is necessary, but whatever. I think the eval-and-compile has to be top-level; it's certainly not wrong for it to be top-level. (I like the comment in the eval-and-compile implementation: ";; Remember, it's magic.") On Thu, 04 Sep 2014, Mark Walters wrote: >

[PATCH] lib: Simplify close and codify aborting atomic section

2014-09-22 Thread W. Trevor King
/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140922/4cb115a4/attachment.pgp>

Do path: searches handle spaces correctly?

2014-09-22 Thread Keith Amidon
On Mon, 2014-09-22 at 15:06 +, Austin Clements wrote: > I assume you're doing this from the command line? Does the following > work? > > notmuch search --output=files 'path:"dir/INBOX/INBOX/Sent Items/**"' > > Shell quoting and Xapian quoting interact in often confusing ways. In > your