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

2012-01-18 Thread Jameson Graef Rollins
On Wed, 18 Jan 2012 09:52:52 +, David Edmondson  wrote:
> I agree that as long as no keys are pre-bound it will make little
> difference. That just transfers the discussion to the thread about
> adding the bindings, which seems silly.

I think that's ok.  The tag exclusion is in, which is great.  The
next question, of whether we should setup excludes by default, is
intimately related to whether or not we support key bindings to add
those tags.  So I think it's fine to transfer the rest of this
discussion to that thread.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



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

2012-01-18 Thread David Edmondson
On Wed, 18 Jan 2012 00:52:09 -0800, Jameson Graef Rollins  wrote:
> On Wed, 18 Jan 2012 08:38:23 +, David Edmondson  wrote:
> > Something must create the initial configuration file if none exists. I'd
> > be okay with that code adding 'deleted' and 'spam' to the excluded list.
> >
> > This would mean that an existing user would see no change without taking
> > some action (adding the tags to the configuration file) and a new user
> > would see the new behaviour (automatic exclusion).
> 
> What you describe is indeed how it currently works.  For new users or
> old users who rerun setup, the config file will automatically include
> the exclusions.  Otherwise, users will see no change.

Good, thanks.

> > I'm not completely sure that automatically adding the exclusion of the
> > specified tags via the configuration file for new users is a great
> > idea. It seems as though it will lead to confusion for someone at some
> > point.
> 
> Without any keys pre-bound to add "deleted" or "spam" tags, it probably
> won't make much difference for new users.  And as long as it's
> documented, users will be warned of the behavior.  Reading the config
> file would also make it clear how the variable changes behavior.

I agree that as long as no keys are pre-bound it will make little
difference. That just transfers the discussion to the thread about
adding the bindings, which seems silly.

Anyway, I'm not too worried - I just won't answer any of the questions
about it on the list :-)
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



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

2012-01-18 Thread David Edmondson
On Tue, 17 Jan 2012 15:32:11 -0500, Austin Clements  wrote:
> Quoth David Edmondson on Jan 17 at  9:08 am:
> > On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak  
> > wrote:
> > > On Mon, Jan 16, 2012 at 12:28, Austin Clements  
> > > 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, ) == 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)

I'm not sure, as I haven't looked at the configuration code at
all, sorry.

Something must create the initial configuration file if none exists. I'd
be okay with that code adding 'deleted' and 'spam' to the excluded list.

This would mean that an existing user would see no change without taking
some action (adding the tags to the configuration file) and a new user
would see the new behaviour (automatic exclusion).

I'm not completely sure that automatically adding the exclusion of the
specified tags via the configuration file for new users is a great
idea. It seems as though it will lead to confusion for someone at some
point.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



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

2012-01-18 Thread Jameson Graef Rollins
On Wed, 18 Jan 2012 08:38:23 +, David Edmondson  wrote:
> Something must create the initial configuration file if none exists. I'd
> be okay with that code adding 'deleted' and 'spam' to the excluded list.
>
> This would mean that an existing user would see no change without taking
> some action (adding the tags to the configuration file) and a new user
> would see the new behaviour (automatic exclusion).

What you describe is indeed how it currently works.  For new users or
old users who rerun setup, the config file will automatically include
the exclusions.  Otherwise, users will see no change.

> I'm not completely sure that automatically adding the exclusion of the
> specified tags via the configuration file for new users is a great
> idea. It seems as though it will lead to confusion for someone at some
> point.

Without any keys pre-bound to add "deleted" or "spam" tags, it probably
won't make much difference for new users.  And as long as it's
documented, users will be warned of the behavior.  Reading the config
file would also make it clear how the variable changes behavior.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



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

2012-01-18 Thread David Edmondson
On Tue, 17 Jan 2012 15:32:11 -0500, Austin Clements amdra...@mit.edu wrote:
 Quoth David Edmondson on Jan 17 at  9:08 am:
  On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak jer...@nickurak.ca 
  wrote:
   On Mon, Jan 16, 2012 at 12:28, Austin Clements amdra...@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)

I'm not sure, as I haven't looked at the configuration code at
all, sorry.

Something must create the initial configuration file if none exists. I'd
be okay with that code adding 'deleted' and 'spam' to the excluded list.

This would mean that an existing user would see no change without taking
some action (adding the tags to the configuration file) and a new user
would see the new behaviour (automatic exclusion).

