unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/5] Move to --with-excluded approach to excludes
@ 2012-03-03 13:05 Mark Walters
  2012-03-03 13:05 ` [PATCH 1/5] lib: rename (and negate) set_omit_excluded set_with_excluded Mark Walters
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Mark Walters @ 2012-03-03 13:05 UTC (permalink / raw)
  To: notmuch

This series implements the proposal in id:"87y5riuz7v.fsf@qmul.ac.uk"
to move to a consistent --with-excluded approach rather than the
previous --no-exclude approach. See the message there and its
descendants for discussion.

The main user side change is that notmuch-search no longer defaults to
showing all the excluded threads with [0/n] but will do so if the user
says they want all the messages (i.e., by specifying --with-excluded).

However, it makes everything consistent throughout the commandline and
lib interfaces. In all cases a "message" type search only returns the
non-excluded matches (unless --with-excluded is specified) and a
"thread" type search returns all messages (including excluded ones) in
threads that match in a non-excluded message.

The patch series is bigger than I would like but it is relatively
simple: the slightly tricky logic of the original series is
untouched. This series just changes the names and defaults fed to the
existing logic.

The only slightly complicated part is the notmuch-show.c patch as it
has to decide quite what to do in lots of cases. See
id:"87d38t26wp.fsf@qmul.ac.uk" for reasons for the precise choices
made.

Best wishes

Mark

Mark Walters (5):
  lib: rename (and negate) set_omit_excluded set_with_excluded
  cli: move count to the new --with-excluded naming scheme.
  cli: move search to the new --with-excluded naming scheme.
  cli: move show to the new --with-excluded naming scheme.
  emacs: make show set --with-excluded

 emacs/notmuch-show.el     |    6 ++++--
 lib/notmuch.h             |   12 +++++++-----
 lib/query.cc              |   10 +++++-----
 man/man1/notmuch-count.1  |    4 ++--
 man/man1/notmuch-search.1 |    6 ++++--
 man/man1/notmuch-show.1   |    5 +++--
 notmuch-client.h          |    1 +
 notmuch-count.c           |   11 ++++++-----
 notmuch-search.c          |   20 +++++++++++---------
 notmuch-show.c            |   38 +++++++++++++++++++++-----------------
 test/count                |    4 ++--
 test/search               |    9 ++++-----
 12 files changed, 70 insertions(+), 56 deletions(-)

-- 
1.7.2.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] lib: rename (and negate) set_omit_excluded set_with_excluded
  2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
@ 2012-03-03 13:05 ` Mark Walters
  2012-03-03 13:05 ` [PATCH 2/5] cli: move count to the new --with-excluded naming scheme Mark Walters
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2012-03-03 13:05 UTC (permalink / raw)
  To: notmuch

Rename the function notmuch_query_set_omit_excluded_messages to
notmuch_query_set_with_excluded_messages and negate its meaning.  Note
the suite will not compile currently as the callers of
notmuch_query_set_omit_excluded_messages have not been updated yet.
---
 lib/notmuch.h |   12 +++++++-----
 lib/query.cc  |   10 +++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index babd208..53ec82e 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -449,12 +449,14 @@ typedef enum {
 const char *
 notmuch_query_get_query_string (notmuch_query_t *query);
 
-/* Specify whether to results should omit the excluded results rather
- * than just marking them excluded. This is useful for passing a
- * notmuch_messages_t not containing the excluded messages to other
- * functions. */
+/* Specify whether to results should include the excluded results
+ * (marking them excluded) rather than just omitting them. Note when
+ * calling notmuch_query_search_threads, the returned thread will
+ * contain all messages regardless of this setting but, unless this is
+ * set, only threads matching in a non-excluded message will be
+ * returned. */
 void
-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit);
+notmuch_query_set_with_excluded_messages (notmuch_query_t *query, notmuch_bool_t with_excluded);
 
 /* Specify the sorting desired for this query. */
 void
diff --git a/lib/query.cc b/lib/query.cc
index ab18fbc..cf8dfd0 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -28,7 +28,7 @@ struct _notmuch_query {
     const char *query_string;
     notmuch_sort_t sort;
     notmuch_string_list_t *exclude_terms;
-    notmuch_bool_t omit_excluded_messages;
+    notmuch_bool_t with_excluded;
 };
 
 typedef struct _notmuch_mset_messages {
@@ -86,7 +86,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
 
     query->exclude_terms = _notmuch_string_list_create (query);
 
-    query->omit_excluded_messages = FALSE;
+    query->with_excluded = FALSE;
 
     return query;
 }
@@ -98,9 +98,9 @@ notmuch_query_get_query_string (notmuch_query_t *query)
 }
 
 void
-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit)
+notmuch_query_set_with_excluded_messages (notmuch_query_t *query, notmuch_bool_t with_excluded)
 {
-    query->omit_excluded_messages = omit;
+    query->with_excluded = with_excluded;
 }
 
 void
@@ -216,7 +216,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
 	    exclude_query = Xapian::Query (Xapian::Query::OP_AND,
 					   exclude_query, final_query);
 
-	    if (query->omit_excluded_messages)
+	    if (!query->with_excluded)
 		final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
 					     final_query, exclude_query);
 	    else {
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] cli: move count to the new --with-excluded naming scheme.
  2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
  2012-03-03 13:05 ` [PATCH 1/5] lib: rename (and negate) set_omit_excluded set_with_excluded Mark Walters
