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