Skip to content

Instantly share code, notes, and snippets.

@howardabrams
Created January 13, 2020 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howardabrams/b2eae5ea6dc346d88da3bc8e2dfaac64 to your computer and use it in GitHub Desktop.
Save howardabrams/b2eae5ea6dc346d88da3bc8e2dfaac64 to your computer and use it in GitHub Desktop.

Tangling an org-mode file when the :tangle parameter is set to yes, writes each block into a single file based on a language and the name of the org file. In this case, my file is /tmp/example.org, so all Ruby blocks will be written into a single file, /tmp/example.rb. But this can be change as shown below.

Section One

For this example, the :tangle parameter is simply yes, which grabs the defaults:

echo In section one

Since this block is Ruby, it will be written to a different file.

print("In section one")

Let’s do some python, which will be different since we change its tangling location:

puts 'In section one'

Section Two

The blocks in this section are written to multiple files by explicitly specifying the :tangle parameter:

echo In section two

Another script, tangled into a different file:

echo In section two ... yet again.

Section Three

For these blocks, the tangled filename has been overridden by a subtree’s property setting:

echo In section three

This block will be combined with the previous one:

echo Still in section three

Summary

Did this work?

ls /tmp/example* /tmp/section*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment