GNU bug report logs - #79147
Tangling source blocks with variables using drawer output includes unwanted new line in variable definition

Previous Next

Package: emacs;

Reported by: Vincent Koppelmans <vincentkoppelmans <at> gmail.com>

Date: Sat, 2 Aug 2025 06:27:03 UTC

Severity: normal

Full log


Message #8 received at 79147 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vincent Koppelmans <vincentkoppelmans <at> gmail.com>
Cc: 79147 <at> debbugs.gnu.org
Subject: Re: bug#79147: Tangling source blocks with variables using drawer
 output includes unwanted new line in variable definition
Date: Sat, 02 Aug 2025 11:01:35 +0300
> From: Vincent Koppelmans <vincentkoppelmans <at> gmail.com>
> Date: Fri, 01 Aug 2025 12:14:10 -0600
> 
> 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.

Thanks.

This seems to be a problem with Org, so please report it to the Org
developers first.




This bug report was last modified 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.