--- /dev/null
+Return-Path: <dme@dme.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 CB93C431FD0\r
+ for <notmuch@notmuchmail.org>; Fri, 9 May 2014 01:22:37 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 NMzZoLGJPQLv for <notmuch@notmuchmail.org>;\r
+ Fri, 9 May 2014 01:22:33 -0700 (PDT)\r
+Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com\r
+ [74.125.82.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 17B1B431FC2 for <notmuch@notmuchmail.org>; Fri, 9 May 2014 01:22:29 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f51.google.com with SMTP id x13so3647861wgg.22\r
+ for <notmuch@notmuchmail.org>; Fri, 09 May 2014 01:22:26 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=oK8CjsG2vUKOfbQP7wpxaFip1nDBUHaD7V37BjIVB74=;\r
+ b=ZKaPS5xLEpX3WOGy/5SscouStixE/oADQBmiu4ujWNItcWaXxP+2XlBzyF/vJOI7BE\r
+ SIdFrRgBJD4ftrdfMT+0BCJpcvkf571pDFD1ZvasRZ6COxIuOSfHxQqVqlVbhbGLIY1D\r
+ j6JYJJou6wXDb49m19IsF22uc7NUVoO3u4wmmIimZ4JWPsh7Jx6D7m2FpBMcVepTe+dv\r
+ lqufBgw8TTeCfE1Z0oBmjwL9oOp5gR5WLs218nKt5gKvnt20GXQHf4BT6lAzG+FAodJy\r
+ Oa6SiZ4JP7DPxJW/i4AmYRLEse2VdXGhDoVHSCYPY5ka/Pi2UTRc8pYKXLFOb4uebuhV\r
+ 8CCQ==\r
+X-Gm-Message-State:\r
+ ALoCoQkf/YVRj3LVFrjONi3tlOV8RuhECd3RAAd3VguYSV86AlFxCBl8Elj4+cc9BUQNpmrX3gH9\r
+X-Received: by 10.194.92.81 with SMTP id ck17mr7381281wjb.14.1399623746643;\r
+ Fri, 09 May 2014 01:22:26 -0700 (PDT)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+ ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8])\r
+ by mx.google.com with ESMTPSA id\r
+ lj15sm3810945wic.13.2014.05.09.01.22.25 for <notmuch@notmuchmail.org>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Fri, 09 May 2014 01:22:25 -0700 (PDT)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+ id 1833410920F; Fri, 9 May 2014 09:22:23 +0100 (BST)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v1 3/3] emacs: Add `notmuch-show-save-message' to save\r
+ messages\r
+Date: Fri, 9 May 2014 09:22:23 +0100\r
+Message-Id: <1399623743-30478-4-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 2.0.0.rc0\r
+In-Reply-To: <1399623743-30478-1-git-send-email-dme@dme.org>\r
+References: <1399623743-30478-1-git-send-email-dme@dme.org>\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: Fri, 09 May 2014 08:22:38 -0000\r
+\r
+Following `notmuch-show-pipe-message', add a binding 'S' to save\r
+either the current or all open messages, depending on prefix argument.\r
+---\r
+ emacs/notmuch-show.el | 24 +++++++++++++++++++++++-\r
+ 1 file changed, 23 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 62c0be6..851e968 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1285,6 +1285,7 @@ reset based on the original query."\r
+ (define-key map "f" 'notmuch-show-forward-message)\r
+ (define-key map "r" 'notmuch-show-reply-sender)\r
+ (define-key map "R" 'notmuch-show-reply)\r
++ (define-key map "S" 'notmuch-show-save-message)\r
+ (define-key map "|" 'notmuch-show-pipe-message)\r
+ (define-key map "w" 'notmuch-show-save-attachments)\r
+ (define-key map "V" 'notmuch-show-view-raw-message)\r
+@@ -1769,6 +1770,24 @@ to show, nil otherwise."\r
+ (set-buffer-modified-p nil)\r
+ (view-buffer buf 'kill-buffer-if-not-modified)))\r
+ \r
++(put 'notmuch-show-save-message 'notmuch-doc\r
++ "Save the contents of the current message to a file.")\r
++(put 'notmuch-show-save-message 'notmuch-prefix-doc\r
++ "Save the thread as an mbox to a file.")\r
++(defun notmuch-show-save-message (entire-thread file)\r
++ "Save the contents of the current message (or thread) to FILE.\r
++\r
++If ENTIRE-THREAD is non-nil (or when invoked with a prefix\r
++argument), FILE will contain all open messages in the current\r
++thread (formatted as an mbox) rather than only the current\r
++message."\r
++ (interactive (let ((prompt (if current-prefix-arg\r
++ "Save all open messages to file: "\r
++ "Save message to command: ")))\r
++ (list current-prefix-arg (read-file-name prompt))))\r
++\r
++ (notmuch-show-pipe-message-internal entire-thread (concat " > " file)))\r
++\r
+ (put 'notmuch-show-pipe-message 'notmuch-doc\r
+ "Pipe the contents of the current message to a command.")\r
+ (put 'notmuch-show-pipe-message 'notmuch-prefix-doc\r
+@@ -1789,6 +1808,9 @@ message."\r
+ "Pipe message to command: ")))\r
+ (list current-prefix-arg (read-string prompt))))\r
+ \r
++ (notmuch-show-pipe-message-internal entire-thread (concat " | " command)))\r
++\r
++(defun notmuch-show-pipe-message-internal (entire-thread command-tail)\r
+ (let ((shell-command\r
+ (concat notmuch-command " show"\r
+ (if entire-thread\r
+@@ -1796,7 +1818,7 @@ message."\r
+ (mapconcat #'shell-quote-argument (notmuch-show-get-message-ids-for-open-messages) " OR "))\r
+ (concat " --format=raw "\r
+ (shell-quote-argument (notmuch-show-get-message-id))))\r
+- " | " command))\r
++ command-tail))\r
+ (cwd default-directory)\r
+ (buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
+ (with-current-buffer buf\r
+-- \r
+2.0.0.rc0\r
+\r