Re: [PATCH v2 3/3] search: Support automatic tag exclusions

Subject: Re: [PATCH v2 3/3] search: Support automatic tag exclusions

Date: Tue, 17 Jan 2012 15:32:11 -0500

To: David Edmondson

Cc: notmuch@notmuchmail.org, Jeremy Nickurak

From: Austin Clements


Quoth David Edmondson on Jan 17 at  9:08 am:
> On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak <jeremy@nickurak.ca> wrote:
> > On Mon, Jan 16, 2012 at 12:28, Austin Clements <amdragon@mit.edu> wrote:
> > >> Having "deleted" and "spam" as default settings in the configuration
> > >> file might be more reasonable.
> > 
> > If I read correctly:
> > 
> > 1) If no exclude options are in the config file, none should be used.
> 
> Yes.
> 
> > 2) On notmuch setup, "deleted" and "spam" should be added to .notmuch-config
> 
> I might argue between 'should' and 'could', but the sense is correct.

Oh, I think I see.  I don't know if I can do precisely that, since the
config code doesn't know if it's being called from setup, but is
something like this essentially what you're suggesting?

    if (notmuch_config_get_auto_exclude_tags (config, &tmp) == NULL) {
        if (is_new) {
            const char *tags[] = { "deleted", "spam" };
            notmuch_config_set_auto_exclude_tags (config, tags, 2);
        } else {
            notmuch_config_set_auto_exclude_tags (config, NULL, 0);
        }
    }

(where is_new is TRUE if this is a brand-new config file)

Thread: