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 00E306DE0A5B for ; Mon, 28 Aug 2017 03:26:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.45 X-Spam-Level: X-Spam-Status: No, score=0.45 tagged_above=-999 required=5 tests=[AWL=-0.183, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 HiXiAt2m32eB for ; Mon, 28 Aug 2017 03:26:14 -0700 (PDT) Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by arlo.cworth.org (Postfix) with ESMTPS id 13FE26DE00C4 for ; Mon, 28 Aug 2017 03:26:14 -0700 (PDT) Received: by mail-wm0-f46.google.com with SMTP id b14so12047980wme.0 for ; Mon, 28 Aug 2017 03:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:subject:in-reply-to:references:from:date:message-id:mime-version; bh=cloeljgrxXBTbSL5iSmttXHz4kZXxGqekK2XC2TRZoM=; b=w65t3YzfL8mUkC5uqVlUXZTHoST6gBU4s5l+K7RnYbljga18DYs/NxN2in1EDx8xsB OY6dE8KTQJro2m2mV87Rjp2yZHP19/rnqBMGVRdQntOMFxA9iS3JHv9cX0dPIXh0kdTy UB16MewRcZyZRamUvgDDdOooqczdRkt7M3iYTYwS/lTHaI1L79BmSIsC9t6SyZuvrjSg 0BR6OGVC/KnRPKJE5K/16+6aiDzV0CG7+CEQgx5qFklHSMFYiNjCimcRrwZ4b58EsSQ0 fKm0fm4t1uLmPd1TsqjwLAG0UPaxWVLBK7ftRaQw3REB5Tkwu4SupI2w5jXQmcArkJuM TJww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:in-reply-to:references:from:date :message-id:mime-version; bh=cloeljgrxXBTbSL5iSmttXHz4kZXxGqekK2XC2TRZoM=; b=XCcudLdDV1MPA8k3n7sbwrNhTeST+QEEaEmiCOSsbEAAJeS26URt9EXBBocy+UsPJ/ Z3t4oTHRc+Lliz4LWR9m73PjMvc94ZJhQt8P9jXOWn3FTj4GRslLbyVF04aBVPNh4wgY lYck1wv8jWINDzpoWG3/4YKn5cfBcSNh6q2Wo0ryoJhNuPv2xwzEt33Blb5jWnRSIr7G tjtoDOuERXaHzw56CEYYwitzyA4DhgzPo3Btpd1so/32WQUpuf3AzRtTh9lYhdQXfiSk pXgNAR0k1Nqt1EpoNFt8pWIe1Gc6EvkQfcEP0ztH7MSCFekYwYAbHPSs5TVJ4kE65znB XY2g== X-Gm-Message-State: AHYfb5iIC/XEj1YEiKcyT1MdAZFODTAIOtEGDLdNDJrW+zf8PjNNbyim a6e3j0yz1Fw9P+tH7Y/Fhg== X-Received: by 10.80.183.202 with SMTP id i10mr72619ede.147.1503915972245; Mon, 28 Aug 2017 03:26:12 -0700 (PDT) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by smtp.gmail.com with ESMTPSA id b26sm22280edj.70.2017.08.28.03.26.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 03:26:08 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id dc0249ba; Mon, 28 Aug 2017 10:26:07 +0000 (UTC) To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] emacs: show: allow user to insert rfc822 parts as messages In-Reply-To: <1503905542-19961-3-git-send-email-markwalters1009@gmail.com> References: <1503905542-19961-1-git-send-email-markwalters1009@gmail.com> <1503905542-19961-3-git-send-email-markwalters1009@gmail.com> X-HGTTG: agrajag From: David Edmondson Date: Mon, 28 Aug 2017 11:26:07 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain 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 10:26:15 -0000 On Monday, 2017-08-28 at 08:32:22 +0100, Mark Walters wrote: > 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 See previous comments. > +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 Missing a period. > + (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)))) Why this? It would be nice to have a comment explaining it. > + > +(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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch dme. -- All those lines and circles, to me, a mystery.