1

How can I tangle all source code blocks under the current org-heading?

1
  • So write one: org-narrow-to-subtree will do the narrowing, org-tangle will do the tangling and widen will get rid of the narrowing. What is the problem?
    – NickD
    Commented Mar 29 at 2:32

1 Answer 1

1

Thanks, NickD.

(defun org-tangle-org-heading ()
  (interactive)
  (org-narrow-to-subtree) 
  (org-babel-tangle)
  (widen)
)
1
  • save-excursion has nothing to do with preserving/restoring folding status - do C-h f save-excursion to read what it does. You are not changing the folding status by narrowing/widening the buffer.
    – NickD
    Commented Mar 29 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.