Function: org-babel-detangle
org-babel-detangle is an interactive and byte-compiled function
defined in ob-tangle.el.gz.
Signature
(org-babel-detangle &optional SOURCE-CODE-FILE)
Documentation
Propagate changes from current source buffer back to the original Org file.
This requires that code blocks were tangled with link comments which enable the original code blocks to be found.
Optional argument SOURCE-CODE-FILE is the file path to be used instead of the current buffer.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-tangle.el.gz
;; de-tangling functions
(defun org-babel-detangle (&optional source-code-file)
"Propagate changes from current source buffer back to the original Org file.
This requires that code blocks were tangled with link comments
which enable the original code blocks to be found.
Optional argument SOURCE-CODE-FILE is the file path to be used instead
of the current buffer."
(interactive)
(save-excursion
(when source-code-file (find-file source-code-file))
(goto-char (point-min))
(let ((counter 0) new-body end)
(while (re-search-forward org-link-bracket-re nil t)
(if (and (match-string 2)
(re-search-forward
(concat " " (regexp-quote (match-string 2)) " ends here") nil t))
(progn (setq end (match-end 0))
(forward-line -1)
(save-excursion
(when (setq new-body (org-babel-tangle-jump-to-org))
(org-babel-update-block-body new-body)))
(setq counter (+ 1 counter)))
(setq end (point)))
(goto-char end))
(prog1 counter (message "Detangled %d code blocks" counter)))))