@ 2012-03-03 13:05 ` Mark Walters
  2012-03-03 13:05 ` [PATCH 3/5] cli: move search " Mark Walters
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2012-03-03 13:05 UTC (permalink / raw)
  To: notmuch

Rename the option --no-exclude to --with-excluded. Note that this
could be implemented by setting
notmuch_query_set_with_excluded_messages but it is simpler not to set
the exclude tags in the first place (the two methods give identical
output).
---
 man/man1/notmuch-count.1 |    4 ++--
 notmuch-count.c          |   11 ++++++-----
 test/count               |    4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/man/man1/notmuch-count.1 b/man/man1/notmuch-count.1
index 805a8ae..5903074 100644
--- a/man/man1/notmuch-count.1
+++ b/man/man1/notmuch-count.1
@@ -41,9 +41,9 @@ Output the number of matching threads.
 
 .RS 4
 .TP 4
-.BR \-\-no\-exclude
+.BR \-\-with\-excluded
 
-Do not exclude the messages matching search.exclude_tags in the config file.
+Include messages which match search.exclude_tags in the count.
 .RE
 .RE
 .RE
diff --git a/notmuch-count.c b/notmuch-count.c
index 46b76ae..b87cdca 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -35,7 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
     char *query_str;
     int opt_index;
     int output = OUTPUT_MESSAGES;
-    notmuch_bool_t no_exclude = FALSE;
+    notmuch_bool_t with_excluded = FALSE;
     unsigned int i;
 
     notmuch_opt_desc_t options[] = {
@@ -43,7 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 	  (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
 				  { "messages", OUTPUT_MESSAGES },
 				  { 0, 0 } } },
-	{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
+	{ NOTMUCH_OPT_BOOLEAN, &with_excluded, "with-excluded", 'd', 0 },
 	{ 0, 0, 0, 0, 0 }
     };
 
@@ -78,7 +78,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 	return 1;
     }
 
