Re: [notmuch] [PATCH] Decode headers in reply
authorCarl Worth <cworth@cworth.org>
Tue, 13 Apr 2010 17:14:22 +0000 (10:14 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:37 +0000 (09:36 -0800)
26/fba8c190983974e482e7024b2235578951edfe [new file with mode: 0644]

diff --git a/26/fba8c190983974e482e7024b2235578951edfe b/26/fba8c190983974e482e7024b2235578951edfe
new file mode 100644 (file)
index 0000000..e125d43
--- /dev/null
@@ -0,0 +1,104 @@
+Return-Path: <cworth@cworth.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id C1EAD4196F2\r
+       for <notmuch@notmuchmail.org>; Tue, 13 Apr 2010 10:14:23 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.89\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5\r
+       tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]\r
+       autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id smj3gvDJz9ZT; Tue, 13 Apr 2010 10:14:22 -0700 (PDT)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A3622431FC1;\r
+       Tue, 13 Apr 2010 10:14:22 -0700 (PDT)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id 41F765883A6; Tue, 13 Apr 2010 10:14:22 -0700 (PDT)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: Michal Sojka <sojkam1@fel.cvut.cz>, notmuch@notmuchmail.org\r
+Subject: Re: [notmuch] [PATCH] Decode headers in reply\r
+In-Reply-To: <1267602656-24940-1-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <87r5o1etjb.fsf@steelpick.localdomain>\r
+       <1267602656-24940-1-git-send-email-sojkam1@fel.cvut.cz>\r
+Date: Tue, 13 Apr 2010 10:14:22 -0700\r
+Message-ID: <87hbnfl1g1.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 13 Apr 2010 17:14:23 -0000\r
+\r
+--=-=-=\r
+\r
+On Wed,  3 Mar 2010 08:50:56 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
+> When headers contain non-ASCII characters, they are encoded according\r
+> to rfc2047. Nomtuch reply command emits the headers in the encoded\r
+> form, which makes them hard to read by humans who compose the reply.\r
+\r
+This feature is obviously extremely handy. So thank you, Michal! I've\r
+now pushed this out.\r
+\r
+I think the implementation is over-complicated, but that's almost\r
+entirely the fault of GMime and GObject, not yours. We are creating a\r
+GMime object to represent the message and then asking GMime to print\r
+it. GMime then does what it should (assuming the message is going to be\r
+sent over SMTP) and encodes the headers.\r
+\r
+We don't happen to want this encoding, since the client wants to allow\r
+the user to edit the message and only encode the final result. There is\r
+a single function that GMime provides for the decoding\r
+(g_mime_utils_header_decode_text) but arranging for GMime to call this\r
+function on each header requires over 200 lines of code with the hideous\r
+GObject boilerplate and a bunch of replicated parsing code.\r
+\r
+Meanwhile, what's GMime actually doing for us here? We have the original\r
+decoded strings in the first place. And we know how to print "Subject:",\r
+"To:", and "From:". So what do we need GMime for the headers?\r
+\r
+The only thing I can think of is that GMime is also inserting\r
+RFC-compliant wrapping of long lines. But since we want to let the user\r
+edit the subject, etc. anyway, don't we have to rely on the client to do\r
+that *anyway*?\r
+\r
+Incidentally, it looks like message-mode does have support to do\r
+RCF-compliant line wrapping if I hit M-q (`fill-paragraph') on a long\r
+Subject: line but it doesn't appear to do that automatically. Instead,\r
+it will just send a non-RFC-compliant message if I just type a long\r
+Subject line. That looks like yet another reason to have a\r
+notmuch-message-mode that extends message-mode and fixes several issues\r
+we've been identifying.\r
+\r
+Back to the patch though, I have pushed this out, but I've also added a\r
+TODO item for simplifying this stuff. I think a handful of calls to\r
+printf would be much better than this big pile of GObject boilerplate\r
+and ad-hoc parsing.\r
+\r
+-Carl\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLxKZu6JDdNq8qSWgRApiaAJsG+N+0E7L//JWZCRgm6KohIIX3bgCghJpZ\r
+GwSPBPUW3nb4BogjszC0S9Y=\r
+=sA6V\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r