[PATCH 2/4] emacs: show: handle inline patch fake parts at top level
authorMark Walters <markwalters1009@gmail.com>
Sat, 4 May 2013 13:01:15 +0000 (14:01 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:36 +0000 (09:54 -0800)
d1/2b7188941ae3f32beac82c5f76a898c5f3723a [new file with mode: 0644]

diff --git a/d1/2b7188941ae3f32beac82c5f76a898c5f3723a b/d1/2b7188941ae3f32beac82c5f76a898c5f3723a
new file mode 100644 (file)
index 0000000..f739994
--- /dev/null
@@ -0,0 +1,108 @@
+Return-Path: <markwalters1009@gmail.com>\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 E4C1B431FDC\r
+       for <notmuch@notmuchmail.org>; Sat,  4 May 2013 06:01:37 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 uDe3ueVzlkbw for <notmuch@notmuchmail.org>;\r
+       Sat,  4 May 2013 06:01:33 -0700 (PDT)\r
+Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com\r
+ [74.125.82.41])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 266E9431FBC   for <notmuch@notmuchmail.org>; Sat,  4 May 2013 06:01:30 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f41.google.com with SMTP id y10so1469269wgg.2\r
+       for <notmuch@notmuchmail.org>; Sat, 04 May 2013 06:01:29 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+       :references; bh=+5bHoQkju9hjtsqoot94GVCpbkWLkKiOxO701YFRpWQ=;\r
+       b=O1e9YhwJpNJwY3uKcxL6U3Z+LqDKTeSvkEu1xDDkjbBU/kaNfq5KrwKyaPR7Apuy7d\r
+       n1HQYR0NcJnQe7SolQIXZ5uNFbiiIIiqoeAguHKToPBb4Jyc9L72/TrH88uFnz+M8Gqp\r
+       x85bFBuS32fgMaSCdbhnvweUw4i2mRKD5tEbUcFRvpJTbPjhTIqgDyr0gsQqccsCm2pM\r
+       o/Y4frSe6C57LZuO3bN5qgzfFTaXmXV6nIRd3ol69tSjrXNdnKNKb9f9jleD2dFapvZU\r
+       L9BQUg/jwjhhgd3dc58p0OvBE3fpICyHtgtvApD0mJqNvUrwMfi2FzefxaEYsmOA5I/8\r
+       GgZQ==\r
+X-Received: by 10.194.62.18 with SMTP id u18mr18082928wjr.53.1367672489106;\r
+       Sat, 04 May 2013 06:01:29 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id ek7sm2797774wic.4.2013.05.04.06.01.27\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 04 May 2013 06:01:28 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] emacs: show: handle inline patch fake parts at top level\r
+Date: Sat,  4 May 2013 14:01:15 +0100\r
+Message-Id: <1367672478-12247-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1367672478-12247-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1367672478-12247-1-git-send-email-markwalters1009@gmail.com>\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: Sat, 04 May 2013 13:01:38 -0000\r
+\r
+The inline patch fake part handler also modifies the content-type so\r
+handle this in notmuch-show-insert-bodypart too.\r
+---\r
+ emacs/notmuch-show.el |    4 +++-\r
+ emacs/notmuch-wash.el |    2 +-\r
+ 2 files changed, 4 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 3b9a2ad..f984143 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -814,7 +814,7 @@ message at DEPTH in the current thread."\r
\r
+ ;; Handler for wash generated inline patch fake parts.\r
+ (defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type)\r
+-  (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch"))\r
++  (notmuch-show-insert-part-*/* msg part content-type nth depth declared-type))\r
\r
+ (defun notmuch-show-insert-part-text/html (msg part content-type nth depth declared-type)\r
+   ;; text/html handler to work around bugs in renderers and our\r
+@@ -888,6 +888,8 @@ If HIDE is non-nil then initially hide this part."\r
+   (let* ((content-type (downcase (plist-get part :content-type)))\r
+        (mime-type (or (and (string= content-type "application/octet-stream")\r
+                            (notmuch-show-get-mime-type-of-application/octet-stream part))\r
++                      (and (string= content-type "inline patch")\r
++                           "text/x-diff")\r
+                       content-type))\r
+        (nth (plist-get part :id))\r
+        (beg (point)))\r
+diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
+index 80c475c..8a68819 100644\r
+--- a/emacs/notmuch-wash.el\r
++++ b/emacs/notmuch-wash.el\r
+@@ -365,7 +365,7 @@ for error."\r
+         (setq patch-end (match-beginning 0)))\r
+       (save-restriction\r
+       (narrow-to-region patch-start patch-end)\r
+-      (setq part (plist-put part :content-type "inline-patch-fake-part"))\r
++      (setq part (plist-put part :content-type "inline patch"))\r
+       (setq part (plist-put part :content (buffer-string)))\r
+       (setq part (plist-put part :id -1))\r
+       (setq part (plist-put part :filename\r
+-- \r
+1.7.9.1\r
+\r