Hello org mode developers and experts,

I encountered the following issue which I believe may be an org mode bug:

Tangling a source block that contains a variable from another source block 
results in an additional incorrect new line at the end of the variable value in 
the tangled output file, /only/ when source block output type is set to 
'drawer'.

Here is a minimal example comparing regular source block output (correct) 
versus drawer output (error), tested with emacs -Q, GNU Emacs 31.0.50 (build 1, 
x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2025-05-27 
and Org 9.7.11:


Allow org blocks to evaluate shell code
=======================================

,----
| (org-babel-do-load-languages
|  'org-babel-load-languages
|  '((shell . t)))
`----


Tangle code block with variable input from other source block
=============================================================

Using regular source block output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Source block that generates the variable
----------------------------------------

,----
| echo "/example/path"
`----


Source block that takes in the variable and which gets tangled
--------------------------------------------------------------

,----
| echo "${idir}"
`----


Display the tangled block
-------------------------

,----
| cat test_default.sh
`----

Looks okay!


Using drawer source block output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Source block that generates the variable
----------------------------------------

,----
| echo "/example/path"
`----


Source block that takes in the variable and which gets tangled
--------------------------------------------------------------

,----
| echo "${idir}"
`----


Display the tangled block
-------------------------

,----
| cat test_drawer.sh
`----

We have a problem: the closing quote starts on a new line.

Best,

Vincent

Reply via email to