--- /dev/null
+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 8F281431FC0\r
+ for <notmuch@notmuchmail.org>; Wed, 31 Jul 2013 11:39:26 -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 RKSg4g+qmZU2 for <notmuch@notmuchmail.org>;\r
+ Wed, 31 Jul 2013 11:39:19 -0700 (PDT)\r
+Received: from mail-we0-f172.google.com (mail-we0-f172.google.com\r
+ [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D15D3431FBF\r
+ for <notmuch@notmuchmail.org>; Wed, 31 Jul 2013 11:39:18 -0700 (PDT)\r
+Received: by mail-we0-f172.google.com with SMTP id t61so945022wes.31\r
+ for <notmuch@notmuchmail.org>; Wed, 31 Jul 2013 11:39:16 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=F6YaVJyFKGrwFVqM6vL3c/UQZaCw/ykxLo8nl1wCiw8=;\r
+ b=Egvf8eH0qbTuADp4UoOTzgBXoU5zsnVuJHawz0JXHHNnF4GUgGACxCyEmewGQHIcju\r
+ TuzXA2nrbWbpG7v03w5E28WuPYVlAaxk9qLWm2fHf4GGA5woRk3hRqToyEDYTSno5zj5\r
+ +JDWMlymQAvP7l6gW0O1nVSCRVJqUFYM1JVRfF1uSgHls0M1KPD66l+hrQjSNe/r8BkK\r
+ xY/q+ZSaywmf4YkLBbXw2c1ErifSSuRDJuWHyb5f/yARFtzI9k7Kg84otwXdAZPBGxDR\r
+ gkSiMVA7KxLFKecD48ASIGEAziQrsP1QIu8HcyMnAA8rhEndaFepkDw5dILfqgAtEpl9\r
+ 7tPA==\r
+X-Received: by 10.180.185.97 with SMTP id fb1mr197662wic.61.1375295955157;\r
+ Wed, 31 Jul 2013 11:39:15 -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 u9sm29541wif.6.2013.07.31.11.39.13\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Wed, 31 Jul 2013 11:39:14 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] emacs: bugfix attachment content-type as mime-type\r
+ handling\r
+Date: Wed, 31 Jul 2013 19:39:05 +0100\r
+Message-Id: <1375295945-30006-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <20130731022529.GU2214@mit.edu>\r
+References: <20130731022529.GU2214@mit.edu>\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: Wed, 31 Jul 2013 18:39:26 -0000\r
+\r
+Notmuch puts attachments in as declared content-type except when the\r
+content-type is application/octet-stream it tries to guess the type\r
+from the filename/extension. This means that viewing a pdf (for\r
+example) which is sent as application/octet-strem invokes the pdf\r
+viewer rather than just offering to save the part.\r
+\r
+Recent changes to the attachment handling (commit 1546387d) changed\r
+(broke) this. This patch stores the calculated mime-type with the part\r
+and changes the attachment part handlers can use it instead.\r
+---\r
+\r
+This is the same as v1 except that it uses the name computed-type\r
+rather than mime-type for the computed mime type.\r
+\r
+We may want to change some of the other uses of the mime-type variable\r
+name too but the view on irc was that that could wait.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+ emacs/notmuch-show.el | 7 +++++--\r
+ 1 files changed, 5 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index c4e0a99..82b70ba 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -892,6 +892,9 @@ If HIDE is non-nil then initially hide this part."\r
+ (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
+ (content-beg (point)))\r
+ \r
++ ;; Store the computed mime-type for later use (e.g. by attachment handlers).\r
++ (plist-put part :computed-type mime-type)\r
++\r
+ (if (not hide)\r
+ (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)\r
+ (button-put button :notmuch-lazy-part\r
+@@ -2055,10 +2058,10 @@ caller is responsible for killing this buffer as appropriate."\r
+ (message-id (notmuch-show-get-message-id))\r
+ (nth (plist-get part :id))\r
+ (buf (notmuch-show-generate-part-buffer message-id nth))\r
+- (content-type (plist-get part :content-type))\r
++ (computed-type (plist-get part :computed-type))\r
+ (filename (plist-get part :filename))\r
+ (disposition (if filename `(attachment (filename . ,filename)))))\r
+- (mm-make-handle buf (list content-type) nil nil disposition)))\r
++ (mm-make-handle buf (list computed-type) nil nil disposition)))\r
+ \r
+ (defun notmuch-show-apply-to-current-part-handle (fn)\r
+ "Apply FN to an mm-handle for the part containing point.\r
+-- \r
+1.7.9.1\r
+\r