[PATCH] Automatically exclude tags in notmuch-show

Austin Clements amdragon at MIT.EDU
Thu Jan 19 14:59:10 PST 2012


LGTM, but should definitely come with a test.

Also, this won't commute with Pieter's patch
(id:"1327000744-25463-2-git-send-email-pieter at praet.org"), so one or
the other will have to get updated.

Quoth Mark Walters on Jan 19 at 10:03 pm:
> Add the use of auto_exclude_tags in notmuch-show.c.  As with Austin's
> patch (commit 42a907992823030f070fc395a174f779998ca6f5) it just adds
> the excluded tags to the query so the excluded messages will still
> appear in the emacs interface, but as a single header line rather than
> as a matching message.
> ---
>  notmuch-show.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/notmuch-show.c b/notmuch-show.c
> index d14dac9..925dfd6 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -948,9 +948,12 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
>      char *opt;
>      const notmuch_show_format_t *format = &format_text;
>      notmuch_show_params_t params;
> +    const char **auto_exclude_tags;
> +    size_t auto_exclude_tags_length;
>      int mbox = 0;
>      int format_specified = 0;
>      int i;
> +    unsigned int j;

Hah.  The original patch series updated 'count' to use the new
argument parsing solely so I could steal 'i' for the tag exclude code.

>  
>      params.entire_thread = 0;
>      params.raw = 0;
> @@ -1040,6 +1043,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
>  	return 1;
>      }
>  
> +    auto_exclude_tags = notmuch_config_get_auto_exclude_tags
> +        (config, &auto_exclude_tags_length);
> +    for (j = 0; j < auto_exclude_tags_length; j++)
> +        notmuch_query_add_tag_exclude (query, auto_exclude_tags[j]);
> +
>      /* if part was requested and format was not specified, use format=raw */
>      if (params.part >= 0 && !format_specified)
>  	format = &format_raw;


More information about the notmuch mailing list