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