I'm not completely sure that automatically adding the exclusion of the
specified tags via the configuration file for new users is a great
idea. It seems as though it will lead to confusion for someone at some
point.


pgplDqY6w09FW.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-18 Thread Jameson Graef Rollins
On Wed, 18 Jan 2012 08:38:23 +, David Edmondson d...@dme.org wrote:
 Something must create the initial configuration file if none exists. I'd
 be okay with that code adding 'deleted' and 'spam' to the excluded list.

 This would mean that an existing user would see no change without taking
 some action (adding the tags to the configuration file) and a new user
 would see the new behaviour (automatic exclusion).

What you describe is indeed how it currently works.  For new users or
old users who rerun setup, the config file will automatically include
the exclusions.  Otherwise, users will see no change.

 I'm not completely sure that automatically adding the exclusion of the
 specified tags via the configuration file for new users is a great
 idea. It seems as though it will lead to confusion for someone at some
 point.

Without any keys pre-bound to add deleted or spam tags, it probably
won't make much difference for new users.  And as long as it's
documented, users will be warned of the behavior.  Reading the config
file would also make it clear how the variable changes behavior.

jamie.


pgpD4puN5LjZv.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-18 Thread Jameson Graef Rollins
On Wed, 18 Jan 2012 09:52:52 +, David Edmondson d...@dme.org wrote:
 I agree that as long as no keys are pre-bound it will make little
 difference. That just transfers the discussion to the thread about
 adding the bindings, which seems silly.

I think that's ok.  The tag exclusion is in, which is great.  The
next question, of whether we should setup excludes by default, is
intimately related to whether or not we support key bindings to add
those tags.  So I think it's fine to transfer the rest of this
discussion to that thread.

jamie.


pgpK5K6CYOuF2.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-17 Thread Austin Clements
Quoth David Edmondson on Jan 17 at  9:08 am:
> On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak  
> wrote:
> > On Mon, Jan 16, 2012 at 12:28, Austin Clements  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, ) == 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)


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

2012-01-17 Thread David Edmondson
On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak  
wrote:
> On Mon, Jan 16, 2012 at 12:28, Austin Clements  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.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



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

2012-01-17 Thread David Edmondson
On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak jer...@nickurak.ca wrote:
 On Mon, Jan 16, 2012 at 12:28, Austin Clements amdra...@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.


pgpXF86rF8kzR.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-17 Thread Austin Clements
Quoth David Edmondson on Jan 17 at  9:08 am:
 On Mon, 16 Jan 2012 15:16:24 -0700, Jeremy Nickurak jer...@nickurak.ca 
 wrote:
  On Mon, Jan 16, 2012 at 12:28, Austin Clements amdra...@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)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-16 Thread Jeremy Nickurak
On Mon, Jan 16, 2012 at 12:28, Austin Clements  wrote:
> Quoth David Edmondson on Jan 16 at ?9:12 am:
>> Having "deleted" and "spam" as default settings in the configuration
>> file might be more reasonable.
>
> Sorry, I'm confused. ?Are you saying deleted;spam should or should not
> be the default?

If I read correctly:

1) If no exclude options are in the config file, none should be used.
2) On notmuch setup, "deleted" and "spam" should be added to .notmuch-config


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

2012-01-16 Thread Austin Clements
Quoth David Edmondson on Jan 16 at  9:12 am:
> On Sat, 14 Jan 2012 15:40:26 -0800, Jameson Graef Rollins  finestructure.net> wrote:
> > This patch looks fine.  Philosophical UI discussion to follow:
> > 
> > On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements  
> > wrote:
> > > +if (notmuch_config_get_auto_exclude_tags (config, ) == NULL) {
> > > + const char *tags[] = { "deleted", "spam" };
> > > + notmuch_config_set_auto_exclude_tags (config, tags, 2);
> > > +}
> > 
> > This creates the config section with the exclude list pre-set to
> > "deleted;spam".
> 
> I don't think that anything should be excluded from the search results
> by default, at least not as a default behaviour of the 'notmuch'
> binary.
> 
> Having "deleted" and "spam" as default settings in the configuration
> file might be more reasonable.

Sorry, I'm confused.  Are you saying deleted;spam should or should not
be the default?


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

2012-01-16 Thread Jameson Graef Rollins
On Mon, 16 Jan 2012 15:18:18 -0700, Jeremy Nickurak  wrote:
> 1) If no exclude options are in the config file, none should be used.
> 2) On notmuch setup, "deleted" and "spam" should be added to .notmuch-config

