From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 57FC16DE012F for ; Mon, 28 Aug 2017 00:32:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.08 X-Spam-Level: X-Spam-Status: No, score=0.08 tagged_above=-999 required=5 tests=[AWL=-0.050, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eTbbWt3NGRL6 for ; Mon, 28 Aug 2017 00:32:35 -0700 (PDT) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by arlo.cworth.org (Postfix) with ESMTPS id D52CF6DE0A89 for ; Mon, 28 Aug 2017 00:32:34 -0700 (PDT) Received: by mail-wm0-f51.google.com with SMTP id t201so16060557wmt.1 for ; Mon, 28 Aug 2017 00:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EdwB5mQDWz4ObUPnWloXrqY+TX6x6lDzWLsLDKAXctE=; b=ftg80J00aJWSbP5zRWyjxy5w6ifv5NwmWbsInOGDKfYx+OWWqUoO7YQFb5SVu8Ydva fiEsV0Y6yLOU1FiJ9I7wA/uB1BdnLBeDxI2XvKfqoe8PxRGa0MhvhBAKubgZ8i6Z50Qa yT9/u2HuSyTWC31fr9SbzS/gxEqiurVku32DT1mctvpcOfv35BCqz763WusplusHyK0q 3h0e1TUfO30L/7kGApaW2HArJgLKpBd7AU4ly1sDec8vGqYpSaZ9nabuGoxcDJTxQqWg z0qrqfnvueKy91UnHQPUX98KE9QcxVKidmiUoybJcUlU8bSNWIgs6q0KYwioiwr4DBUM se2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EdwB5mQDWz4ObUPnWloXrqY+TX6x6lDzWLsLDKAXctE=; b=avYSD5o8wdUnKPVEwYGh9Lqn7VM5+DGc78Pb68RfUuvyXUlIky4MmH8oNoq8bURIcR ohDv3n85gKHIsWfw5CekHhiSPeMWNhyQPjqmyvxi02hsoU/C7dOJqKsE3XkPEbHuAIc4 NK8mbahbxLPU9aQwTGPoUwthEhWjhX7CbOt1Sqbon5sWyvGjpBb9ZF0M1yd3aOQg2Ea/ hqcFQN/rC9LQJzNcgNiLykiNl9tBPf+LoZ0rqDrGE8JrDw7BwdYosNwKcOPu2rVcVu7o gDPYzpb5VGa8j6yEwPL+vEq+sdZV4JXtsk3brLno/dfdFoJARDjrsnHN7cg1Wttk3YAF 0z1A== X-Gm-Message-State: AHYfb5gQCYEp5ci0sdev1uliicCYxdhRJ82jZdYGXhr+EeJcD8oY3Cca ahCLhstSjGrRD7kW X-Received: by 10.28.236.209 with SMTP id h78mr1927810wmi.166.1503905553153; Mon, 28 Aug 2017 00:32:33 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id z2sm4816356wmg.16.2017.08.28.00.32.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 00:32:32 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 2/2] emacs: show: allow user to insert rfc822 parts as messages Date: Mon, 28 Aug 2017 08:32:22 +0100 Message-Id: <1503905542-19961-3-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1503905542-19961-1-git-send-email-markwalters1009@gmail.com> References: <1503905542-19961-1-git-send-email-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Mon, 28 Aug 2017 07:32:36 -0000 This adds a part-handler function that uses notmuch-insert to insert an rfc822 part as a message in its own right. This allows the user to reply directly to that message. We use notmuch-maildir-fcc-with-notmuch-insert as that has builtin error handling/retry functionality, and it allows the user to specify tags to identify the inserted message. The format of the folder/tags line is the same as for Fcc: headers when using notmuch insert. --- emacs/notmuch-show.el | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index cd901e4..b3717d0 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -143,6 +143,20 @@ indentation." (const :tag "View interactively" notmuch-show-interactively-view-part))) +(defcustom notmuch-show-part-notmuch-insert-folder "" + "Default folder/tags to use when inserting rfc822 parts into the database. + +It should be of the form \"folder +tag1 -tag2\" where folder is +the folder (relative to the notmuch mailstore) to store the +message in, and tag1 and tag2 are tag changes to apply to the +stored message. This string is split using +`split-string-and-unquote', so a folder name containing spaces +can be specified by quoting each space with an immediately +preceding backslash or surrounding the entire folder name in +double quotes." + :group 'notmuch-show + :type 'string) + (defcustom notmuch-show-only-matching-messages nil "Only matching messages are shown by default." :type 'boolean @@ -1448,6 +1462,7 @@ reset based on the original query." (define-key map "o" 'notmuch-show-interactively-view-part) (define-key map "|" 'notmuch-show-pipe-part) (define-key map "m" 'notmuch-show-choose-mime-of-part) + (define-key map "i" 'notmuch-show-notmuch-insert-part) (define-key map "?" 'notmuch-subkeymap-help) map) "Submap for part commands") @@ -2463,6 +2478,26 @@ part to be treated as if it had that mime-type." (interactive) (notmuch-show-apply-to-current-part-handle #'mm-pipe-part)) +(defun notmuch-show--notmuch-insert-handle (handle) + "Notmuch insert the part associated with HANDLE." + ;; This is based on mm-pipe-part + (let* ((folder + (read-from-minibuffer "Folder/tags to insert part to: " + notmuch-show-part-notmuch-insert-folder))) + (mm-with-unibyte-buffer + (mm-insert-part handle) + (notmuch-maildir-fcc-with-notmuch-insert folder nil "Folder/tags to insert part to") + (message nil)))) + +(defun notmuch-show-notmuch-insert-part () + "If the current part is rfc822 then insert into the mailstore" + (interactive) + (let* ((part (notmuch-show-get-part-properties)) + (computed-type (plist-get part :computed-type))) + (if (notmuch-match-content-type computed-type "message/rfc822") + (notmuch-show-apply-to-current-part-handle + #'notmuch-show--notmuch-insert-handle) + (message "Not a message/rfc822 part.")))) (defun notmuch-show--mm-display-part (handle) "Use mm-display-part to display HANDLE in a new buffer. -- 2.1.4