emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Tangling org file with nested org source block


From: Thibault Marin
Subject: [O] Tangling org file with nested org source block
Date: Wed, 27 Sep 2017 21:49:49 -0500
User-agent: mu4e 0.9.18; emacs 25.2.2

Hi list,

I am trying to tangle the following org file:

,----
| #+PROPERTY: header-args :tangle output.org
| 
| #+BEGIN_SRC org
| 
| ,* Test
| 
| ,#+BEGIN_SRC org
| ,,#+BEGIN_SRC emacs-lisp
| '(1 2 3)
| ,,#+END_SRC
| ,#+END_SRC
| 
| #+END_SRC
`----

(note the double commas at the beginning of the inner-most block).
I am working on master (Org mode version 9.1.1 (release_9.1.1-79-g731e1c.dirty @
.../org-mode/lisp/)), and I get the following:

,---- output.org
| * Test
| 
| #+BEGIN_SRC org
| #+BEGIN_SRC emacs-lisp
| '(1 2 3)
| #+END_SRC
| #+END_SRC
`----

The inner block does not get escaped which causes issues when exporting.  Trying
to investigate this, I ended up in the ~org-babel-tangle-single-block~ function
in =ob-tangle.el=.  The second comma is removed by a call to
~org-unescape-code-in-string~ (l. 497).  Since the incoming string has already
been cleaned-up (i.e. the first comma removed) at that point I wonder why this
call is necessary.  When I remove that call to ~org-unescape-code-in-string~,
tangling produces the output I expect:

,---- output.org
| * Test
| 
| #+BEGIN_SRC org
| ,#+BEGIN_SRC emacs-lisp
| '(1 2 3)
| ,#+END_SRC
| #+END_SRC
`----

where the inner source block is properly escaped.

So, is the call to ~org-unescape-code-in-string~ required?  Does anyone know if
there is a way to get the desired output?

Thanks in advance,
thibault



reply via email to

[Prev in Thread] Current Thread [Next in Thread]