emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-orgmode@gnu.org
Subject: Re: Apply patch from org document
Date: Sun, 24 Jul 2016 15:26:01 +0200	[thread overview]
Message-ID: <87d1m3417a.fsf@wanadoo.es> (raw)
In-Reply-To: alpine.OSX.2.20.1607231859510.1030@charles-berrys-macbook.local

"Charles C. Berry" <ccberry@ucsd.edu> 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	other threads:[~2016-07-24 13:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-24  0:00 Apply patch from org document Óscar Fuentes
2016-07-24  2:12 ` Charles C. Berry
2016-07-24 13:26   ` Óscar Fuentes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1m3417a.fsf@wanadoo.es \
    --to=ofv@wanadoo.es \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).