1 Return-Path: <nex@nexoid.at>
\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 98423431FD8
\r
6 for <notmuch@notmuchmail.org>; Fri, 30 Nov 2012 00:35:11 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.001 tagged_above=-999 required=5
\r
12 tests=[FREEMAIL_FROM=0.001] 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 iU2SmT3k+bbB for <notmuch@notmuchmail.org>;
\r
16 Fri, 30 Nov 2012 00:35:11 -0800 (PST)
\r
17 Received: from mail.nexoid.at (www.nexoid.at [178.79.130.240])
\r
18 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 02721431FBC
\r
21 for <notmuch@notmuchmail.org>; Fri, 30 Nov 2012 00:35:10 -0800 (PST)
\r
22 Received: by mail.nexoid.at (Postfix, from userid 1000)
\r
23 id DB22C11C0D1; Fri, 30 Nov 2012 09:29:17 +0100 (CET)
\r
24 From: Peter Feigl <craven@gmx.net>
\r
25 To: notmuch@notmuchmail.org
\r
26 Subject: [PATCH 2/3] Use the S-Expression structured printer for notmuch
\r
28 Date: Fri, 30 Nov 2012 09:29:02 +0100
\r
29 Message-Id: <1354264143-30173-2-git-send-email-craven@gmx.net>
\r
30 X-Mailer: git-send-email 1.8.0
\r
31 In-Reply-To: <1354264143-30173-1-git-send-email-craven@gmx.net>
\r
32 References: <1354264143-30173-1-git-send-email-craven@gmx.net>
\r
33 X-BeenThere: notmuch@notmuchmail.org
\r
34 X-Mailman-Version: 2.1.13
\r
36 List-Id: "Use and development of the notmuch mail system."
\r
37 <notmuch.notmuchmail.org>
\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
39 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
41 List-Post: <mailto:notmuch@notmuchmail.org>
\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
45 X-List-Received-Date: Fri, 30 Nov 2012 08:35:11 -0000
\r
47 This commit adds support for --format=sexp to notmuch search.
\r
49 notmuch-search.c | 6 +++++-
\r
51 2 files changed, 9 insertions(+), 1 deletion(-)
\r
53 diff --git a/notmuch-search.c b/notmuch-search.c
\r
54 index 830c4e4..6218622 100644
\r
55 --- a/notmuch-search.c
\r
56 +++ b/notmuch-search.c
\r
57 @@ -305,7 +305,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
58 int exclude = EXCLUDE_TRUE;
\r
61 - enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
\r
62 + enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT, NOTMUCH_FORMAT_SEXP }
\r
63 format_sel = NOTMUCH_FORMAT_TEXT;
\r
65 notmuch_opt_desc_t options[] = {
\r
66 @@ -315,6 +315,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
68 { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
\r
69 (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
\r
70 + { "sexp", NOTMUCH_FORMAT_SEXP },
\r
71 { "text", NOTMUCH_FORMAT_TEXT },
\r
73 { NOTMUCH_OPT_KEYWORD, &output, "output", 'o',
\r
74 @@ -347,6 +348,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
75 case NOTMUCH_FORMAT_JSON:
\r
76 format = sprinter_json_create (ctx, stdout);
\r
78 + case NOTMUCH_FORMAT_SEXP:
\r
79 + format = sprinter_sexp_create (ctx, stdout);
\r
82 /* this should never happen */
\r
83 INTERNAL_ERROR("no output format selected");
\r
84 diff --git a/sprinter.h b/sprinter.h
\r
85 index 912a526..59776a9 100644
\r
88 @@ -70,4 +70,8 @@ sprinter_text_create (const void *ctx, FILE *stream);
\r
90 sprinter_json_create (const void *ctx, FILE *stream);
\r
92 +/* Create a new structure printer that emits S-Expressions. */
\r
94 +sprinter_sexp_create (const void *ctx, FILE *stream);
\r
96 #endif // NOTMUCH_SPRINTER_H
\r