[notmuch] [PATCH 2/3] have _notmuch_thread_create mark which messages matched the query
On Fri, 27 Nov 2009 17:15:35 -0800, Carl Worth wrote: > This is a very useful feature, Bart. Thanks for coding it up. And it's a > nicely-implemented patch series as well. Thanks. I've found it very handy. > By the way, do you think that this support obviates the > --only-matching-messages option for "notmuch search" or does anyone > still want that? I personally don't have much use for it (in the notmuch.vim UI). However, I can see it being useful if someone reads the messages on the terminal, maybe using some less verbose output format. > Or maybe the right fix is to make "notmuch show" display only matching > messages by default, (which will likely be more friendly to a user > manually typing "notmuch show" at the command line). And then make the > user-interfaces pass an "--entire-thread" option (or so) to get the > current results. Sure, I'll fix up the patch and submit it in a bit. > If we're going to make the command-line user-interface usable on its > own, then I definitely want to make it be the user interfaces that have > to pass extra-long command-line options to get what they want. Agreed. I still think we could use some templating for the different output modes. Maybe it will be important enough for soemone to implement :) > One quick point on naming: > > > /* Message flags */ > > typedef enum _notmuch_message_flag { > > +NOTMUCH_MSG_FLAG_MATCHING_SEARCH, > > } notmuch_message_flag_t; > > I like my enum values to match their type name without abbreviation. I > also like internals (like this enum value) to match the way they are > exposed in the interface, (which in this case is "match"). So I'd like > the above value to instead be: > > NOTMUCH_MESSAGE_FLAG_MATCH OK. Patch is in flight. Cheers, -Bart -- email sent from notmuch.vim plugin
Re: [notmuch] [PATCH 2/3] have _notmuch_thread_create mark which messages matched the query
On Fri, 27 Nov 2009 17:15:35 -0800, Carl Worth wrote: > This is a very useful feature, Bart. Thanks for coding it up. And it's a > nicely-implemented patch series as well. Thanks. I've found it very handy. > By the way, do you think that this support obviates the > --only-matching-messages option for "notmuch search" or does anyone > still want that? I personally don't have much use for it (in the notmuch.vim UI). However, I can see it being useful if someone reads the messages on the terminal, maybe using some less verbose output format. > Or maybe the right fix is to make "notmuch show" display only matching > messages by default, (which will likely be more friendly to a user > manually typing "notmuch show" at the command line). And then make the > user-interfaces pass an "--entire-thread" option (or so) to get the > current results. Sure, I'll fix up the patch and submit it in a bit. > If we're going to make the command-line user-interface usable on its > own, then I definitely want to make it be the user interfaces that have > to pass extra-long command-line options to get what they want. Agreed. I still think we could use some templating for the different output modes. Maybe it will be important enough for soemone to implement :) > One quick point on naming: > > > /* Message flags */ > > typedef enum _notmuch_message_flag { > > +NOTMUCH_MSG_FLAG_MATCHING_SEARCH, > > } notmuch_message_flag_t; > > I like my enum values to match their type name without abbreviation. I > also like internals (like this enum value) to match the way they are > exposed in the interface, (which in this case is "match"). So I'd like > the above value to instead be: > > NOTMUCH_MESSAGE_FLAG_MATCH OK. Patch is in flight. Cheers, -Bart -- email sent from notmuch.vim plugin ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH 2/3] have _notmuch_thread_create mark which messages matched the query
On Tue, 24 Nov 2009 23:54:34 -0500, Bart Trojanowski wrote: > When _notmuch_thread_create() is given a query string, it can return more > messages than just those matching the query. To distinguish those that > matched the query expression, the MATCHING_SEARCH flag is set > appropriately. This is a very useful feature, Bart. Thanks for coding it up. And it's a nicely-implemented patch series as well. I've pushed this out now, so anyone reading along should be able to try it with: ./notmuch show thread:6d5e3e276461188c5778c9f219f63782 and subject:"PATCH 2/3" I can't wait to have the emacs support for opening only matched messages by default. By the way, do you think that this support obviates the --only-matching-messages option for "notmuch search" or does anyone still want that? Or maybe the right fix is to make "notmuch show" display only matching messages by default, (which will likely be more friendly to a user manually typing "notmuch show" at the command line). And then make the user-interfaces pass an "--entire-thread" option (or so) to get the current results. If we're going to make the command-line user-interface usable on its own, then I definitely want to make it be the user interfaces that have to pass extra-long command-line options to get what they want. One quick point on naming: > /* Message flags */ > typedef enum _notmuch_message_flag { > +NOTMUCH_MSG_FLAG_MATCHING_SEARCH, > } notmuch_message_flag_t; I like my enum values to match their type name without abbreviation. I also like internals (like this enum value) to match the way they are exposed in the interface, (which in this case is "match"). So I'd like the above value to instead be: NOTMUCH_MESSAGE_FLAG_MATCH -Carl ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[notmuch] [PATCH 2/3] have _notmuch_thread_create mark which messages matched the query
On Tue, 24 Nov 2009 23:54:34 -0500, Bart Trojanowski wrote: > When _notmuch_thread_create() is given a query string, it can return more > messages than just those matching the query. To distinguish those that > matched the query expression, the MATCHING_SEARCH flag is set > appropriately. This is a very useful feature, Bart. Thanks for coding it up. And it's a nicely-implemented patch series as well. I've pushed this out now, so anyone reading along should be able to try it with: ./notmuch show thread:6d5e3e276461188c5778c9f219f63782 and subject:"PATCH 2/3" I can't wait to have the emacs support for opening only matched messages by default. By the way, do you think that this support obviates the --only-matching-messages option for "notmuch search" or does anyone still want that? Or maybe the right fix is to make "notmuch show" display only matching messages by default, (which will likely be more friendly to a user manually typing "notmuch show" at the command line). And then make the user-interfaces pass an "--entire-thread" option (or so) to get the current results. If we're going to make the command-line user-interface usable on its own, then I definitely want to make it be the user interfaces that have to pass extra-long command-line options to get what they want. One quick point on naming: > /* Message flags */ > typedef enum _notmuch_message_flag { > +NOTMUCH_MSG_FLAG_MATCHING_SEARCH, > } notmuch_message_flag_t; I like my enum values to match their type name without abbreviation. I also like internals (like this enum value) to match the way they are exposed in the interface, (which in this case is "match"). So I'd like the above value to instead be: NOTMUCH_MESSAGE_FLAG_MATCH -Carl
[notmuch] [PATCH 2/3] have _notmuch_thread_create mark which messages matched the query
When _notmuch_thread_create() is given a query string, it can return more messages than just those matching the query. To distinguish those that matched the query expression, the MATCHING_SEARCH flag is set appropriately. Signed-off-by: Bart Trojanowski --- lib/notmuch.h |1 + lib/thread.cc |8 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/lib/notmuch.h b/lib/notmuch.h index c232c58..3974820 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -686,6 +686,7 @@ notmuch_message_get_filename (notmuch_message_t *message); /* Message flags */ typedef enum _notmuch_message_flag { +NOTMUCH_MSG_FLAG_MATCHING_SEARCH, } notmuch_message_flag_t; /* Get a value of a flag for the email corresponding to 'message'. */ diff --git a/lib/thread.cc b/lib/thread.cc index 58d88c2..9e4cb5c 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -132,6 +132,7 @@ _thread_add_matched_message (notmuch_thread_t *thread, notmuch_message_t *message) { time_t date; +notmuch_message_t *hashed_message; date = notmuch_message_get_date (message); @@ -142,6 +143,13 @@ _thread_add_matched_message (notmuch_thread_t *thread, thread->newest = date; thread->matched_messages++; + +if (g_hash_table_lookup_extended (thread->message_hash, + notmuch_message_get_message_id (message), NULL, + (void **) &hashed_message)) { + notmuch_message_set_flag (hashed_message, + NOTMUCH_MSG_FLAG_MATCHING_SEARCH, 1); +} } static void -- 1.6.4.4.2.gc2f148