[PATCH v3 2/2] search: Support automatic tag exclusions
On Sun, 22 Jan 2012 23:09:30 +0100, Xavier Maillard wrote: > Hey Pieter, > Hi! > On Thu, 19 Jan 2012 20:19:00 +0100, Pieter Praet wrote: > > Nice feature! I won't be using it myself, but I can imagine it being > > *very* useful for those who still feel the need to "delete" email :). > > Adding a 'deleted' tag does not mean there will be a delete/purge > process ;) (currently I got 5k messages with the tag deleted ;). > Very true, that's why I put quotes around "delete". Deleting email for real is *so* old-fashioned... :D ;) > > Nitpicking: > > > > [ ... ] > > > So I'd like to suggest replacing all occurences of "auto_exclude_tags" > > with "search_exclude_tags" (and simply "exclude_tags" in the args to > > `_config_get_list' and `_config_set_list', of course). > > +1 > > > Unfortunately, this would also partially invalidate your recent NEWS > > submission [2]. > > > > - If the 'search.exclude_tags' option is missing from the config file, > > its value is automatically set to "deleted;spam;", which probably isn't > > a sane default. Luckily, you've already provided the solution [3]. > > I am against doing something /unsafe/ in the user's back. If there is no > option set intentionnaly by the user, there is nothing notmuch should > do -i.e no exclusion - > Absolutely. Actually, that's *exactly* what I meant. I thought that would be pretty clear, but perhaps it wasn't. I've reworded some of the commit messages, and will pay more attention to it in the future. > > - To make new users aware of the config option's existence, we should > > prompt them to configure it during setup. > > +1 > > /Xavier Thanks for your input! Peace -- Pieter
[PATCH v3 2/2] search: Support automatic tag exclusions
Hey Pieter, On Thu, 19 Jan 2012 20:19:00 +0100, Pieter Praet wrote: > Nice feature! I won't be using it myself, but I can imagine it being > *very* useful for those who still feel the need to "delete" email :). Adding a 'deleted' tag does not mean there will be a delete/purge process ;) (currently I got 5k messages with the tag deleted ;). > Nitpicking: > [ ... ] > So I'd like to suggest replacing all occurences of "auto_exclude_tags" > with "search_exclude_tags" (and simply "exclude_tags" in the args to > `_config_get_list' and `_config_set_list', of course). +1 > Unfortunately, this would also partially invalidate your recent NEWS > submission [2]. > > - If the 'search.exclude_tags' option is missing from the config file, > its value is automatically set to "deleted;spam;", which probably isn't > a sane default. Luckily, you've already provided the solution [3]. I am against doing something /unsafe/ in the user's back. If there is no option set intentionnaly by the user, there is nothing notmuch should do -i.e no exclusion - > - To make new users aware of the config option's existence, we should > prompt them to configure it during setup. +1 /Xavier
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
Hey Pieter, On Thu, 19 Jan 2012 20:19:00 +0100, Pieter Praet pie...@praet.org wrote: Nice feature! I won't be using it myself, but I can imagine it being *very* useful for those who still feel the need to delete email :). Adding a 'deleted' tag does not mean there will be a delete/purge process ;) (currently I got 5k messages with the tag deleted ;). Nitpicking: [ ... ] So I'd like to suggest replacing all occurences of auto_exclude_tags with search_exclude_tags (and simply exclude_tags in the args to `_config_get_list' and `_config_set_list', of course). +1 Unfortunately, this would also partially invalidate your recent NEWS submission [2]. - If the 'search.exclude_tags' option is missing from the config file, its value is automatically set to deleted;spam;, which probably isn't a sane default. Luckily, you've already provided the solution [3]. I am against doing something /unsafe/ in the user's back. If there is no option set intentionnaly by the user, there is nothing notmuch should do -i.e no exclusion - - To make new users aware of the config option's existence, we should prompt them to configure it during setup. +1 /Xavier ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
On Sun, 22 Jan 2012 23:09:30 +0100, Xavier Maillard xav...@maillard.im wrote: Hey Pieter, Hi! On Thu, 19 Jan 2012 20:19:00 +0100, Pieter Praet pie...@praet.org wrote: Nice feature! I won't be using it myself, but I can imagine it being *very* useful for those who still feel the need to delete email :). Adding a 'deleted' tag does not mean there will be a delete/purge process ;) (currently I got 5k messages with the tag deleted ;). Very true, that's why I put quotes around delete. Deleting email for real is *so* old-fashioned... :D ;) Nitpicking: [ ... ] So I'd like to suggest replacing all occurences of auto_exclude_tags with search_exclude_tags (and simply exclude_tags in the args to `_config_get_list' and `_config_set_list', of course). +1 Unfortunately, this would also partially invalidate your recent NEWS submission [2]. - If the 'search.exclude_tags' option is missing from the config file, its value is automatically set to deleted;spam;, which probably isn't a sane default. Luckily, you've already provided the solution [3]. I am against doing something /unsafe/ in the user's back. If there is no option set intentionnaly by the user, there is nothing notmuch should do -i.e no exclusion - Absolutely. Actually, that's *exactly* what I meant. I thought that would be pretty clear, but perhaps it wasn't. I've reworded some of the commit messages, and will pay more attention to it in the future. - To make new users aware of the config option's existence, we should prompt them to configure it during setup. +1 /Xavier Thanks for your input! Peace -- Pieter ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 22:01:27 +, Mark Walters wrote: > > > > I am happy with them appearing as a non matching message, but currently > > > they appear as a full open message. (The patch to achieve this is > > > trivial: essentially transpose part of Austin's patch of > > > notmuch-search.c into notmuch-show.c) > > > > This definitely sounds like the right thing to do. We can argue about > > more sophisticated UIs, but it should do this at a minimum. > > I will post the trivial patch in a moment (trivial but I could easily > have done something stupid). > > I haven't written a test yet: should it have one, [...] That would be preferrable, yes. > [...] and if so, could > someone point me to the appropriate place to put it? > In "test/emacs", right after "Hiding message with visible citation in notmuch-show view" would be perfect IMO. As you can see, that test uses `test-visible-output', which should provide the functionality you need. > Best wishes > > Mark Thanks! Peace -- Pieter
[PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 14:36:47 -0500, Austin Clements wrote: > Quoth Pieter Praet on Jan 19 at 8:19 pm: > > Nice feature! I won't be using it myself, but I can imagine it being > > *very* useful for those who still feel the need to "delete" email :). > > Same here. I probably will use the spam tag, though. > Really? Then how will you be able to reply to my emails?!? ;) > > Nitpicking: > > > > - All other config-related functions and args include the section title > > in their name [1], so for the sake of consistency, we might want to > > mirror that. Also, the "auto"matic part is pretty much a given. > > > > So I'd like to suggest replacing all occurences of "auto_exclude_tags" > > with "search_exclude_tags" (and simply "exclude_tags" in the args to > > `_config_get_list' and `_config_set_list', of course). > > You are technically correct, the best kind of correct. I'd completely > missed this pattern. This should get fixed ASAP, while this feature > still has limited adoption. > > > Unfortunately, this would also partially invalidate your recent NEWS > > submission [2]. > > No worries, though maybe you want to tack an updated version of that > patch on the end of your series? > Will do. > > - If the 'search.exclude_tags' option is missing from the config file, > > its value is automatically set to "deleted;spam;", which probably isn't > > a sane default. Luckily, you've already provided the solution [3]. > > I'm good either way. I got lost in the discussion of defaults but > Jamie assured me everything was okay, so I took the path of least > resistance and left things as they were. > Hmm. I probably haven't read everything pertaining to that issue yet, but IMO it violates the Principle of Least Surprise with a vengeance. Tagging stuff some way or another shouldn't make it disappear by default. What if "spam" means "read it when you're bored", or "deleted" means "processed request for user deletion" (pretty far-fetched, but still...) for someone? > > - To make new users aware of the config option's existence, we should > > prompt them to configure it during setup. > > Sure. > > > Patches follow. > > > > > > Peace > > > > > > [1] Eg. `notmuch_config_get_user_name', `notmuch_config_get_new_tags', > > `notmuch_config_get_maildir_synchronize_flags', ... > > > > [2] id:"1326920330-31496-1-git-send-email-amdragon at mit.edu" > > > > [3] id:"20120117203211.GQ16740 at mit.edu" > > Peace -- Pieter
[PATCH v3 2/2] search: Support automatic tag exclusions
> > I am happy with them appearing as a non matching message, but currently > > they appear as a full open message. (The patch to achieve this is > > trivial: essentially transpose part of Austin's patch of > > notmuch-search.c into notmuch-show.c) > > This definitely sounds like the right thing to do. We can argue about > more sophisticated UIs, but it should do this at a minimum. I will post the trivial patch in a moment (trivial but I could easily have done something stupid). I haven't written a test yet: should it have one, and if so, could someone point me to the appropriate place to put it? Best wishes Mark
[PATCH v3 2/2] search: Support automatic tag exclusions
> On Thu, 19 Jan 2012 20:06:27 +, markwalters1009 at gmail.com wrote: > > I would actually like make a different suggestion: extend > > auto_exclude_tags to notmuch-show as well. I was quite surprised to see > > my deleted (ie hidden rather than actually deleted) messages return when > > viewing a thread. > > It might be best to show the messages in the thread ? after all, you > might want to ?undelete? (or ?unspam?) those messages in light of later > replies to them. (And if you are sure you really want them gone, you > should be deleting them or moving them out of your maildir periodically, > rather than relying on notmuch to not show them to you ever.) I am happy with them appearing as a non matching message, but currently they appear as a full open message. (The patch to achieve this is trivial: essentially transpose part of Austin's patch of notmuch-search.c into notmuch-show.c) Best wishes Mark
[PATCH v3 2/2] search: Support automatic tag exclusions
Nice feature! I won't be using it myself, but I can imagine it being *very* useful for those who still feel the need to "delete" email :). Nitpicking: - All other config-related functions and args include the section title in their name [1], so for the sake of consistency, we might want to mirror that. Also, the "auto"matic part is pretty much a given. So I'd like to suggest replacing all occurences of "auto_exclude_tags" with "search_exclude_tags" (and simply "exclude_tags" in the args to `_config_get_list' and `_config_set_list', of course). Unfortunately, this would also partially invalidate your recent NEWS submission [2]. - If the 'search.exclude_tags' option is missing from the config file, its value is automatically set to "deleted;spam;", which probably isn't a sane default. Luckily, you've already provided the solution [3]. - To make new users aware of the config option's existence, we should prompt them to configure it during setup. Patches follow. Peace [1] Eg. `notmuch_config_get_user_name', `notmuch_config_get_new_tags', `notmuch_config_get_maildir_synchronize_flags', ... [2] id:"1326920330-31496-1-git-send-email-amdragon at mit.edu" [3] id:"20120117203211.GQ16740 at mit.edu"
[PATCH v3 2/2] search: Support automatic tag exclusions
> > So I'd like to suggest replacing all occurences of "auto_exclude_tags" > > with "search_exclude_tags" (and simply "exclude_tags" in the args to > > `_config_get_list' and `_config_set_list', of course). > > You are technically correct, the best kind of correct. I'd completely > missed this pattern. This should get fixed ASAP, while this feature > still has limited adoption. I would actually like make a different suggestion: extend auto_exclude_tags to notmuch-show as well. I was quite surprised to see my deleted (ie hidden rather than actually deleted) messages return when viewing a thread. Best wishes Mark
[PATCH v3 2/2] search: Support automatic tag exclusions
Quoth Mark Walters on Jan 19 at 8:23 pm: > > > On Thu, 19 Jan 2012 20:06:27 +, markwalters1009 at gmail.com wrote: > > > I would actually like make a different suggestion: extend > > > auto_exclude_tags to notmuch-show as well. I was quite surprised to see > > > my deleted (ie hidden rather than actually deleted) messages return when > > > viewing a thread. > > > > It might be best to show the messages in the thread ? after all, you > > might want to ?undelete? (or ?unspam?) those messages in light of later > > replies to them. (And if you are sure you really want them gone, you > > should be deleting them or moving them out of your maildir periodically, > > rather than relying on notmuch to not show them to you ever.) > > I am happy with them appearing as a non matching message, but currently > they appear as a full open message. (The patch to achieve this is > trivial: essentially transpose part of Austin's patch of > notmuch-search.c into notmuch-show.c) This definitely sounds like the right thing to do. We can argue about more sophisticated UIs, but it should do this at a minimum.
[PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 20:06:27 +, markwalters1009 at gmail.com wrote: > I would actually like make a different suggestion: extend > auto_exclude_tags to notmuch-show as well. I was quite surprised to see > my deleted (ie hidden rather than actually deleted) messages return when > viewing a thread. It might be best to show the messages in the thread ? after all, you might want to ?undelete? (or ?unspam?) those messages in light of later replies to them. (And if you are sure you really want them gone, you should be deleting them or moving them out of your maildir periodically, rather than relying on notmuch to not show them to you ever.) (Perhaps another application of this functionality would be to ?mute? certain threads on a mailing list. Then you could use a query for ?word-i-am-interested-in AND tag:muted? to find out if something interesting pops up in a muted thread. Then in the show view, you will want to unmute the other thread messages.) Perhaps this could be an application of dme?s header-line collapsing functionality in id:"cun8vl5m610.fsf at hotblack-desiato.hh.sledj.net" (suitably cleaned up), such that you see only a single line in the show buffer that says: - 6 messages hidden - instead of the 6 (or however many) individual messages. -- Aaron Ecay
[PATCH v3 2/2] search: Support automatic tag exclusions
Quoth Pieter Praet on Jan 19 at 8:19 pm: > Nice feature! I won't be using it myself, but I can imagine it being > *very* useful for those who still feel the need to "delete" email :). Same here. I probably will use the spam tag, though. > Nitpicking: > > - All other config-related functions and args include the section title > in their name [1], so for the sake of consistency, we might want to > mirror that. Also, the "auto"matic part is pretty much a given. > > So I'd like to suggest replacing all occurences of "auto_exclude_tags" > with "search_exclude_tags" (and simply "exclude_tags" in the args to > `_config_get_list' and `_config_set_list', of course). You are technically correct, the best kind of correct. I'd completely missed this pattern. This should get fixed ASAP, while this feature still has limited adoption. > Unfortunately, this would also partially invalidate your recent NEWS > submission [2]. No worries, though maybe you want to tack an updated version of that patch on the end of your series? > - If the 'search.exclude_tags' option is missing from the config file, > its value is automatically set to "deleted;spam;", which probably isn't > a sane default. Luckily, you've already provided the solution [3]. I'm good either way. I got lost in the discussion of defaults but Jamie assured me everything was okay, so I took the path of least resistance and left things as they were. > - To make new users aware of the config option's existence, we should > prompt them to configure it during setup. Sure. > Patches follow. > > > Peace > > > [1] Eg. `notmuch_config_get_user_name', `notmuch_config_get_new_tags', > `notmuch_config_get_maildir_synchronize_flags', ... > > [2] id:"1326920330-31496-1-git-send-email-amdragon at mit.edu" > > [3] id:"20120117203211.GQ16740 at mit.edu" >
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
Nice feature! I won't be using it myself, but I can imagine it being *very* useful for those who still feel the need to delete email :). Nitpicking: - All other config-related functions and args include the section title in their name [1], so for the sake of consistency, we might want to mirror that. Also, the automatic part is pretty much a given. So I'd like to suggest replacing all occurences of auto_exclude_tags with search_exclude_tags (and simply exclude_tags in the args to `_config_get_list' and `_config_set_list', of course). Unfortunately, this would also partially invalidate your recent NEWS submission [2]. - If the 'search.exclude_tags' option is missing from the config file, its value is automatically set to deleted;spam;, which probably isn't a sane default. Luckily, you've already provided the solution [3]. - To make new users aware of the config option's existence, we should prompt them to configure it during setup. Patches follow. Peace [1] Eg. `notmuch_config_get_user_name', `notmuch_config_get_new_tags', `notmuch_config_get_maildir_synchronize_flags', ... [2] id:1326920330-31496-1-git-send-email-amdra...@mit.edu [3] id:20120117203211.gq16...@mit.edu ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
Quoth Pieter Praet on Jan 19 at 8:19 pm: Nice feature! I won't be using it myself, but I can imagine it being *very* useful for those who still feel the need to delete email :). Same here. I probably will use the spam tag, though. Nitpicking: - All other config-related functions and args include the section title in their name [1], so for the sake of consistency, we might want to mirror that. Also, the automatic part is pretty much a given. So I'd like to suggest replacing all occurences of auto_exclude_tags with search_exclude_tags (and simply exclude_tags in the args to `_config_get_list' and `_config_set_list', of course). You are technically correct, the best kind of correct. I'd completely missed this pattern. This should get fixed ASAP, while this feature still has limited adoption. Unfortunately, this would also partially invalidate your recent NEWS submission [2]. No worries, though maybe you want to tack an updated version of that patch on the end of your series? - If the 'search.exclude_tags' option is missing from the config file, its value is automatically set to deleted;spam;, which probably isn't a sane default. Luckily, you've already provided the solution [3]. I'm good either way. I got lost in the discussion of defaults but Jamie assured me everything was okay, so I took the path of least resistance and left things as they were. - To make new users aware of the config option's existence, we should prompt them to configure it during setup. Sure. Patches follow. Peace [1] Eg. `notmuch_config_get_user_name', `notmuch_config_get_new_tags', `notmuch_config_get_maildir_synchronize_flags', ... [2] id:1326920330-31496-1-git-send-email-amdra...@mit.edu [3] id:20120117203211.gq16...@mit.edu ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
So I'd like to suggest replacing all occurences of auto_exclude_tags with search_exclude_tags (and simply exclude_tags in the args to `_config_get_list' and `_config_set_list', of course). You are technically correct, the best kind of correct. I'd completely missed this pattern. This should get fixed ASAP, while this feature still has limited adoption. I would actually like make a different suggestion: extend auto_exclude_tags to notmuch-show as well. I was quite surprised to see my deleted (ie hidden rather than actually deleted) messages return when viewing a thread. Best wishes Mark ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 20:06:27 +, markwalters1...@gmail.com wrote: I would actually like make a different suggestion: extend auto_exclude_tags to notmuch-show as well. I was quite surprised to see my deleted (ie hidden rather than actually deleted) messages return when viewing a thread. It might be best to show the messages in the thread – after all, you might want to “undelete” (or “unspam”) those messages in light of later replies to them. (And if you are sure you really want them gone, you should be deleting them or moving them out of your maildir periodically, rather than relying on notmuch to not show them to you ever.) (Perhaps another application of this functionality would be to “mute” certain threads on a mailing list. Then you could use a query for “word-i-am-interested-in AND tag:muted” to find out if something interesting pops up in a muted thread. Then in the show view, you will want to unmute the other thread messages.) Perhaps this could be an application of dme’s header-line collapsing functionality in id:cun8vl5m610@hotblack-desiato.hh.sledj.net (suitably cleaned up), such that you see only a single line in the show buffer that says: - 6 messages hidden - instead of the 6 (or however many) individual messages. -- Aaron Ecay ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 20:06:27 +, markwalters1...@gmail.com wrote: I would actually like make a different suggestion: extend auto_exclude_tags to notmuch-show as well. I was quite surprised to see my deleted (ie hidden rather than actually deleted) messages return when viewing a thread. It might be best to show the messages in the thread – after all, you might want to “undelete” (or “unspam”) those messages in light of later replies to them. (And if you are sure you really want them gone, you should be deleting them or moving them out of your maildir periodically, rather than relying on notmuch to not show them to you ever.) I am happy with them appearing as a non matching message, but currently they appear as a full open message. (The patch to achieve this is trivial: essentially transpose part of Austin's patch of notmuch-search.c into notmuch-show.c) Best wishes Mark ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 14:36:47 -0500, Austin Clements amdra...@mit.edu wrote: Quoth Pieter Praet on Jan 19 at 8:19 pm: Nice feature! I won't be using it myself, but I can imagine it being *very* useful for those who still feel the need to delete email :). Same here. I probably will use the spam tag, though. Really? Then how will you be able to reply to my emails?!? ;) Nitpicking: - All other config-related functions and args include the section title in their name [1], so for the sake of consistency, we might want to mirror that. Also, the automatic part is pretty much a given. So I'd like to suggest replacing all occurences of auto_exclude_tags with search_exclude_tags (and simply exclude_tags in the args to `_config_get_list' and `_config_set_list', of course). You are technically correct, the best kind of correct. I'd completely missed this pattern. This should get fixed ASAP, while this feature still has limited adoption. Unfortunately, this would also partially invalidate your recent NEWS submission [2]. No worries, though maybe you want to tack an updated version of that patch on the end of your series? Will do. - If the 'search.exclude_tags' option is missing from the config file, its value is automatically set to deleted;spam;, which probably isn't a sane default. Luckily, you've already provided the solution [3]. I'm good either way. I got lost in the discussion of defaults but Jamie assured me everything was okay, so I took the path of least resistance and left things as they were. Hmm. I probably haven't read everything pertaining to that issue yet, but IMO it violates the Principle of Least Surprise with a vengeance. Tagging stuff some way or another shouldn't make it disappear by default. What if spam means read it when you're bored, or deleted means processed request for user deletion (pretty far-fetched, but still...) for someone? - To make new users aware of the config option's existence, we should prompt them to configure it during setup. Sure. Patches follow. Peace [1] Eg. `notmuch_config_get_user_name', `notmuch_config_get_new_tags', `notmuch_config_get_maildir_synchronize_flags', ... [2] id:1326920330-31496-1-git-send-email-amdra...@mit.edu [3] id:20120117203211.gq16...@mit.edu Peace -- Pieter ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
I am happy with them appearing as a non matching message, but currently they appear as a full open message. (The patch to achieve this is trivial: essentially transpose part of Austin's patch of notmuch-search.c into notmuch-show.c) This definitely sounds like the right thing to do. We can argue about more sophisticated UIs, but it should do this at a minimum. I will post the trivial patch in a moment (trivial but I could easily have done something stupid). I haven't written a test yet: should it have one, and if so, could someone point me to the appropriate place to put it? Best wishes Mark ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 2/2] search: Support automatic tag exclusions
On Thu, 19 Jan 2012 22:01:27 +, Mark Walters markwalters1...@gmail.com wrote: I am happy with them appearing as a non matching message, but currently they appear as a full open message. (The patch to achieve this is trivial: essentially transpose part of Austin's patch of notmuch-search.c into notmuch-show.c) This definitely sounds like the right thing to do. We can argue about more sophisticated UIs, but it should do this at a minimum. I will post the trivial patch in a moment (trivial but I could easily have done something stupid). I haven't written a test yet: should it have one, [...] That would be preferrable, yes. [...] and if so, could someone point me to the appropriate place to put it? In test/emacs, right after Hiding message with visible citation in notmuch-show view would be perfect IMO. As you can see, that test uses `test-visible-output', which should provide the functionality you need. Best wishes Mark Thanks! Peace -- Pieter ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 2/2] search: Support automatic tag exclusions
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 v3 2/2] search: Support automatic tag exclusions
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