That's correct.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



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

2012-01-16 Thread Jameson Graef Rollins
On Mon, 16 Jan 2012 09:12:38 +, David Edmondson  wrote:
> I don't think that anything should be excluded from the search results
> by default, at least not as a default behaviour of the 'notmuch'
> binary.
> 
> Having "deleted" and "spam" as default settings in the configuration
> file might be more reasonable.

Yes, I agree completely.  The CLI does not, and should not, exclude
anything by default.  I only meant that the patch adds the configuration
variable by default, which seems ok to me.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



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

2012-01-16 Thread David Edmondson
On Sat, 14 Jan 2012 15:40:26 -0800, Jameson Graef Rollins  wrote:
> This patch looks fine.  Philosophical UI discussion to follow:
> 
> On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements  
> wrote:
> > +if (notmuch_config_get_auto_exclude_tags (config, ) == NULL) {
> > +   const char *tags[] = { "deleted", "spam" };
> > +   notmuch_config_set_auto_exclude_tags (config, tags, 2);
> > +}
> 
> This creates the config section with the exclude list pre-set to
> "deleted;spam".

I don't think that anything should be excluded from the search results
by default, at least not as a default behaviour of the 'notmuch'
binary.

Having "deleted" and "spam" as default settings in the configuration
file might be more reasonable.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



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

2012-01-16 Thread David Edmondson
On Sat, 14 Jan 2012 15:40:26 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 This patch looks fine.  Philosophical UI discussion to follow:
 
 On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements amdra...@mit.edu wrote:
  +if (notmuch_config_get_auto_exclude_tags (config, tmp) == NULL) {
  +   const char *tags[] = { deleted, spam };
  +   notmuch_config_set_auto_exclude_tags (config, tags, 2);
  +}
 
 This creates the config section with the exclude list pre-set to
 deleted;spam.

I don't think that anything should be excluded from the search results
by default, at least not as a default behaviour of the 'notmuch'
binary.

Having deleted and spam as default settings in the configuration
file might be more reasonable.


pgp5X2SHvJa26.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-16 Thread Austin Clements
Quoth David Edmondson on Jan 16 at  9:12 am:
 On Sat, 14 Jan 2012 15:40:26 -0800, Jameson Graef Rollins 
 jroll...@finestructure.net wrote:
  This patch looks fine.  Philosophical UI discussion to follow:
  
  On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements amdra...@mit.edu 
  wrote:
   +if (notmuch_config_get_auto_exclude_tags (config, tmp) == NULL) {
   + const char *tags[] = { deleted, spam };
   + notmuch_config_set_auto_exclude_tags (config, tags, 2);
   +}
  
  This creates the config section with the exclude list pre-set to
  deleted;spam.
 
 I don't think that anything should be excluded from the search results
 by default, at least not as a default behaviour of the 'notmuch'
 binary.
 
 Having deleted and spam as default settings in the configuration
 file might be more reasonable.

Sorry, I'm confused.  Are you saying deleted;spam should or should not
be the default?
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-16 Thread Jeremy Nickurak
On Mon, Jan 16, 2012 at 12:28, Austin Clements amdra...@mit.edu wrote:
 Quoth David Edmondson on Jan 16 at  9:12 am:
 Having deleted and spam as default settings in the configuration
 file might be more reasonable.

 Sorry, I'm confused.  Are you saying deleted;spam should or should not
 be the default?

If I read correctly:

1) If no exclude options are in the config file, none should be used.
2) On notmuch setup, deleted and spam should be added to .notmuch-config
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-16 Thread Jameson Graef Rollins
On Mon, 16 Jan 2012 15:18:18 -0700, Jeremy Nickurak not-m...@trk.nickurak.ca 
wrote:
 1) If no exclude options are in the config file, none should be used.
 2) On notmuch setup, deleted and spam should be added to .notmuch-config

That's correct.

jamie.


pgpte3TFLdDYd.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-14 Thread Austin Clements
Quoth Jameson Graef Rollins on Jan 14 at  3:40 pm:
> This patch looks fine.  Philosophical UI discussion to follow:
> 
> On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements  
> wrote:
> > +if (notmuch_config_get_auto_exclude_tags (config, ) == NULL) {
> > +   const char *tags[] = { "deleted", "spam" };
> > +   notmuch_config_set_auto_exclude_tags (config, tags, 2);
> > +}
> 
> This creates the config section with the exclude list pre-set to
> "deleted;spam".  I personally have no problem with this, since I was
> going to be setting exactly that anyway.  However, assuming we decide to
> have this be the default in the CLI, should we therefore add support for
> it in the emacs UI?  I've been going back and forth on this (as readers
> are well aware), and have most recently rejected the idea that we should
> add delete support to the emacs UI.  However, if we are excluding
> "deleted" tags by default, then I'm going to go back and say that we
> should include the keybindings to "delete" messages.  Comments?

