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

2014-10-06 Thread Tomi Ollila
On Sun, Oct 05 2014, Michal Sojka wrote: > The new outputs allow printing senders, recipients or both of matching > messages. > > This code based on a patch from Jani Nikula. OK, IMO... 1/4 OK Before 2/4 add support for 'flag' arguments, drop the --output=addresses option which is now done as

[PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Tomi Ollila
On Mon, Oct 06 2014, Ian Main wrote: > Add an option to use 'notmuch insert' to save your sent mail. > --- > > Add -inbox as well. > > vim/notmuch.vim | 17 + > 1 file changed, 17 insertions(+) > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim > index 331e930..a9044c4 100644 >

[PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Ian Main
Tomi Ollila wrote: > On Mon, Oct 06 2014, Ian Main wrote: > > > Add an option to use 'notmuch insert' to save your sent mail. > > --- > > > > Add -inbox as well. > > > > vim/notmuch.vim | 17 + > > 1 file changed, 17 insertions(+) > > > > diff --git a/vim/notmuch.vim

[PATCH v2 12/12] lib: Remove unnecessary thread linking steps when using ghost messages

2014-10-06 Thread Austin Clements
From: Austin Clements Previously, it was necessary to link new messages to children to work around some (though not all) problems with the old metadata-based approach to stored thread IDs. With ghost messages, this is no longer necessary, so don't bother with child linking

[PATCH v2 11/12] test: Test upgrade to ghost messages feature

2014-10-06 Thread Austin Clements
--- test/T530-upgrade.sh | 21 + 1 file changed, 21 insertions(+) diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh index c4c4ac8..6b42a69 100755 --- a/test/T530-upgrade.sh +++ b/test/T530-upgrade.sh @@ -116,4 +116,25 @@ MAIL_DIR/bar/new/21:2, MAIL_DIR/bar/new/22:2,

[PATCH v2 10/12] lib: Enable ghost messages feature

2014-10-06 Thread Austin Clements
From: Austin Clements This fixes the broken thread order test. --- lib/database-private.h| 2 +- test/T260-thread-order.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h index e2e4bc8..15e03cc 100644 ---

[PATCH v2 09/12] lib: Implement upgrade to ghost messages feature

2014-10-06 Thread Austin Clements
From: Austin Clements Somehow this is the first upgrade pass that actually does *any* error checking, so this also adds the bit of necessary infrastructure to handle that. --- lib/database.cc | 66 +++-- 1 file changed, 64

[PATCH v2 08/12] lib: Implement ghost-based thread linking

2014-10-06 Thread Austin Clements
From: Austin Clements This updates the thread linking code to use ghost messages instead of user metadata to link messages into threads. In contrast with the old approach, this is actually correct. Previously, thread merging updated only the thread IDs of message documents,

[PATCH v2 07/12] lib: Internal support for querying and creating ghost messages

2014-10-06 Thread Austin Clements
From: Austin Clements This updates the message abstraction to support ghost messages: it adds a message flag that distinguishes regular messages from ghost messages, and an internal function for initializing a newly created (blank) message as a ghost message. ---

[PATCH v2 06/12] lib: Introduce macros for bit operations

2014-10-06 Thread Austin Clements
These macros help clarify basic bit-twiddling code and are written to be robust against C undefined behavior of shift operators. --- lib/message.cc| 6 +++--- lib/notmuch-private.h | 11 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/message.cc

[PATCH v2 05/12] lib: Update database schema doc for ghost messages

2014-10-06 Thread Austin Clements
From: Austin Clements This describes the structure of ghost mail documents. Ghost messages are not yet implemented. --- lib/database.cc | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index

[PATCH v2 04/12] lib: Add a ghost messages database feature

2014-10-06 Thread Austin Clements
From: Austin Clements This will be implemented over the next several patches. The feature is not yet "enabled" (this does not add it to NOTMUCH_FEATURES_CURRENT). --- lib/database-private.h | 7 +++ lib/database.cc| 2 ++ 2 files changed, 9 insertions(+) diff

[PATCH v2 03/12] lib: Handle empty date value

2014-10-06 Thread Austin Clements
From: Austin Clements In the interest of robustness, avoid undefined behavior of sortable_unserialise if the date value is missing. This shouldn't happen now, but ghost messages will have blank date values. --- lib/message.cc | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH v2 02/12] lib: Refactor _notmuch_database_link_message

2014-10-06 Thread Austin Clements
From: Austin Clements This moves the code to retrieve and clear the metadata thread ID out of _notmuch_database_link_message into its own function. This will simplify future changes. --- lib/database.cc | 69 +++-- 1 file

[PATCH v2 01/12] lib: Move message ID compression to _notmuch_message_create_for_message_id

2014-10-06 Thread Austin Clements
From: Austin Clements Previously, this was performed by notmuch_database_add_message. This happens to be the only caller currently (which is why this was safe), but we're about to introduce more callers, and it makes more sense to put responsibility for ID compression in the

[PATCH 00/12] Add ghost messages and fix thread linking

2014-10-06 Thread Austin Clements
This is v2 of the id:1412345958-8278-1-git-send-email-aclements at csail.mit.edu. This adds some comments and clarifies some code as suggested by David. Patch 6 is new in v2 and adds some bit-twiddling macros for clarity and robustness in later patches. The diff from v1 is below. diff --git

[PATCH 06/11] lib: Internal support for querying and creating ghost messages

2014-10-06 Thread Austin Clements
On Mon, 06 Oct 2014, David Bremner wrote: > Austin Clements writes: > >> >> I'm used to reading this stuff, so either way is fine with me. Do we >> have bit set / clear / read macros? >> > > I guess not. the things we have in query.cc are related but different. I added some macros for doing

[PATCH] VIM: Improve search list

2014-10-06 Thread Ian Main
Make the width of the search name column expand/contract with the length of the longest search name string. Fix syntax highlighting to make the above work right. Add the ability to use a blank search pattern to create a spacer to break up searches into groups. --- vim/notmuch.txt

[PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Ian Main
Add an option to use 'notmuch insert' to save your sent mail. --- Add -inbox as well. vim/notmuch.vim | 17 + 1 file changed, 17 insertions(+) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 331e930..a9044c4 100644 --- a/vim/notmuch.vim +++ b/vim/notmuch.vim @@ -58,6 +58,7

[PATCH] VIM: Improve moving between messages in a thread

2014-10-06 Thread Ian Main
Add a few changes to moving between threads: - It supports 'scrolloff' so that if you have this set it will move the buffer and cursor so the next/prev email starts at the top of the screen. - It adds the ability to use shift-tab to go to the previous msg in the thread. Ian --- This

[PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Ian Main
Add an option to use 'notmuch insert' to save your sent mail. --- vim/notmuch.vim | 17 + 1 file changed, 17 insertions(+) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 331e930..cb280c3 100644 --- a/vim/notmuch.vim +++ b/vim/notmuch.vim @@ -58,6 +58,7 @@ let

[PATCH] Improve moving between messages in a thread

2014-10-06 Thread Ian Main
Ian Main wrote: > This patch adds a few changes to moving between threads: > > - It supports 'scrolloff' so that if you have this set it will move the > buffer and cursor so the next/prev email starts at the top of the > screen. > - It adds the ability to use shift-tab to go to the previous

[PATCH 02/11] lib: Refactor _notmuch_database_link_message

2014-10-06 Thread Austin Clements
Quoth David Bremner on Oct 06 at 8:04 am: > Austin Clements writes: > > > Quoth David Bremner on Oct 05 at 9:45 am: > >> Austin Clements writes: > >> > +void *local = talloc_new (NULL); > >> > >> What's the advantage of using a local talloc context here? Is this just > >> an

[PATCH 06/11] lib: Internal support for querying and creating ghost messages

2014-10-06 Thread David Bremner
Austin Clements writes: > > I'm used to reading this stuff, so either way is fine with me. Do we > have bit set / clear / read macros? > I guess not. the things we have in query.cc are related but different. >> > + else if (*i == "Tghost") >> > + message->flags |= (1 <<

[PATCH 02/11] lib: Refactor _notmuch_database_link_message

2014-10-06 Thread David Bremner
Austin Clements writes: > Quoth David Bremner on Oct 05 at 9:45 am: >> Austin Clements writes: >> > +void *local = talloc_new (NULL); >> >> What's the advantage of using a local talloc context here? Is this just >> an optimization? > > There are a few allocations that wind up going in to

[PATCH 08/11] lib: Implement upgrade to ghost messages feature

2014-10-06 Thread David Bremner
Austin Clements writes: > Quoth David Bremner on Oct 05 at 10:56 am: >> Austin Clements writes: >> > +if (new_features & NOTMUCH_FEATURE_GHOSTS) { >> > + t_end = db->metadata_keys_end ("thread_id_"); >> > + for (t = db->metadata_keys_begin ("thread_id_"); t != t_end; ++t) >> > +

[PATCH] Improve moving between messages in a thread

2014-10-06 Thread Ian Main
This patch adds a few changes to moving between threads: - It supports 'scrolloff' so that if you have this set it will move the buffer and cursor so the next/prev email starts at the top of the screen. - It adds the ability to use shift-tab to go to the previous msg in the thread. Ian

Re: [PATCH 08/11] lib: Implement upgrade to ghost messages feature

2014-10-06 Thread David Bremner
Austin Clements acleme...@csail.mit.edu writes: Quoth David Bremner on Oct 05 at 10:56 am: Austin Clements acleme...@csail.mit.edu writes: +if (new_features NOTMUCH_FEATURE_GHOSTS) { + t_end = db-metadata_keys_end (thread_id_); + for (t = db-metadata_keys_begin (thread_id_); t !=

Re: [PATCH 02/11] lib: Refactor _notmuch_database_link_message

2014-10-06 Thread David Bremner
Austin Clements acleme...@csail.mit.edu writes: Quoth David Bremner on Oct 05 at 9:45 am: Austin Clements acleme...@csail.mit.edu writes: +void *local = talloc_new (NULL); What's the advantage of using a local talloc context here? Is this just an optimization? There are a few

Re: [PATCH 06/11] lib: Internal support for querying and creating ghost messages

2014-10-06 Thread David Bremner
Austin Clements acleme...@csail.mit.edu writes: I'm used to reading this stuff, so either way is fine with me. Do we have bit set / clear / read macros? I guess not. the things we have in query.cc are related but different. + else if (*i == Tghost) + message-flags |= (1

[PATCH] Improve moving between messages in a thread

2014-10-06 Thread Ian Main
This patch adds a few changes to moving between threads: - It supports 'scrolloff' so that if you have this set it will move the buffer and cursor so the next/prev email starts at the top of the screen. - It adds the ability to use shift-tab to go to the previous msg in the thread. Ian

Re: [PATCH 02/11] lib: Refactor _notmuch_database_link_message

2014-10-06 Thread Austin Clements
Quoth David Bremner on Oct 06 at 8:04 am: Austin Clements acleme...@csail.mit.edu writes: Quoth David Bremner on Oct 05 at 9:45 am: Austin Clements acleme...@csail.mit.edu writes: +void *local = talloc_new (NULL); What's the advantage of using a local talloc context here? Is

Re: [PATCH 06/11] lib: Internal support for querying and creating ghost messages

2014-10-06 Thread Austin Clements
On Mon, 06 Oct 2014, David Bremner da...@tethera.net wrote: Austin Clements acleme...@csail.mit.edu writes: I'm used to reading this stuff, so either way is fine with me. Do we have bit set / clear / read macros? I guess not. the things we have in query.cc are related but different. I

RE: [PATCH] Improve moving between messages in a thread

2014-10-06 Thread Ian Main
Ian Main wrote: This patch adds a few changes to moving between threads: - It supports 'scrolloff' so that if you have this set it will move the buffer and cursor so the next/prev email starts at the top of the screen. - It adds the ability to use shift-tab to go to the previous msg in

[PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Ian Main
Add an option to use 'notmuch insert' to save your sent mail. --- vim/notmuch.vim | 17 + 1 file changed, 17 insertions(+) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 331e930..cb280c3 100644 --- a/vim/notmuch.vim +++ b/vim/notmuch.vim @@ -58,6 +58,7 @@ let

[PATCH] VIM: Improve moving between messages in a thread

2014-10-06 Thread Ian Main
Add a few changes to moving between threads: - It supports 'scrolloff' so that if you have this set it will move the buffer and cursor so the next/prev email starts at the top of the screen. - It adds the ability to use shift-tab to go to the previous msg in the thread. Ian --- This

[PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Ian Main
Add an option to use 'notmuch insert' to save your sent mail. --- Add -inbox as well. vim/notmuch.vim | 17 + 1 file changed, 17 insertions(+) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 331e930..a9044c4 100644 --- a/vim/notmuch.vim +++ b/vim/notmuch.vim @@ -58,6 +58,7

Re: [PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Tomi Ollila
On Mon, Oct 06 2014, Ian Main im...@stemwinder.org wrote: Add an option to use 'notmuch insert' to save your sent mail. --- Add -inbox as well. vim/notmuch.vim | 17 + 1 file changed, 17 insertions(+) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 331e930..a9044c4

[PATCH] VIM: Improve search list

2014-10-06 Thread Ian Main
Make the width of the search name column expand/contract with the length of the longest search name string. Fix syntax highlighting to make the above work right. Add the ability to use a blank search pattern to create a spacer to break up searches into groups. --- vim/notmuch.txt

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

2014-10-06 Thread Tomi Ollila
On Sun, Oct 05 2014, Michal Sojka sojk...@fel.cvut.cz wrote: The new outputs allow printing senders, recipients or both of matching messages. This code based on a patch from Jani Nikula. OK, IMO... 1/4 OK Before 2/4 add support for 'flag' arguments, drop the --output=addresses option which

[PATCH 00/12] Add ghost messages and fix thread linking

2014-10-06 Thread Austin Clements
This is v2 of the id:1412345958-8278-1-git-send-email-acleme...@csail.mit.edu. This adds some comments and clarifies some code as suggested by David. Patch 6 is new in v2 and adds some bit-twiddling macros for clarity and robustness in later patches. The diff from v1 is below. diff --git

[PATCH v2 07/12] lib: Internal support for querying and creating ghost messages

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu This updates the message abstraction to support ghost messages: it adds a message flag that distinguishes regular messages from ghost messages, and an internal function for initializing a newly created (blank) message as a ghost message. --- lib/message.cc

[PATCH v2 05/12] lib: Update database schema doc for ghost messages

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu This describes the structure of ghost mail documents. Ghost messages are not yet implemented. --- lib/database.cc | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index

[PATCH v2 06/12] lib: Introduce macros for bit operations

2014-10-06 Thread Austin Clements
These macros help clarify basic bit-twiddling code and are written to be robust against C undefined behavior of shift operators. --- lib/message.cc| 6 +++--- lib/notmuch-private.h | 11 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/message.cc

[PATCH v2 08/12] lib: Implement ghost-based thread linking

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu This updates the thread linking code to use ghost messages instead of user metadata to link messages into threads. In contrast with the old approach, this is actually correct. Previously, thread merging updated only the thread IDs of message documents, not

[PATCH v2 02/12] lib: Refactor _notmuch_database_link_message

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu This moves the code to retrieve and clear the metadata thread ID out of _notmuch_database_link_message into its own function. This will simplify future changes. --- lib/database.cc | 69 +++-- 1 file

[PATCH v2 09/12] lib: Implement upgrade to ghost messages feature

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu Somehow this is the first upgrade pass that actually does *any* error checking, so this also adds the bit of necessary infrastructure to handle that. --- lib/database.cc | 66 +++-- 1 file changed, 64

[PATCH v2 12/12] lib: Remove unnecessary thread linking steps when using ghost messages

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu Previously, it was necessary to link new messages to children to work around some (though not all) problems with the old metadata-based approach to stored thread IDs. With ghost messages, this is no longer necessary, so don't bother with child linking when

[PATCH v2 03/12] lib: Handle empty date value

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu In the interest of robustness, avoid undefined behavior of sortable_unserialise if the date value is missing. This shouldn't happen now, but ghost messages will have blank date values. --- lib/message.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git

[PATCH v2 11/12] test: Test upgrade to ghost messages feature

2014-10-06 Thread Austin Clements
--- test/T530-upgrade.sh | 21 + 1 file changed, 21 insertions(+) diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh index c4c4ac8..6b42a69 100755 --- a/test/T530-upgrade.sh +++ b/test/T530-upgrade.sh @@ -116,4 +116,25 @@ MAIL_DIR/bar/new/21:2, MAIL_DIR/bar/new/22:2,

[PATCH v2 04/12] lib: Add a ghost messages database feature

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu This will be implemented over the next several patches. The feature is not yet enabled (this does not add it to NOTMUCH_FEATURES_CURRENT). --- lib/database-private.h | 7 +++ lib/database.cc| 2 ++ 2 files changed, 9 insertions(+) diff --git

[PATCH v2 01/12] lib: Move message ID compression to _notmuch_message_create_for_message_id

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu Previously, this was performed by notmuch_database_add_message. This happens to be the only caller currently (which is why this was safe), but we're about to introduce more callers, and it makes more sense to put responsibility for ID compression in the

[PATCH v2 10/12] lib: Enable ghost messages feature

2014-10-06 Thread Austin Clements
From: Austin Clements amdra...@mit.edu This fixes the broken thread order test. --- lib/database-private.h| 2 +- test/T260-thread-order.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h index e2e4bc8..15e03cc 100644 ---

Re: [PATCH] VIM: Make an option to save sent mail locally

2014-10-06 Thread Ian Main
Tomi Ollila wrote: On Mon, Oct 06 2014, Ian Main im...@stemwinder.org wrote: Add an option to use 'notmuch insert' to save your sent mail. --- Add -inbox as well. vim/notmuch.vim | 17 + 1 file changed, 17 insertions(+) diff --git a/vim/notmuch.vim