[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Apply patch from org document

From: Óscar Fuentes
Subject: Re: [O] Apply patch from org document
Date: Sun, 24 Jul 2016 15:26:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

"Charles C. Berry" <address@hidden> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]