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