static void apply_exclude_tags(notmuch_query_t *query)
{
- if (NotmuchExcludeTags) {
- char *buf = safe_strdup(NotmuchExcludeTags);
- char *p, *tag = NULL, *end = NULL;
+ char *buf, *p, *end = NULL, *tag = NULL;
- for (p = buf; p && *p; p++) {
- if (!tag && isspace(*p))
- continue;
- if (!tag)
- tag = p; /* begin of the tag */
- if (*p == ',' || *p == ' ')
- end = p; /* terminate the tag */
- else if (*(p + 1) == '\0')
- end = p + 1; /* end of optstr */
- if (!tag || !end)
- continue;
- if (tag >= end)
- break;
- *end = '\0';
+ if (!NotmuchExcludeTags || !*NotmuchExcludeTags)
+ return;
+ buf = safe_strdup(NotmuchExcludeTags);
- dprint(2, (debugfile, "nm: query explude tag '%s'\n", tag));
- notmuch_query_add_tag_exclude(query, tag);
- end = tag = NULL;
- }
- FREE(&buf);
+ for (p = buf; p && *p; p++) {
+ if (!tag && isspace(*p))
+ continue;
+ if (!tag)
+ tag = p; /* begin of the tag */
+ if (*p == ',' || *p == ' ')
+ end = p; /* terminate the tag */
+ else if (*(p + 1) == '\0')
+ end = p + 1; /* end of optstr */
+ if (!tag || !end)
+ continue;
+ if (tag >= end)
+ break;
+ *end = '\0';
+
+ dprint(2, (debugfile, "nm: query exclude tag '%s'\n", tag));
+ notmuch_query_add_tag_exclude(query, tag);
+ end = tag = NULL;
}
+ notmuch_query_set_omit_excluded(query, 1);
+ FREE(&buf);
}
static notmuch_query_t *get_query(struct nm_ctxdata *data, int writable)
int type = get_query_type(data);
char msgbuf[STRING];
+ dprint(1, (debugfile, "nm: reading messages... [newcount=%d]\n",
+ notmuch_query_count_messages(q)));
+
if (!ctx->quiet) {
unsigned ct = notmuch_query_count_messages(q);
FREE(&qstr);
if (!q)
goto done;
+ apply_exclude_tags(q);
notmuch_query_set_sort(q, NOTMUCH_SORT_NEWEST_FIRST);
ct = notmuch_query_count_messages(q);