From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?=C3=93scar_Fuentes?= Subject: Re: Apply patch from org document Date: Sun, 24 Jul 2016 15:26:01 +0200 Message-ID: <87d1m3417a.fsf@wanadoo.es> References: <87h9bf52ic.fsf@wanadoo.es> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRJQD-0004he-Dc for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 09:26:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRJQ7-0007Eu-CJ for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 09:26:20 -0400 Received: from plane.gmane.org ([80.91.229.3]:42075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRJQ7-0007Eh-5H for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 09:26:15 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bRJQ0-0001zQ-8h for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 15:26:08 +0200 Received: from 30.red-83-58-75.dynamicip.rima-tde.net ([83.58.75.30]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Jul 2016 15:26:08 +0200 Received: from ofv by 30.red-83-58-75.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Jul 2016 15:26:08 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org "Charles C. Berry" writes: > On Sun, 24 Jul 2016, Óscar Fuentes wrote: > >> Is there a method for applying a patch/diff embedded in a code block? >> > > If by `embedded' you mean that the body of a src block is a patch such > as provided by `git format-patch', you could use the language `diff'. > `org-edit-src-code' (typing C-c ') with point in the block will open a > buffer with the body as its contents in Diff mode. You can use the > Diff menu to do various things like apply the patch. When you are done > another C-c ' will close the buffer. Interesting. For some reason the patch can't be applied with a single command (diff-ediff-patch is unable to figure out the target files, but Apply Hunk works fine; that's an issue to be discussed on the emacs ml, though.) Anyway this is more convenient than extracting the patch and applying it from a shell. > With some effort, you can follow ob-template.el[1] as a guide to > crafting ob-diff.el (say) to allow execution of src blocks, if you > think you need to go that far. Precisely, I was expecting to see a Babel module for diffs but writing one for this task is overkill. A function that extracts the current block, creates a patch and runs `patch' on it will do too and seems like an easy one to write. Will go down that route if the issue with diff-ediff-patch can't be fixed. Thank you Chuck.