--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A71E56DE84D8\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Aug 2016 10:12:35 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.561\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.561 tagged_above=-999 required=5 tests=[AWL=-0.091,\r
+ SPF_NEUTRAL=0.652] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 2Oat7n_aAAlG for <notmuch@notmuchmail.org>;\r
+ Sun, 14 Aug 2016 10:12:26 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id CD7F86DE9630\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Aug 2016 09:08:25 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 0C9B9100090;\r
+ Sun, 14 Aug 2016 19:07:58 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, Nicolas Petton <nicolas@petton.fr>,\r
+ Daniel Kahn Gillmor <dkg@fifthhorseman.net>, notmuch@notmuchmail.org\r
+Subject: Re: Applying patches directly from emails?\r
+In-Reply-To: <87mvkh7y35.fsf@nikula.org>\r
+References: <87d1m58jzo.fsf@petton.fr>\r
+ <87fur0l6hg.fsf@alice.fifthhorseman.net> <8737mzt9o6.fsf@petton.fr>\r
+ <87mvkh7y35.fsf@nikula.org>\r
+User-Agent: Notmuch/0.22+61~geeecb9e (https://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 14 Aug 2016 19:07:57 +0300\r
+Message-ID: <m2wpjj72qq.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 14 Aug 2016 17:12:35 -0000\r
+\r
+On Sat, Aug 13 2016, Jani Nikula <jani@nikula.org> wrote:\r
+\r
+> On Sun, 24 Jul 2016, Nicolas Petton <nicolas@petton.fr> wrote:\r
+>> Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:\r
+>>> If you're asking about notmuch-emacs, I just use "|" (or ". |" if a\r
+>>> MIME subpart is the patch instead of the whole message) to pipe the\r
+>>> patch into some command i care about.\r
+>>\r
+>> That'd work, but I was hoping for something more integrated.\r
+>>\r
+>> For Emacs development & GNUS, there's `debbugs-gnu-apply-patch', which,\r
+>> given a root directory, will apply a patch, inlined or attached to the\r
+>> email, to the Emacs repository.\r
+>\r
+> I find most projects have their own peculiarities, and I'm not convinced\r
+> it's beneficial for notmuch-emacs to include code to do this. It's\r
+> fairly trivial to write shell scripts to do that, and you can then pipe\r
+> the message(s) to the script, doing the cd and any other things you want\r
+> done as part of the process. Moreover, such scripts are useful for users\r
+> of other MUAs as well.\r
+>\r
+> BR,\r
+> Jani.\r
+\r
+Jani is right that such a special feature is not something that should be\r
+included in everyone's emacs environment -- and to have such a\r
+functionality in extra e.g. notmuch-devel.el would require considerable\r
+effort to get good...\r
+\r
+That said, I have this in my ~/.emacs.d/notmuch-config.el (where mbox is verb):\r
+\r
+;; Patch picking code in mbox-open-notmuch-messages() adapted\r
+;; from id:1325844199-1812-1-git-send-email-dme@dme.org (2012-01-06)\r
+;; function notmuch-dev-review-patch(). GPLv3+\r
+\r
+(defun mbox-open-notmuch-messages ()\r
+ "When this function is executed in notmuch-show buffer all the \"open\"\r
+messages will be written to the file ~/tmp-mbox (overwriting it)."\r
+ (interactive)\r
+ (let ((search-terms-list (notmuch-show-get-message-ids-for-open-messages))\r
+ (buffer (get-buffer-create "* Contents of ~/tmp-mbox *")))\r
+ (set-buffer buffer)\r
+ (setq buffer-read-only nil)\r
+ (buffer-disable-undo)\r
+ (pop-to-buffer buffer)\r
+ (goto-char (point-max))\r
+ (if (> (buffer-size) 0)\r
+ (insert "\n\n"))\r
+ (insert (format-time-string\r
+ "%c: Writing the following messages to ~/tmp-mbox:\n ")\r
+ (mapconcat 'identity search-terms-list "\n ") "\n")\r
+ (with-temp-file "~/tmp-mbox"\r
+ (call-process notmuch-command nil t nil "show" "--format=mbox"\r
+ (mapconcat 'identity search-terms-list " OR ")))\r
+ (insert "\nMessages in ~/tmp-mbox:\n")\r
+ (call-process "mail" nil t nil\r
+ "-H" "-f" (expand-file-name "~/tmp-mbox"))))\r
+\r
+\r
+After using that I usually execute git am ~/tmp-mbox\r
+\r
+\r
+Tomi\r