Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / d7 / 7f8514266c4da2dd8813cd4e6500fb7d3bb1fb
1 Return-Path: <markwalters1009@gmail.com>\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 45400431FD5\r
6         for <notmuch@notmuchmail.org>; Sat, 16 Jun 2012 03:22:11 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id 3NYGGMIrD0OB for <notmuch@notmuchmail.org>;\r
18         Sat, 16 Jun 2012 03:22:10 -0700 (PDT)\r
19 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com\r
20         [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id B2B3D431FAE\r
23         for <notmuch@notmuchmail.org>; Sat, 16 Jun 2012 03:22:06 -0700 (PDT)\r
24 Received: by wibhn14 with SMTP id hn14so274152wib.2\r
25         for <notmuch@notmuchmail.org>; Sat, 16 Jun 2012 03:22:05 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=sjxiZsreiuCKMKlBPdFWEvcVVRkdrqNqkryzeF3oElI=;\r
29         b=P0bvWSm+lGKUMr8ZpE03pQCZk/v4miVumBpMRaoxIEVfnmghK2e0FtIBenaZJRh8Ko\r
30         +0eC0mY4WMfxAt9O9kUu9T/xAMltc5KYRYNYVj0yisWDpsBO72mbLF19CSRDWJGAp2cR\r
31         TcrnNW3RwoFqIVKy7pD2pMKgFEJmC8E4DuEMH9auy6Dw84bNEYqd391rlR+d8t5OCOFX\r
32         htudWdg++sNuAWM8J2SnMKMNzh2esBy7gY24injg45y4ZH0vxzYeUoxwuqgdBBT4h2Bx\r
33         bzaUgZDsNwHY5oiXQNHSGv7/2ITVqL40YeGnNm/cWzDdpdzV/Re0F6/oUG5dT8tYTuXG\r
34         BRVA==\r
35 Received: by 10.180.95.137 with SMTP id dk9mr10643314wib.1.1339842125377;\r
36         Sat, 16 Jun 2012 03:22:05 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  ez4sm9560425wid.3.2012.06.16.03.22.04  (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sat, 16 Jun 2012 03:22:04 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [Patch v8 2/6] cli: Let json output "null" messages for non\r
44         --entire-thread\r
45 Date: Sat, 16 Jun 2012 11:21:43 +0100\r
46 Message-Id: <1339842107-10632-3-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1339842107-10632-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1339842107-10632-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sat, 16 Jun 2012 10:22:11 -0000\r
63 \r
64 All formats except Json can output empty messages for non\r
65 entire-thread, but in Json format we output "null" to keep the other\r
66 elements (e.g. the replies to the omitted message) in the correct\r
67 place.\r
68 ---\r
69  notmuch-client.h |    1 +\r
70  notmuch-show.c   |   20 ++++++++++++++++----\r
71  2 files changed, 17 insertions(+), 4 deletions(-)\r
72 \r
73 diff --git a/notmuch-client.h b/notmuch-client.h\r
74 index 9b63eae..0c17b79 100644\r
75 --- a/notmuch-client.h\r
76 +++ b/notmuch-client.h\r
77 @@ -75,6 +75,7 @@ typedef struct notmuch_show_format {\r
78                               const struct notmuch_show_params *params);\r
79      const char *message_set_sep;\r
80      const char *message_set_end;\r
81 +    const char *null_message;\r
82  } notmuch_show_format_t;\r
83  \r
84  typedef struct notmuch_crypto {\r
85 diff --git a/notmuch-show.c b/notmuch-show.c\r
86 index 8247f1d..b004468 100644\r
87 --- a/notmuch-show.c\r
88 +++ b/notmuch-show.c\r
89 @@ -37,7 +37,8 @@ static const notmuch_show_format_t format_json = {\r
90      .message_set_start = "[",\r
91      .part = format_part_json_entry,\r
92      .message_set_sep = ", ",\r
93 -    .message_set_end = "]"\r
94 +    .message_set_end = "]",\r
95 +    .null_message = "null"\r
96  };\r
97  \r
98  static notmuch_status_t\r
99 @@ -800,6 +801,15 @@ format_part_raw (unused (const void *ctx), mime_node_t *node,\r
100  }\r
101  \r
102  static notmuch_status_t\r
103 +show_null_message (const notmuch_show_format_t *format)\r
104 +{\r
105 +    /* Output a null message. Currently empty for all formats except Json */\r
106 +    if (format->null_message)\r
107 +       printf ("%s", format->null_message);\r
108 +    return NOTMUCH_STATUS_SUCCESS;\r
109 +}\r
110 +\r
111 +static notmuch_status_t\r
112  show_message (void *ctx,\r
113               const notmuch_show_format_t *format,\r
114               notmuch_message_t *message,\r
115 @@ -861,11 +871,13 @@ show_messages (void *ctx,\r
116             if (status && !res)\r
117                 res = status;\r
118             next_indent = indent + 1;\r
119 -\r
120 -           if (!status && format->message_set_sep)\r
121 -               fputs (format->message_set_sep, stdout);\r
122 +       } else {\r
123 +           status = show_null_message (format);\r
124         }\r
125  \r
126 +       if (!status && format->message_set_sep)\r
127 +           fputs (format->message_set_sep, stdout);\r
128 +\r
129         status = show_messages (ctx,\r
130                                 format,\r
131                                 notmuch_message_get_replies (message),\r
132 -- \r
133 1.7.9.1\r
134 \r