It's not that Emacs doesn't support the deleted tag.  You can always
+deleted, and this even seems like a pretty natural thing to do.
To me, the question is whether there should be a shortcut to do this.
I'm probably not one to answer this, since I don't plan to use the
deleted tag and hence using this binding would only ever be an
accident (though I will use the spam tag and I don't think I need a
binding for that; perhaps I would feel differently if my spam filters
were less effective).

> If people think we should exclude "deleted;spam" by default, and agree
> that we should also add delete support in the emacs UI, I'll go ahead
> and rework my keybinding patches.
> 
> jamie.


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

2012-01-14 Thread Jameson Graef Rollins
This patch looks fine.  Philosophical UI discussion to follow:

On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements  wrote:
> +if (notmuch_config_get_auto_exclude_tags (config, ) == NULL) {
> + const char *tags[] = { "deleted", "spam" };
> + notmuch_config_set_auto_exclude_tags (config, tags, 2);
> +}

This creates the config section with the exclude list pre-set to
"deleted;spam".  I personally have no problem with this, since I was
going to be setting exactly that anyway.  However, assuming we decide to
have this be the default in the CLI, should we therefore add support for
it in the emacs UI?  I've been going back and forth on this (as readers
are well aware), and have most recently rejected the idea that we should
add delete support to the emacs UI.  However, if we are excluding
"deleted" tags by default, then I'm going to go back and say that we
should include the keybindings to "delete" messages.  Comments?

If people think we should exclude "deleted;spam" by default, and agree
that we should also add delete support in the emacs UI, I'll go ahead
and rework my keybinding patches.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



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

2012-01-14 Thread Jameson Graef Rollins
This patch looks fine.  Philosophical UI discussion to follow:

On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements amdra...@mit.edu wrote:
 +if (notmuch_config_get_auto_exclude_tags (config, tmp) == NULL) {
 + const char *tags[] = { deleted, spam };
 + notmuch_config_set_auto_exclude_tags (config, tags, 2);
 +}

This creates the config section with the exclude list pre-set to
deleted;spam.  I personally have no problem with this, since I was
going to be setting exactly that anyway.  However, assuming we decide to
have this be the default in the CLI, should we therefore add support for
it in the emacs UI?  I've been going back and forth on this (as readers
are well aware), and have most recently rejected the idea that we should
add delete support to the emacs UI.  However, if we are excluding
deleted tags by default, then I'm going to go back and say that we
should include the keybindings to delete messages.  Comments?

If people think we should exclude deleted;spam by default, and agree
that we should also add delete support in the emacs UI, I'll go ahead
and rework my keybinding patches.

jamie.


pgpA1c3533uq5.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-14 Thread Austin Clements
Quoth Jameson Graef Rollins on Jan 14 at  3:40 pm:
 This patch looks fine.  Philosophical UI discussion to follow:
 
 On Fri, 13 Jan 2012 18:07:04 -0500, Austin Clements amdra...@mit.edu wrote:
  +if (notmuch_config_get_auto_exclude_tags (config, tmp) == NULL) {
  +   const char *tags[] = { deleted, spam };
  +   notmuch_config_set_auto_exclude_tags (config, tags, 2);
  +}
 
 This creates the config section with the exclude list pre-set to
 deleted;spam.  I personally have no problem with this, since I was
 going to be setting exactly that anyway.  However, assuming we decide to
 have this be the default in the CLI, should we therefore add support for
 it in the emacs UI?  I've been going back and forth on this (as readers
 are well aware), and have most recently rejected the idea that we should
 add delete support to the emacs UI.  However, if we are excluding
 deleted tags by default, then I'm going to go back and say that we
 should include the keybindings to delete messages.  Comments?

