Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 40 / e3294252d9fbc9ae7b1806b38ece866fdb570b
1 Return-Path: <nstraz@redhat.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 D01324196F0\r
6         for <notmuch@notmuchmail.org>; Thu,  1 Apr 2010 06:47:24 -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: -4.2\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5\r
12         tests=[BAYES_50=0.8, RCVD_IN_DNSWL_HI=-5] autolearn=ham\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 yKPA7kaTWfST for <notmuch@notmuchmail.org>;\r
16         Thu,  1 Apr 2010 06:47:23 -0700 (PDT)\r
17 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\r
18         by olra.theworths.org (Postfix) with ESMTP id C6E95431FC1\r
19         for <notmuch@notmuchmail.org>; Thu,  1 Apr 2010 06:47:23 -0700 (PDT)\r
20 Received: from int-mx05.intmail.prod.int.phx2.redhat.com\r
21         (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18])\r
22         by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o31DlMle022534\r
23         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)\r
24         for <notmuch@notmuchmail.org>; Thu, 1 Apr 2010 09:47:23 -0400\r
25 Received: from tin.rawstew (ovpn01.gateway.prod.ext.phx2.redhat.com\r
26  [10.5.9.1])    by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with\r
27  ESMTP  id o31DlMhb003877       for <notmuch@notmuchmail.org>; Thu, 1 Apr 2010\r
28  09:47:22 -0400\r
29 Received: by tin.rawstew (Postfix, from userid 10119)\r
30         id A5281506C5; Thu,  1 Apr 2010 09:47:21 -0400 (EDT)\r
31 Date: Thu, 1 Apr 2010 09:47:21 -0400\r
32 To: notmuch@notmuchmail.org\r
33 Message-ID: <20100401134721.GD25669@redhat.com>\r
34 MIME-Version: 1.0\r
35 Content-Type: text/plain; charset=us-ascii\r
36 Content-Disposition: inline\r
37 User-Agent: Mutt/1.5.20 (2009-08-17)\r
38 From: nstraz@redhat.com\r
39 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18\r
40 Subject: [notmuch] [PATCH] Setup the GMimeStream only when needed\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Thu, 01 Apr 2010 13:47:25 -0000\r
54 \r
55 I ran into this while looking at the vim plugin.  Vim's system() call\r
56 redirects output to a file and it was missing many of the part{ lines.\r
57 \r
58 If stream_stdout is setup too early, it will overwrite the part start\r
59 when notmuch is redirected to a file.\r
60 ---\r
61  notmuch-show.c |   15 ++++++---------\r
62  1 files changed, 6 insertions(+), 9 deletions(-)\r
63 \r
64 diff --git a/notmuch-show.c b/notmuch-show.c\r
65 index ff1fecb..96647c1 100644\r
66 --- a/notmuch-show.c\r
67 +++ b/notmuch-show.c\r
68 @@ -236,9 +236,6 @@ format_part_text (GMimeObject *part, int *part_count)\r
69  {\r
70      GMimeContentDisposition *disposition;\r
71      GMimeContentType *content_type;\r
72 -    GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
73 -\r
74 -    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
75  \r
76      disposition = g_mime_object_get_content_disposition (part);\r
77      if (disposition &&\r
78 @@ -256,14 +253,14 @@ format_part_text (GMimeObject *part, int *part_count)\r
79         if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
80             !g_mime_content_type_is_type (content_type, "text", "html"))\r
81         {\r
82 +           GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
83 +           g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
84             show_part_content (part, stream_stdout);\r
85 +           g_object_unref(stream_stdout);\r
86         }\r
87  \r
88         printf ("\fattachment}\n");\r
89  \r
90 -       if (stream_stdout)\r
91 -           g_object_unref(stream_stdout);\r
92 -\r
93         return;\r
94      }\r
95  \r
96 @@ -276,7 +273,10 @@ format_part_text (GMimeObject *part, int *part_count)\r
97      if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
98         !g_mime_content_type_is_type (content_type, "text", "html"))\r
99      {\r
100 +       GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
101 +       g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
102         show_part_content (part, stream_stdout);\r
103 +       g_object_unref(stream_stdout);\r
104      }\r
105      else\r
106      {\r
107 @@ -285,9 +285,6 @@ format_part_text (GMimeObject *part, int *part_count)\r
108      }\r
109  \r
110      printf ("\fpart}\n");\r
111 -\r
112 -    if (stream_stdout)\r
113 -       g_object_unref(stream_stdout);\r
114  }\r
115  \r
116  static void\r
117 -- \r
118 1.6.6.1\r
119 \r