GNU bug report logs -
#79147
Tangling source blocks with variables using drawer output includes unwanted new line in variable definition
Previous Next
Full log
View this message in rfc822 format
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
#+begin_src elisp :tangle no :results output none
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)))
#+end_src
* Tangle code block with variable input from other source block
** Using regular source block output
*** Source block that generates the variable
#+name: my_temp_dir1
#+begin_src bash :tangle no
echo "/example/path"
#+end_src
#+RESULTS: my_temp_dir1
: /example/path
*** Source block that takes in the variable and which gets tangled
#+begin_src sh :var idir=my_temp_dir1 :tangle test_default.sh
echo "${idir}"
#+end_src
*** Display the tangled block
#+begin_src sh :tangle no :results output drawer
cat test_default.sh
#+end_src
#+RESULTS:
:results:
idir='/example/path'
echo "${idir}"
:end:
Looks okay!
** Using drawer source block output
*** Source block that generates the variable
#+name: my_temp_dir2
#+begin_src bash :tangle no :results output drawer
echo "/example/path"
#+end_src
#+RESULTS: my_temp_dir2
:results:
/example/path
:end:
*** Source block that takes in the variable and which gets tangled
#+begin_src sh :var idir=my_temp_dir2 :tangle test_drawer.sh
echo "${idir}"
#+end_src
*** Display the tangled block
#+begin_src sh :tangle no :results output drawer
cat test_drawer.sh
#+end_src
#+RESULTS:
:results:
idir='/example/path
'
echo "${idir}"
:end:
We have a problem: the closing quote starts on a new line.
Best,
Vincent
This bug report was last modified 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.