-    if (!no_exclude) {
+    /* If we have --with-excluded we could use
+     * notmuch_query_set_with_excluded, but it is simpler not to set
+     * the exclude tags in the first place */
+    if (!with_excluded) {
 	const char **search_exclude_tags;
 	size_t search_exclude_tags_length;
 
@@ -88,8 +91,6 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 	    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
     }
 
-    notmuch_query_set_omit_excluded_messages (query, TRUE);
-
     switch (output) {
     case OUTPUT_MESSAGES:
 	printf ("%u\n", notmuch_query_count_messages (query));
diff --git a/test/count b/test/count
index 976fff1..f74413b 100755
--- a/test/count
+++ b/test/count
@@ -53,9 +53,9 @@ test_expect_equal \
     "1" \
     "`notmuch count subject:deleted and tag:deleted`"
 
-test_begin_subtest "count \"deleted\" messages, with --no-exclude"
+test_begin_subtest "count \"deleted\" messages, with --with-excluded"
 test_expect_equal \
     "3" \
-    "`notmuch count --no-exclude subject:deleted`"
+    "`notmuch count --with-excluded subject:deleted`"
 
 test_done
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] cli: move search to the new --with-excluded naming scheme.
  2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
  2012-03-03 13:05 ` [PATCH 1/5] lib: rename (and negate) set_omit_excluded set_with_excluded Mark Walters
  2012-03-03 13:05 ` [PATCH 2/5] cli: move count to the new --with-excluded naming scheme Mark Walters
@ 2012-03-03 13:05 ` Mark Walters
  2012-03-03 13:05 ` [PATCH 4/5] cli: move show " Mark Walters
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2012-03-03 13:05 UTC (permalink / raw)
  To: notmuch

This commit replaces the --no-exclude option with a --with-excluded
option. The output is identical in all cases except output-summary. In
this case they output exactly the same thread lines. They differ in
that with the new option the match count (i.e., the x in [x/n] in the
output) is the number of matching non-excluded messages rather than
the number of matching messages.

It also change the behaviour when the --with-excluded option is not
set (for output=summary): it no longer returns threads only matching
in excluded messages. This is neccesary to keep the cli output
uncluttered and for speed reasons.
---
 man/man1/notmuch-search.1 |    6 ++++--
 notmuch-search.c          |   20 +++++++++++---------
 test/search               |    9 ++++-----
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1
index 8426aa3..e46ae68 100644
--- a/man/man1/notmuch-search.1
+++ b/man/man1/notmuch-search.1
@@ -114,9 +114,11 @@ Limit the number of displayed results to N.
 
 .RS 4
 .TP 4
-.BR \-\-no\-exclude
+.BR \-\-with\-excluded
 
-Do not exclude the messages matching search.exclude_tags in the config file.
+Include messages matching search.exclude_tags from the config file in
+the output. Note that, in this case, the summary output shows the
+number of matching non-excluded messages for each thread.
 .RE
 
 .SH SEE ALSO
diff --git a/notmuch-search.c b/notmuch-search.c
index f6061e4..4af19b5 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -210,9 +210,6 @@ do_search_threads (const search_format_t *format,
     int first_thread = 1;
     int i;
 
-    if (output == OUTPUT_THREADS)
-	notmuch_query_set_omit_excluded_messages (query, TRUE);
-
     if (offset < 0) {
 	offset += notmuch_query_count_threads (query);
 	if (offset < 0)
@@ -303,8 +300,6 @@ do_search_messages (const search_format_t *format,
     int first_message = 1;
     int i;
 
-    notmuch_query_set_omit_excluded_messages (query, TRUE);
-
     if (offset < 0) {
 	offset += notmuch_query_count_messages (query);
 	if (offset < 0)
@@ -376,7 +371,6 @@ do_search_tags (notmuch_database_t *notmuch,
     const char *tag;
     int first_tag = 1;
 
-    notmuch_query_set_omit_excluded_messages (query, TRUE);
     /* should the following only special case if no excluded terms
      * specified? */
 
@@ -435,7 +429,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
     output_t output = OUTPUT_SUMMARY;
     int offset = 0;
     int limit = -1; /* unlimited */
-    notmuch_bool_t no_exclude = FALSE;
+    notmuch_bool_t with_excluded = FALSE;
     unsigned int i;
 
     enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
@@ -457,7 +451,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 				  { "files", OUTPUT_FILES },
 				  { "tags", OUTPUT_TAGS },
 				  { 0, 0 } } },
-	{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
+	{ NOTMUCH_OPT_BOOLEAN, &with_excluded, "with-excluded", 'd', 0 },
 	{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
 	{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },
 	{ 0, 0, 0, 0, 0 }
@@ -505,7 +499,13 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 
     notmuch_query_set_sort (query, sort);
 
-    if (!no_exclude) {
+    /* If we have --with-excluded we could use
+     * notmuch_query_set_with_excluded, but it is simpler not to set
+     * the exclude tags in the first place. The one exception is the
+     * summary output where we do need to use
+     * notmuch_query_set_with_excluded as we do want the counts to
+     * reflect the excludes. */
+    if (!with_excluded || output == OUTPUT_SUMMARY) {
 	const char **search_exclude_tags;
 	size_t search_exclude_tags_length;
 
@@ -513,6 +513,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 	    (config, &search_exclude_tags_length);
 	for (i = 0; i < search_exclude_tags_length; i++)
 	    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+	if (output == OUTPUT_SUMMARY && with_excluded)
+	    notmuch_query_set_with_excluded_messages (query, TRUE);
     }
 
     switch (output) {
diff --git a/test/search b/test/search
index 081f60c..6d26f56 100755
--- a/test/search
+++ b/test/search
@@ -136,8 +136,7 @@ generate_message '[subject]="Deleted"'
 notmuch new > /dev/null
 notmuch tag +deleted id:$gen_msg_id
 output=$(notmuch search subject:deleted | notmuch_search_sanitize)
-test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)
-thread:XXX   2001-01-05 [0/1] Notmuch Test Suite; Deleted (deleted inbox unread)"
+test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)"
 
 test_begin_subtest "Exclude \"deleted\" messages from search, overridden"
 output=$(notmuch search subject:deleted and tag:deleted | notmuch_search_sanitize)
@@ -149,10 +148,10 @@ output=$(notmuch search subject:deleted | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)
 thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"
 
-test_begin_subtest "Don't exclude \"deleted\" messages when --no-exclude specified"
-output=$(notmuch search --no-exclude subject:deleted | notmuch_search_sanitize)
+test_begin_subtest "Don't exclude \"deleted\" messages when --with-excluded specified"
+output=$(notmuch search --with-excluded subject:deleted | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)
-thread:XXX   2001-01-05 [2/2] Notmuch Test Suite; Deleted (deleted inbox unread)"
+thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"
 
 test_begin_subtest "Don't exclude \"deleted\" messages from search if not configured"
 notmuch config set search.exclude_tags
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] cli: move show to the new --with-excluded naming scheme.
  2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
                   ` (2 preceding siblings ...)
  2012-03-03 13:05 ` [PATCH 3/5] cli: move search " Mark Walters
@ 2012-03-03 13:05 ` Mark Walters
  2012-03-03 13:05 ` [PATCH 5/5] emacs: make show set --with-excluded Mark Walters
  2012-03-11  1:19 ` [PATCH 0/5] Move to --with-excluded approach to excludes Jameson Graef Rollins
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2012-03-03 13:05 UTC (permalink / raw)
  To: notmuch

This moves show to the --with-excluded naming scheme. When this is set
show returns all threads that match including those that only match in
an excluded message.

When this flag is not set the behaviour depends on whether
--entire-threads is set. If it is not set then show only returns the
messages which match and are not excluded. If it is set then show
returns all messages in these threads.
---
 man/man1/notmuch-show.1 |    5 +++--
 notmuch-client.h        |    1 +
 notmuch-show.c          |   38 +++++++++++++++++++++-----------------
 3 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/man/man1/notmuch-show.1 b/man/man1/notmuch-show.1
index d75d971..0047298 100644
--- a/man/man1/notmuch-show.1
+++ b/man/man1/notmuch-show.1
@@ -130,9 +130,10 @@ content.
 
 .RS 4
 .TP 4
-.B \-\-no-exclude
+.B \-\-with-excluded
 
-Do not exclude the messages matching search.exclude_tags in the config file.
+Include threads that only match in excluded messages (from
+search.exclude_tags in the config file) in the output.
 .RE
 
 A common use of
diff --git a/notmuch-client.h b/notmuch-client.h
index f4a62cc..4d9464c 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -99,6 +99,7 @@ typedef struct notmuch_show_format {
 
 typedef struct notmuch_show_params {
     notmuch_bool_t entire_thread;
+    notmuch_bool_t with_excluded;
     notmuch_bool_t raw;
     int part;
 #ifdef GMIME_ATLEAST_26
diff --git a/notmuch-show.c b/notmuch-show.c
index 05d51b2..f3440ae 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -812,6 +812,7 @@ show_messages (void *ctx,
 {
     notmuch_message_t *message;
     notmuch_bool_t match;
+    notmuch_bool_t excluded;
     int first_set = 1;
     int next_indent;
 
@@ -830,10 +831,11 @@ show_messages (void *ctx,
 	message = notmuch_messages_get (messages);
 
 	match = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH);
+	excluded = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);
 
 	next_indent = indent;
 
-	if (match || params->entire_thread) {
+	if ((match && (!excluded || params->with_excluded)) || params->entire_thread) {
 	    show_message (ctx, format, message, indent, params);
 	    next_indent = indent + 1;
 
@@ -986,7 +988,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
     notmuch_show_params_t params = { .part = -1 };
     int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
     notmuch_bool_t verify = FALSE;
-    notmuch_bool_t no_exclude = FALSE;
+    notmuch_bool_t with_excluded = FALSE;
 
     notmuch_opt_desc_t options[] = {
 	{ NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
@@ -999,7 +1001,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
 	{ NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
-	{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },
+	{ NOTMUCH_OPT_BOOLEAN, &with_excluded, "with-excluded", 'n', 0 },
 	{ 0, 0, 0, 0, 0 }
     };
 
@@ -1088,25 +1090,27 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
 	return 1;
     }
 
-    /* if format=mbox then we can not output excluded messages as
-     * there is no way to make the exclude flag available */
-    if (format_sel == NOTMUCH_FORMAT_MBOX)
-	notmuch_query_set_omit_excluded_messages (query, TRUE);
-
     /* If a single message is requested we do not use search_excludes. */
     if (params.part >= 0)
 	ret = do_show_single (ctx, query, format, &params);
     else {
-	if (!no_exclude) {
-	    const char **search_exclude_tags;
-	    size_t search_exclude_tags_length;
-	    unsigned int i;
-
-	    search_exclude_tags = notmuch_config_get_search_exclude_tags
-		(config, &search_exclude_tags_length);
-	    for (i = 0; i < search_exclude_tags_length; i++)
-		notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+	/* We always set the exclude tags: in the case --with-excluded
+	 * we apply notmuch_query_set_with_excluded to the query to
+	 * get all the results (but they will still be marked
+	 * excluded */
+	const char **search_exclude_tags;
+	size_t search_exclude_tags_length;
+	unsigned int i;
+
+	search_exclude_tags = notmuch_config_get_search_exclude_tags
+	    (config, &search_exclude_tags_length);
+	for (i = 0; i < search_exclude_tags_length; i++)
+	    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+	if (with_excluded) {
+	    notmuch_query_set_with_excluded_messages(query, TRUE);
+	    params.with_excluded = TRUE;
 	}
+
 	ret = do_show (ctx, query, format, &params);
     }
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] emacs: make show set --with-excluded
  2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
                   ` (3 preceding siblings ...)
  2012-03-03 13:05 ` [PATCH 4/5] cli: move show " Mark Walters
@ 2012-03-03 13:05 ` Mark Walters
  2012-03-11  1:19 ` [PATCH 0/5] Move to --with-excluded approach to excludes Jameson Graef Rollins
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2012-03-03 13:05 UTC (permalink / raw)
  To: notmuch

Show has to set --with-excluded to deal with cases where it is asked
to show a single excluded message. It use JSON so it can easily pass
the exclude information to the user.
---
 emacs/notmuch-show.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4a60631..39c5713 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1099,13 +1099,15 @@ function is used."
 		       (append (list "\'") basic-args
 			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'")))))
-	(notmuch-show-insert-forest (notmuch-query-get-threads args))
+	(notmuch-show-insert-forest (notmuch-query-get-threads
+				     (append (list "--with-excluded") args)))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
 	(when (and (eq (buffer-size) 0)
 		   notmuch-show-query-context)
 	  (notmuch-show-insert-forest
-	   (notmuch-query-get-threads basic-args))))
+	   (notmuch-query-get-threads
+	    (append (list "--with-excluded") basic-args)))))
 
       (jit-lock-register #'notmuch-show-buttonise-links)
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] Move to --with-excluded approach to excludes
  2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
                   ` (4 preceding siblings ...)
  2012-03-03 13:05 ` [PATCH 5/5] emacs: make show set --with-excluded Mark Walters
@ 2012-03-11  1:19 ` Jameson Graef Rollins
  5 siblings, 0 replies; 7+ messages in thread
From: Jameson Graef Rollins @ 2012-03-11  1:19 UTC (permalink / raw)
  To: Mark Walters, notmuch

[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]

On Sat,  3 Mar 2012 13:05:13 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> This series implements the proposal in id:"87y5riuz7v.fsf@qmul.ac.uk"
> to move to a consistent --with-excluded approach rather than the
> previous --no-exclude approach. See the message there and its
> descendants for discussion.
> 
> The main user side change is that notmuch-search no longer defaults to
> showing all the excluded threads with [0/n] but will do so if the user
> says they want all the messages (i.e., by specifying --with-excluded).
> 
> However, it makes everything consistent throughout the commandline and
> lib interfaces. In all cases a "message" type search only returns the
> non-excluded matches (unless --with-excluded is specified) and a
> "thread" type search returns all messages (including excluded ones) in
> threads that match in a non-excluded message.

Hi, Mark.  Thanks so much for working on this.  This new solution seems
like a good one.  It keeps the default as expected (excluded are
actually excluded from all output), and the with-excluded option behaves
intuitively.  Looks good to me.

Unfortunately, as I discussed with you on irc today, there seems to be a
problem with the patch series that is preventing it from working as
expected.  The outputs of the following commands should agree, which
they do:

servo:~/src/notmuch/git [master] 0$ ./notmuch count --with-excluded tag:inbox
51171
servo:~/src/notmuch/git [master] 0$ ./notmuch search --output=messages --with-excluded tag:inbox | wc -l
51171
servo:~/src/notmuch/git [master] 0$ 

However, they should also agree in this case, which they don't:

servo:~/src/notmuch/git [master] 0$ ./notmuch count tag:inbox
115
servo:~/src/notmuch/git [master] 0$ ./notmuch search --output=messages tag:inbox | wc -l
51169
servo:~/src/notmuch/git [master] 0$ 

In this last case, notmuch search is outputting (some but not all(!))
excluded messages when it shouldn't be.  However, if I use a more
complicated search term, everything seems to be working fine:

servo:~/src/notmuch/git [master] 0$ ./notmuch count tag:inbox and tag:unread
0
servo:~/src/notmuch/git [master] 0$ ./notmuch search --output=messages tag:inbox and tag:unread | wc -l
0
servo:~/src/notmuch/git [master] 0$ ./notmuch count --with-excluded tag:inbox and tag:unread
47245
servo:~/src/notmuch/git [master] 0$ ./notmuch search --output=messages --with-excluded tag:inbox and tag:unread | wc -l
47245
servo:~/src/notmuch/git [master] 0$ 

It also works if I give a single "from:" search term instead of a single
"tag:" search term.  So it appears to be something about how the
excluded query is constructed.

I can't figure out where the problem is, although I'm still looking.  If
anyone else can figure it out, please let us know.

I would really like to get this series applied so that I can get back to
following master!

Thanks again for all the work.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-11  1:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-03 13:05 [PATCH 0/5] Move to --with-excluded approach to excludes Mark Walters
2012-03-03 13:05 ` [PATCH 1/5] lib: rename (and negate) set_omit_excluded set_with_excluded Mark Walters
2012-03-03 13:05 ` [PATCH 2/5] cli: move count to the new --with-excluded naming scheme Mark Walters
2012-03-03 13:05 ` [PATCH 3/5] cli: move search " Mark Walters
2012-03-03 13:05 ` [PATCH 4/5] cli: move show " Mark Walters
2012-03-03 13:05 ` [PATCH 5/5] emacs: make show set --with-excluded Mark Walters
2012-03-11  1:19 ` [PATCH 0/5] Move to --with-excluded approach to excludes Jameson Graef Rollins

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).