From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <david@tethera.net>
Received: from localhost (localhost [127.0.0.1])
 by arlo.cworth.org (Postfix) with ESMTP id 18C696DE0243
 for <notmuch@notmuchmail.org>; Fri,  1 Apr 2016 16:24:20 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at cworth.org
X-Spam-Flag: NO
X-Spam-Score: -0.021
X-Spam-Level: 
X-Spam-Status: No, score=-0.021 tagged_above=-999 required=5
 tests=[AWL=-0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]
 autolearn=disabled
Received: from arlo.cworth.org ([127.0.0.1])
 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id JTW_-e-SBOo2 for <notmuch@notmuchmail.org>;
 Fri,  1 Apr 2016 16:24:11 -0700 (PDT)
Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])
 by arlo.cworth.org (Postfix) with ESMTPS id 3EB1D6DE00DF
 for <notmuch@notmuchmail.org>; Fri,  1 Apr 2016 16:24:11 -0700 (PDT)
Received: from remotemail by fethera.tethera.net with local (Exim 4.84)
 (envelope-from <david@tethera.net>)
 id 1am8Qj-0000qu-8T; Fri, 01 Apr 2016 19:24:41 -0400
Received: (nullmailer pid 27810 invoked by uid 1000);
 Fri, 01 Apr 2016 23:24:05 -0000
From: David Bremner <david@tethera.net>
To: Matthew Lear <matt@bubblegen.co.uk>
Cc: notmuch@notmuchmail.org, David Edmondson <dme@dme.org>,
 Mark Walters <markwalters1009@gmail.com>
Subject: Re: (emacs) Parsing problems replying to encrypted html
In-Reply-To: <87mvpdgp38.fsf@bubblegen.co.uk>
References: <f50e07855e9bbbdd780ef925d8e2d879.squirrel@webmail.plus.net>
 <m2a8miwc6x.fsf@dme.org>
 <c4ff9f2c141441be10b1cb4b1e0300a7.squirrel@webmail.plus.net>
 <56DD48B3.90604@bubblegen.co.uk> <87mvqatr6y.fsf@zancas.localnet>
 <87h9gigfyz.fsf@bubblegen.co.uk> <87pov58b9y.fsf@zancas.localnet>
 <m260wxkvf3.fsf@guru.guru-group.fi> <87wpp76ctq.fsf@zancas.localnet>
 <m2shzvrccn.fsf@dme.org> <87h9fm315q.fsf@bubblegen.co.uk>
 <87oa9timv7.fsf@zancas.localnet>
 <575b60a1d39a1ecc7d06e5c0d625be61.squirrel@webmail.plus.net>
 <87bn5tjw5e.fsf@tesseract.cs.unb.ca>
 <5ed42cd5aafdc045b5d9e1b918d10748.squirrel@webmail.plus.net>
 <87mvpdgp38.fsf@bubblegen.co.uk>
User-Agent: Notmuch/0.21+74~g6c60fb1 (http://notmuchmail.org) Emacs/24.5.1
 (x86_64-pc-linux-gnu)
Date: Fri, 01 Apr 2016 20:24:05 -0300
Message-ID: <87lh4wj4kq.fsf@zancas.localnet>
MIME-Version: 1.0
Content-Type: text/plain
X-BeenThere: notmuch@notmuchmail.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: "Use and development of the notmuch mail system."
 <notmuch.notmuchmail.org>
List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
List-Post: <mailto:notmuch@notmuchmail.org>
List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Apr 2016 23:24:20 -0000

Matthew Lear <matt@bubblegen.co.uk> writes:

>>> Hmm. I can't duplicate the problem replying from show mode with the test
>>> message you provided.  Is the appropriate key in your gpg keyring?
>>
>> Yes it is. I get the gpg gui prompt when opening the encrypted email and
>> can decrypt it prior to show. As I suspected earlier in the thread, I
>> wondered if this was related to some emacs config settings/options that I
>> have. I can't immediately think what they would be though, and why they
>> would trigger this particular issue for html only. Strange...
>
> Do you have the following in your .emacs ?
>
> (setq notmuch-multipart/alternative-discouraged '("text/plain"))
>
> I think that's the work/not-work switch. I'm not sure if it makes sense
> or not in terms of seeing the behaviour I do.

OK, with that setting I can duplicate the problem replying to encrypted
HTML mail.

It's also true that notmuch-reply doesn't include the content in the
html version of the multipart/alternative. Unlike notmuch show, it
doesn't have the ability to send parts later, so I guess that's a
problem there.

The following patch seems to fix it for me. What I haven't worked out is
if it will break other things. Perhaps David E or Mark (in copy) can
comment on whether this is a sensible change, given that we now give the
user control of showing the part on the emacs side.

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 3c6d685..cd88d79 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -690,7 +690,7 @@ notmuch_reply_format_sprinter(void *ctx,
 
     /* Start the original */
     sp->map_key (sp, "original");
-    format_part_sprinter (ctx, sp, node, TRUE, TRUE, FALSE);
+    format_part_sprinter (ctx, sp, node, TRUE, TRUE, TRUE);
 
     /* End */
     sp->end (sp);