1 Return-Path: <pieter@praet.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 026FC431FAF
\r
6 for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 13:18:35 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id K9hbEG9BMSqX for <notmuch@notmuchmail.org>;
\r
16 Thu, 19 Jan 2012 13:18:34 -0800 (PST)
\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
18 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 54143431FAE
\r
21 for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 13:18:27 -0800 (PST)
\r
22 Received: by werp13 with SMTP id p13so382561wer.26
\r
23 for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 13:18:26 -0800 (PST)
\r
24 Received: by 10.216.136.156 with SMTP id w28mr1339406wei.11.1327007897834;
\r
25 Thu, 19 Jan 2012 13:18:17 -0800 (PST)
\r
26 Received: from localhost ([109.131.97.13])
\r
27 by mx.google.com with ESMTPS id d9sm30192463wiy.2.2012.01.19.13.18.17
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Thu, 19 Jan 2012 13:18:17 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: Austin Clements <amdragon@MIT.EDU>
\r
32 Subject: Re: [PATCH 4/4] setup: prompt user for search.exclude_tags value
\r
33 In-Reply-To: <20120119194437.GP16740@mit.edu>
\r
34 References: <1326586654-16840-3-git-send-email-amdragon@mit.edu>
\r
35 <1327000744-25463-1-git-send-email-pieter@praet.org>
\r
36 <1327000744-25463-5-git-send-email-pieter@praet.org>
\r
37 <20120119194437.GP16740@mit.edu>
\r
38 User-Agent: Notmuch/0.11+99~gab86e73 (http://notmuchmail.org) Emacs/23.3.1
\r
39 (x86_64-unknown-linux-gnu)
\r
40 Date: Thu, 19 Jan 2012 22:16:27 +0100
\r
41 Message-ID: <8762g7o0k4.fsf@praet.org>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.13
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Thu, 19 Jan 2012 21:18:35 -0000
\r
59 On Thu, 19 Jan 2012 14:44:37 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
\r
60 > Quoth Pieter Praet on Jan 19 at 8:19 pm:
\r
61 > > Allow users to customize the search.exclude_tags option during setup.
\r
64 > > notmuch-setup.c | 36 ++++++++++++++++++++++++++++++++++++
\r
65 > > 1 files changed, 36 insertions(+), 0 deletions(-)
\r
67 > > diff --git a/notmuch-setup.c b/notmuch-setup.c
\r
68 > > index c3ea937..44d4aaa 100644
\r
69 > > --- a/notmuch-setup.c
\r
70 > > +++ b/notmuch-setup.c
\r
71 > > @@ -101,6 +101,8 @@ notmuch_setup_command (unused (void *ctx),
\r
73 > > const char **new_tags;
\r
74 > > size_t new_tags_len;
\r
75 > > + const char **search_exclude_tags;
\r
76 > > + size_t search_exclude_tags_len;
\r
78 > > #define prompt(format, ...) \
\r
80 > > @@ -195,6 +197,40 @@ notmuch_setup_command (unused (void *ctx),
\r
81 > > g_ptr_array_free (tags, TRUE);
\r
84 > > + search_exclude_tags = notmuch_config_get_search_exclude_tags (config, &search_exclude_tags_len);
\r
86 > > + printf ("Tags to exclude when searching messages (separated by spaces) [");
\r
88 > > + for (i = 0; i < search_exclude_tags_len; i++) {
\r
91 > > + printf ("%s", search_exclude_tags[i]);
\r
94 > > + prompt ("]: ");
\r
96 > > + if (strlen (response)) {
\r
97 > > + GPtrArray *tags = g_ptr_array_new ();
\r
98 > > + char *tag = response;
\r
101 > > + while (tag && *tag) {
\r
102 > > + space = strchr (tag, ' ');
\r
104 > > + g_ptr_array_add (tags, talloc_strndup (ctx, tag, space - tag));
\r
106 > > + g_ptr_array_add (tags, talloc_strdup (ctx, tag));
\r
108 > > + while (tag && *tag == ' ')
\r
112 > > + notmuch_config_set_search_exclude_tags (config, (const char **) tags->pdata,
\r
115 > > + g_ptr_array_free (tags, TRUE);
\r
119 > Holy code duplication. Can we move most of this (at least the
\r
120 > response parsing part and maybe the prompt printing) into a function
\r
121 > and use it for both new tags and exclude tags?
\r
124 Depends on who "we" is... :) I would gladly do it if I could, but I
\r
125 think this uber1337 copy-paste coding job serves as *very* convincing
\r
126 proof that I'm pretty much in the dark (with a single wet match) when it
\r
130 > > if (! notmuch_config_save (config)) {
\r
132 > > welcome_message_post_setup ();
\r