It's not that Emacs doesn't support the deleted tag.  You can always
+deletedRET, and this even seems like a pretty natural thing to do.
To me, the question is whether there should be a shortcut to do this.
I'm probably not one to answer this, since I don't plan to use the
deleted tag and hence using this binding would only ever be an
accident (though I will use the spam tag and I don't think I need a
binding for that; perhaps I would feel differently if my spam filters
were less effective).

 If people think we should exclude deleted;spam by default, and agree
 that we should also add delete support in the emacs UI, I'll go ahead
 and rework my keybinding patches.
 
 jamie.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-13 Thread Austin Clements
This adds a "search" section to the config file and an
"auto_tag_exclusions" setting in that section.  The search and count
commands pass tag tags from the configuration to the library.
---
 notmuch-client.h |8 
 notmuch-config.c |   42 ++
 notmuch-count.c  |8 
 notmuch-search.c |8 
 test/search  |   18 ++
 5 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 517c010..62ede28 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -235,6 +235,14 @@ void
 notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
  notmuch_bool_t synchronize_flags);

+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t 
*length);
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length);
+
 int
 notmuch_run_hook (const char *db_path, const char *hook);

diff --git a/notmuch-config.c b/notmuch-config.c
index d697138..3d4d5b9 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -84,6 +84,15 @@ static const char maildir_config_comment[] =
 "\tand update tags, while the \"notmuch tag\" and \"notmuch restore\"\n"
 "\tcommands will notice tag changes and update flags in filenames\n";

