I have a code blocks for a domain specific input files that I want to have in a single org file and tangle them out to separate files (see Tangling non-code files to separate files). However, my source has things in it that look like org-mode headings, e.g.:

#+BEGIN_SRC fundamental :tangle test.inp
* minimize
*

open unit 10 read form name methanol.rtf
read rtf card unit 10
close unit 10
...
#+END_SRC

and these don't get tangled. Removing the * minimize line or putting any amount of text before it does not solve the problem. The "headers" aren't highlighted but they still have folding etc., and emacs won't let me put spaces in front of them.

Seems like a bug, but a workaround would be helpful.

up vote 3 down vote accepted

The problem is that you did trick org-mode. You did not use C-' to input the text block.

If you do so, the org-mode syntax is escaped as the following example shows. Note the commas before the stars! They are automatically added by org-babel.

#+BEGIN_SRC fundamental :tangle test.inp
,* minimize
,*

open unit 10 read form name methanol.rtf
read rtf card unit 10
close unit 10
...

#+END_SRC

If you input a new source code block the sequence is:

  1. Start on a new line and press tab to get the right indentation.
  2. Input <s and press tab for the easy template that generates a source code block.
  3. Input fundamental :tangle test.inp to complete the header of the source code block
  4. Press C-' to edit the source code block.
  5. In the newly opened buffer paste your text.
  6. Finish editing the source code block with C-'
  • Lesson learned, haha! – salotz Jan 18 '16 at 21:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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