summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
785c1e4)
This commit replaces the --no-exclude option with a
--exclude=(true|false|flag) option. The default is to omit the
excluded messages.
The flag option only makes sense if output=summary (as otherwise there
is nowhere to print the flag). In summary output exclude=false and
exclude=flag give almost identical output:
they differ in that with the exclude=flag 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.
Note this changes the default for output=summary when no --exclude=
option is given: it used to default to flag and now defaults to true
(i.e. omit excluded messages). This is neccesary to keep the cli
output uncluttered and for speed reasons.
-.BR \-\-no\-exclude
-
-Do not exclude the messages matching search.exclude_tags in the config file.
+.BR \-\-exclude=(true|false|flag)
+
+Specify whether to omit messages matching search.tag_exclude from the
+search results (the default) or not. The extra option
+.B flag
+only has an effect when
+.B --output=summary
+In this case all matching threads are returned but the "match count"
+is the number of matching non-excluded messages in the thread.
int first_thread = 1;
int i;
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)
if (offset < 0) {
offset += notmuch_query_count_threads (query);
if (offset < 0)
int first_message = 1;
int i;
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)
if (offset < 0) {
offset += notmuch_query_count_messages (query);
if (offset < 0)
const char *tag;
int first_tag = 1;
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? */
/* should the following only special case if no excluded terms
* specified? */
+enum {
+ EXCLUDE_TRUE,
+ EXCLUDE_FALSE,
+ EXCLUDE_FLAG,
+};
+
int
notmuch_search_command (void *ctx, int argc, char *argv[])
{
int
notmuch_search_command (void *ctx, int argc, char *argv[])
{
output_t output = OUTPUT_SUMMARY;
int offset = 0;
int limit = -1; /* unlimited */
output_t output = OUTPUT_SUMMARY;
int offset = 0;
int limit = -1; /* unlimited */
- notmuch_bool_t no_exclude = FALSE;
+ int exclude = EXCLUDE_TRUE;
unsigned int i;
enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
unsigned int i;
enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
{ "files", OUTPUT_FILES },
{ "tags", OUTPUT_TAGS },
{ 0, 0 } } },
{ "files", OUTPUT_FILES },
{ "tags", OUTPUT_TAGS },
{ 0, 0 } } },
- { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
+ { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',
+ (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
+ { "false", EXCLUDE_FALSE },
+ { "flag", EXCLUDE_FLAG },
+ { 0, 0 } } },
{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
{ 0, 0, 0, 0, 0 }
{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
{ 0, 0, 0, 0, 0 }
notmuch_query_set_sort (query, sort);
notmuch_query_set_sort (query, sort);
+ if (exclude == EXCLUDE_FLAG && output != OUTPUT_SUMMARY) {
+ /* If we are not doing summary output there is nowhere to
+ * print the excluded flag so fall back on including the
+ * excluded messages. */
+ fprintf (stderr, "Warning: this output format cannot flag excluded messages.\n");
+ exclude = EXCLUDE_FALSE;
+ }
+
+ if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {
const char **search_exclude_tags;
size_t search_exclude_tags_length;
const char **search_exclude_tags;
size_t search_exclude_tags_length;
(config, &search_exclude_tags_length);
for (i = 0; i < search_exclude_tags_length; i++)
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
(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 (exclude == EXCLUDE_FLAG)
+ notmuch_query_set_omit_excluded (query, FALSE);