+static const char search_config_comment[] =
+" Search configuration\n"
+"\n"
+" The following option is supported here:\n"
+"\n"
+"\tauto_exclude_tags  A ;-separated list of tags that will be\n"
+"\t excluded from search results by default.  Using an excluded tag\n"
+"\t in a query will override that exclusion.\n";
+
 struct _notmuch_config {
 char *filename;
 GKeyFile *key_file;
@@ -96,6 +105,8 @@ struct _notmuch_config {
 const char **new_tags;
 size_t new_tags_length;
 notmuch_bool_t maildir_synchronize_flags;
+const char **auto_exclude_tags;
+size_t auto_exclude_tags_length;
 };

 static int
@@ -221,6 +232,7 @@ notmuch_config_open (void *ctx,
 int file_had_new_group;
 int file_had_user_group;
 int file_had_maildir_group;
+int file_had_search_group;

 if (is_new_ret)
*is_new_ret = 0;
@@ -252,6 +264,8 @@ notmuch_config_open (void *ctx,
 config->new_tags = NULL;
 config->new_tags_length = 0;
 config->maildir_synchronize_flags = TRUE;
+config->auto_exclude_tags = NULL;
+config->auto_exclude_tags_length = 0;

 if (! g_key_file_load_from_file (config->key_file,
 config->filename,
@@ -295,6 +309,7 @@ notmuch_config_open (void *ctx,
 file_had_new_group = g_key_file_has_group (config->key_file, "new");
 file_had_user_group = g_key_file_has_group (config->key_file, "user");
 file_had_maildir_group = g_key_file_has_group (config->key_file, 
"maildir");
+file_had_search_group = g_key_file_has_group (config->key_file, "search");


 if (notmuch_config_get_database_path (config) == NULL) {
@@ -345,6 +360,11 @@ notmuch_config_open (void *ctx,
notmuch_config_set_new_tags (config, tags, 2);
 }

+if (notmuch_config_get_auto_exclude_tags (config, ) == NULL) {
+   const char *tags[] = { "deleted", "spam" };
+   notmuch_config_set_auto_exclude_tags (config, tags, 2);
+}
+
 error = NULL;
 config->maildir_synchronize_flags =
g_key_file_get_boolean (config->key_file,
@@ -387,6 +407,11 @@ notmuch_config_open (void *ctx,
maildir_config_comment, NULL);
 }

+if (! file_had_search_group) {
+   g_key_file_set_comment (config->key_file, "search", NULL,
+   search_config_comment, NULL);
+}
+
 if (is_new_ret)
*is_new_ret = is_new;

@@ -597,6 +622,23 @@ notmuch_config_set_new_tags (notmuch_config_t *config,
 &(config->new_tags));
 }

+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t *length)
+{
+return _config_get_list (config, "search", "auto_exclude_tags",
+&(config->auto_exclude_tags),
+&(config->auto_exclude_tags_length), length);
+}
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length)
+{
+_config_set_list (config, "search", "auto_exclude_tags", list, length,
+ &(config->auto_exclude_tags));
+}
+
 /* Given a configuration item of the form . return the
  * component group and key. If any error occurs, print a message on
  * stderr and return 1. Otherwise, return 0.
diff --git a/notmuch-count.c b/notmuch-count.c
index 0982f99..f77861e 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -35,6 +35,9 @@ notmuch_count_command (void *ctx, int argc, 

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

2012-01-13 Thread Austin Clements
This adds a search section to the config file and an
auto_tag_exclusions setting in that section.  The search and count
commands pass tag tags from the configuration to the library.
---
 notmuch-client.h |8 
 notmuch-config.c |   42 ++
 notmuch-count.c  |8 
 notmuch-search.c |8 
 test/search  |   18 ++
 5 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 517c010..62ede28 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -235,6 +235,14 @@ void
 notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
  notmuch_bool_t synchronize_flags);
 
+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t 
*length);
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length);
+
 int
 notmuch_run_hook (const char *db_path, const char *hook);
 
diff --git a/notmuch-config.c b/notmuch-config.c
index d697138..3d4d5b9 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -84,6 +84,15 @@ static const char maildir_config_comment[] =
 \tand update tags, while the \notmuch tag\ and \notmuch restore\\n
 \tcommands will notice tag changes and update flags in filenames\n;
 
+static const char search_config_comment[] =
+ Search configuration\n
+\n
+ The following option is supported here:\n
+\n
+\tauto_exclude_tags  A ;-separated list of tags that will be\n
+\t excluded from search results by default.  Using an excluded tag\n
+\t in a query will override that exclusion.\n;
+
 struct _notmuch_config {
 char *filename;
 GKeyFile *key_file;
@@ -96,6 +105,8 @@ struct _notmuch_config {
 const char **new_tags;
 size_t new_tags_length;
 notmuch_bool_t maildir_synchronize_flags;
+const char **auto_exclude_tags;
+size_t auto_exclude_tags_length;
 };
 
 static int
@@ -221,6 +232,7 @@ notmuch_config_open (void *ctx,
 int file_had_new_group;
 int file_had_user_group;
 int file_had_maildir_group;
+int file_had_search_group;
 
 if (is_new_ret)
*is_new_ret = 0;
@@ -252,6 +264,8 @@ notmuch_config_open (void *ctx,
 config-new_tags = NULL;
 config-new_tags_length = 0;
 config-maildir_synchronize_flags = TRUE;
+config-auto_exclude_tags = NULL;
+config-auto_exclude_tags_length = 0;
 
 if (! g_key_file_load_from_file (config-key_file,
 config-filename,
@@ -295,6 +309,7 @@ notmuch_config_open (void *ctx,
 file_had_new_group = g_key_file_has_group (config-key_file, new);
 file_had_user_group = g_key_file_has_group (config-key_file, user);
 file_had_maildir_group = g_key_file_has_group (config-key_file, 
maildir);
+file_had_search_group = g_key_file_has_group (config-key_file, search);
 
 
 if (notmuch_config_get_database_path (config) == NULL) {
@@ -345,6 +360,11 @@ notmuch_config_open (void *ctx,
notmuch_config_set_new_tags (config, tags, 2);
 }
 
+if (notmuch_config_get_auto_exclude_tags (config, tmp) == NULL) {
+   const char *tags[] = { deleted, spam };
+   notmuch_config_set_auto_exclude_tags (config, tags, 2);
+}
+
 error = NULL;
 config-maildir_synchronize_flags =
g_key_file_get_boolean (config-key_file,
@@ -387,6 +407,11 @@ notmuch_config_open (void *ctx,
maildir_config_comment, NULL);
 }
 
+if (! file_had_search_group) {
+   g_key_file_set_comment (config-key_file, search, NULL,
+   search_config_comment, NULL);
+}
+
 if (is_new_ret)
*is_new_ret = is_new;
 
@@ -597,6 +622,23 @@ notmuch_config_set_new_tags (notmuch_config_t *config,
 (config-new_tags));
 }
 
+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t *length)
+{
+return _config_get_list (config, search, auto_exclude_tags,
+(config-auto_exclude_tags),
+(config-auto_exclude_tags_length), length);
+}
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length)
+{
+_config_set_list (config, search, auto_exclude_tags, list, length,
+ (config-auto_exclude_tags));
+}
+
 /* Given a configuration item of the form group.key return the
  * component group and key. If any error occurs, print a message on
  * stderr and return 1. Otherwise, return 0.
diff --git a/notmuch-count.c b/notmuch-count.c
index 0982f99..f77861e 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -35,6 +35,9 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 char *query_str;
 int