Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2c / cad3bf8c4401c60375bbedf005784d87ea9af2
1 Return-Path: <amdragon@mit.edu>\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 E3267431FBF\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Aug 2012 09:50:32 -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.7\r
10 X-Spam-Level: \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 11iDwZCBRRDJ for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Aug 2012 09:50:29 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id AF8B1431FAF\r
20         for <notmuch@notmuchmail.org>; Mon,  6 Aug 2012 09:50:28 -0700 (PDT)\r
21 X-AuditID: 1209190e-b7fb56d0000008b2-4f-501ff5d21567\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id B9.26.02226.2D5FF105; Mon,  6 Aug 2012 12:50:27 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q76GoQUv022502; \r
27         Mon, 6 Aug 2012 12:50:26 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q76GoPmS018977\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 6 Aug 2012 12:50:25 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1SyQVc-000363-TK; Mon, 06 Aug 2012 12:50:24 -0400\r
37 Date: Mon, 6 Aug 2012 12:50:24 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Peter Wang <novalazy@gmail.com>\r
40 Subject: Re: [PATCH 3/4] show: indicate length of omitted body content (text)\r
41 Message-ID: <20120806165024.GL22601@mit.edu>\r
42 References: <1344151345-25411-1-git-send-email-novalazy@gmail.com>\r
43         <1344151345-25411-3-git-send-email-novalazy@gmail.com>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Content-Disposition: inline\r
47 In-Reply-To: <1344151345-25411-3-git-send-email-novalazy@gmail.com>\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hRV1r38VT7AYMEnJovrN2cyWzxv3cvk\r
51         wOSxc9Zddo9nq24xBzBFcdmkpOZklqUW6dslcGVcu/mFraBDrGL6rkksDYxnBLsYOTkkBEwk\r
52         3i7sYIOwxSQu3FsPZHNxCAnsY5SYNfMMI4SznlGi++0bqMwJJokFS/qhMksYJbZNmckK0s8i\r
53         oCJx/dQaZhCbTUBDYtv+5YwgtoiAssSfX8/AdjALSEt8+93MBGILC/hKrL97C6yeV0BHYu2E\r
54         yWC2kEC1xOSV89kg4oISJ2c+YYHo1ZK48e8lUC8H2Jzl/zhAwpwCzhLnPi4CWyUKdMKUk9vY\r
55         JjAKzULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0jfVyM0v0UlNKNzGCA1uS\r
56         bwfj14NKhxgFOBiVeHhvGMgHCLEmlhVX5h5ilORgUhLljX0HFOJLyk+pzEgszogvKs1JLT7E\r
57         KMHBrCTCW7MQKMebklhZlVqUD5OS5mBREue9knLTX0ggPbEkNTs1tSC1CCYrw8GhJMF75QtQ\r
58         o2BRanpqRVpmTglCmomDE2Q4D9Dw1yA1vMUFibnFmekQ+VOMilLivKdAEgIgiYzSPLheWOJ5\r
59         xSgO9IowLxswDQnxAJMWXPcroMFMQIO95eVABpckIqSkGhgnNIunLxS+8LJB+4o8p1vVmlDJ\r
60         6Gzmv38Ovtnreuve/Jv2bUlmDkc2m/h7FHo8dZ3zZpHjErOtx/8x/Dl3QFP15NG+z6dsvsjP\r
61         YHnTvu1/0ObP/QfzdQO+/+yUu6l1JoWp+7b4xv1Or7eWbqs4tIN11tvI+Obehef3Op1//5an\r
62         ebO6anTITwYDJZbijERDLeai4kQAFFLAGBcDAAA=\r
63 Cc: notmuch@notmuchmail.org\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Mon, 06 Aug 2012 16:50:33 -0000\r
77 \r
78 I'm not sure it's worth updating the text format.  There's already\r
79 plenty of disparity between the JSON and text formats, we're\r
80 considering deprecating the text format, and, from what I understand,\r
81 this might actually break consumers of the text format (the vim\r
82 frontend?) since the text format isn't particularly extensible.\r
83 \r
84 Quoth Peter Wang on Aug 05 at  5:22 pm:\r
85 > If a leaf part's body content is omitted, return the content length in\r
86 > --format=text output, for parity with --format=json output.\r
87 > ---\r
88 >  notmuch-show.c |   23 +++++++++++++++++++----\r
89 >  1 files changed, 19 insertions(+), 4 deletions(-)\r
90\r
91 > diff --git a/notmuch-show.c b/notmuch-show.c\r
92 > index 5c54257..cde8a1e 100644\r
93 > --- a/notmuch-show.c\r
94 > +++ b/notmuch-show.c\r
95 > @@ -488,9 +488,17 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
96 >       GMIME_OBJECT (node->envelope_part) : node->part;\r
97 >      GMimeContentType *content_type = g_mime_object_get_content_type (meta);\r
98 >      const notmuch_bool_t leaf = GMIME_IS_PART (node->part);\r
99 > +    notmuch_bool_t leaf_text_part = FALSE;\r
100 >      const char *part_type;\r
101 >      int i;\r
102 >  \r
103 > +    if (leaf &&\r
104 > +     g_mime_content_type_is_type (content_type, "text", "*") &&\r
105 > +     !g_mime_content_type_is_type (content_type, "text", "html"))\r
106 > +    {\r
107 > +     leaf_text_part = TRUE;\r
108 > +    }\r
109 > +\r
110 >      if (node->envelope_file) {\r
111 >       notmuch_message_t *message = node->envelope_file;\r
112 >  \r
113 > @@ -519,7 +527,16 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
114 >           printf (", Filename: %s", filename);\r
115 >       if (cid)\r
116 >           printf (", Content-id: %s", cid);\r
117 > -     printf (", Content-type: %s\n", g_mime_content_type_to_string (content_type));\r
118 > +     printf (", Content-type: %s", g_mime_content_type_to_string (content_type));\r
119 > +     if (leaf && !leaf_text_part) {\r
120 > +         GMimeDataWrapper *wrapper = g_mime_part_get_content_object (GMIME_PART (node->part));\r
121 > +         GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper);\r
122 > +         ssize_t length = g_mime_stream_length (stream);\r
123 > +         if (length >= 0) {\r
124 > +             printf (", Content-length: %ld", length);\r
125 > +         }\r
126 \r
127 Same comment about possibly unref'ing wrapper and/or stream.\r
128 \r
129 > +     }\r
130 > +     printf ("\n");\r
131 >      }\r
132 >  \r
133 >      if (GMIME_IS_MESSAGE (node->part)) {\r
134 > @@ -547,9 +564,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
135 >      }\r
136 >  \r
137 >      if (leaf) {\r
138 > -     if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
139 > -         !g_mime_content_type_is_type (content_type, "text", "html"))\r
140 > -     {\r
141 > +     if (leaf_text_part) {\r
142 >           GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
143 >           g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
144 >           show_text_part_content (node->part, stream_stdout, 0);\r