1 Return-Path: <dme@dme.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 38141431FD0
\r
6 for <notmuch@notmuchmail.org>; Wed, 11 Jan 2012 02:50:10 -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 835WsCZRyG2V for <notmuch@notmuchmail.org>;
\r
16 Wed, 11 Jan 2012 02:50:08 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.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 59294431FB6
\r
21 for <notmuch@notmuchmail.org>; Wed, 11 Jan 2012 02:50:08 -0800 (PST)
\r
22 Received: by wibhr12 with SMTP id hr12so290306wib.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 11 Jan 2012 02:50:07 -0800 (PST)
\r
24 Received: by 10.180.82.41 with SMTP id f9mr18595934wiy.7.1326279007335;
\r
25 Wed, 11 Jan 2012 02:50:07 -0800 (PST)
\r
26 Received: from hotblack-desiato.hh.sledj.net
\r
27 (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])
\r
28 by mx.google.com with ESMTPS id o17sm1165524wbh.19.2012.01.11.02.50.05
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Wed, 11 Jan 2012 02:50:06 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 444E29FCB6; Wed, 11 Jan 2012 10:50:04 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH] notmuch/emacs: Observe the charset of encoded parts,
\r
37 Date: Wed, 11 Jan 2012 10:50:01 +0000
\r
38 Message-Id: <1326279001-28427-1-git-send-email-dme@dme.org>
\r
39 X-Mailer: git-send-email 1.7.7.3
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Wed, 11 Jan 2012 10:50:10 -0000
\r
54 Add the charset of encoded parts to the JSON output of 'notmuch -show'
\r
55 when it is known. Observe the encoding when rendering parts in emacs.
\r
58 Domo_ discovered that w3m was being called with an incorrect charset
\r
59 to render text/html parts. This fixes that.
\r
61 emacs/notmuch-show.el | 3 ++-
\r
62 notmuch-show.c | 3 +++
\r
63 2 files changed, 5 insertions(+), 1 deletions(-)
\r
65 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
66 index 5502efd..0354a8e 100644
\r
67 --- a/emacs/notmuch-show.el
\r
68 +++ b/emacs/notmuch-show.el
\r
69 @@ -328,7 +328,8 @@ message at DEPTH in the current thread."
\r
70 current buffer, if possible."
\r
71 (let ((display-buffer (current-buffer)))
\r
73 - (let ((handle (mm-make-handle (current-buffer) (list content-type))))
\r
74 + (let* ((charset (plist-get part :content-charset))
\r
75 + (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset)))))
\r
76 (if (and (mm-inlinable-p handle)
\r
77 (mm-inlined-p handle))
\r
78 (let ((content (notmuch-show-get-bodypart-content msg part nth)))
\r
79 diff --git a/notmuch-show.c b/notmuch-show.c
\r
80 index 0200b9c..3c9c610 100644
\r
81 --- a/notmuch-show.c
\r
82 +++ b/notmuch-show.c
\r
83 @@ -657,6 +657,7 @@ static void
\r
84 format_part_content_json (GMimeObject *part)
\r
86 GMimeContentType *content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
\r
87 + const char *content_charset = g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset");
\r
88 GMimeStream *stream_memory = g_mime_stream_mem_new ();
\r
89 const char *cid = g_mime_object_get_content_id (part);
\r
90 void *ctx = talloc_new (NULL);
\r
91 @@ -664,6 +665,8 @@ format_part_content_json (GMimeObject *part)
\r
93 printf (", \"content-type\": %s",
\r
94 json_quote_str (ctx, g_mime_content_type_to_string (content_type)));
\r
95 + if (content_charset != NULL)
\r
96 + printf (", \"content-charset\": %s", json_quote_str (ctx, content_charset));
\r
99 printf(", \"content-id\": %s", json_quote_str (ctx, cid));
\r