From 8bfbfe48db844191531d1b6e785e3d296bf94e1e Mon Sep 17 00:00:00 2001 From: James Patrick Date: Sat, 20 Nov 2021 15:37:15 -0500 Subject: [PATCH] Added diff for babel tangle --- emacs/org/+babel-diff.el | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 emacs/org/+babel-diff.el diff --git a/emacs/org/+babel-diff.el b/emacs/org/+babel-diff.el new file mode 100644 index 0000000..3dd5f0d --- /dev/null +++ b/emacs/org/+babel-diff.el @@ -0,0 +1,9 @@ +(defun org-babel-execute:diff (body params) + "Applies diff patches. Use with care. +See https://emacs.stackexchange.com/questions/63517/org-mode-evaluate-diff-code-block" + (with-temp-buffer + (insert body "\n") + (shell-command-on-region (point-min) (point-max) "patch --strip=1" "*patch*") + (prog1 + (with-current-buffer "*patch*" (buffer-string)) + (kill-buffer "*patch*"))))