Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D7225429E54 for ; Sun, 22 Jan 2012 21:42:39 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ITfxABYhlTmh for ; Sun, 22 Jan 2012 21:42:39 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2A9E4429E40 for ; Sun, 22 Jan 2012 21:42:39 -0800 (PST) Received: by wgbdt12 with SMTP id dt12so2245908wgb.2 for ; Sun, 22 Jan 2012 21:42:38 -0800 (PST) Received: by 10.180.20.69 with SMTP id l5mr11704568wie.19.1327297357951; Sun, 22 Jan 2012 21:42:37 -0800 (PST) Received: from localhost ([109.131.95.182]) by mx.google.com with ESMTPS id df2sm10985969wib.4.2012.01.22.21.42.37 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 21:42:37 -0800 (PST) From: Pieter Praet To: Austin Clements Subject: [PATCH v3 5/6] setup: prompt user for search.exclude_tags value Date: Mon, 23 Jan 2012 06:40:33 +0100 Message-Id: <1327297233-9193-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <20120123043435.GR16740@mit.edu> References: <20120123043435.GR16740@mit.edu> Cc: Notmuch Mail X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 05:42:40 -0000 Allow users to customize the search.exclude_tags option during setup. --- v2: - less copy-paste coding... :) v3: Austin's corrections [1] - @ `print_tag_list': add space before paren. - @ `notmuch_config_set_search_exclude_tags': remove \n between type cast and value. [1] id:"20120123043435.GR16740@mit.edu" notmuch-setup.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/notmuch-setup.c b/notmuch-setup.c index dcfa607..2941c52 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -133,6 +133,8 @@ notmuch_setup_command (unused (void *ctx), int is_new; const char **new_tags; size_t new_tags_len; + const char **search_exclude_tags; + size_t search_exclude_tags_len; #define prompt(format, ...) \ do { \ @@ -208,6 +210,24 @@ notmuch_setup_command (unused (void *ctx), g_ptr_array_free (tags, TRUE); } + + search_exclude_tags = notmuch_config_get_search_exclude_tags (config, &search_exclude_tags_len); + + printf ("Tags to exclude when searching messages (separated by spaces) ["); + print_tag_list (search_exclude_tags, search_exclude_tags_len); + prompt ("]: "); + + if (strlen (response)) { + GPtrArray *tags = parse_tag_list (ctx, response); + + notmuch_config_set_search_exclude_tags (config, + (const char **) tags->pdata, + tags->len); + + g_ptr_array_free (tags, TRUE); + } + + if (! notmuch_config_save (config)) { if (is_new) welcome_message_post_setup (); -- 1.7.8.1