X-Loop: help-debbugs@HIDDEN
Subject: bug#79147: Tangling source blocks with variables using drawer output includes unwanted new line in variable definition
Resent-From: Vincent Koppelmans <vincentkoppelmans@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 02 Aug 2025 06:27:03 +0000
Resent-Message-ID: <handler.79147.B.175411599211137 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79147
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 79147 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.175411599211137
(code B ref -1); Sat, 02 Aug 2025 06:27:03 +0000
Received: (at submit) by debbugs.gnu.org; 2 Aug 2025 06:26:32 +0000
Received: from localhost ([127.0.0.1]:33195 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ui5hO-0002tW-Uq
for submit <at> debbugs.gnu.org; Sat, 02 Aug 2025 02:26:31 -0400
Received: from lists.gnu.org ([2001:470:142::17]:47814)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <vincentkoppelmans@HIDDEN>)
id 1uhuHB-0000K4-ME
for submit <at> debbugs.gnu.org; Fri, 01 Aug 2025 14:14:44 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <vincentkoppelmans@HIDDEN>)
id 1uhuGn-0006nw-8y
for bug-gnu-emacs@HIDDEN; Fri, 01 Aug 2025 14:14:19 -0400
Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <vincentkoppelmans@HIDDEN>)
id 1uhuGl-0003aX-0k
for bug-gnu-emacs@HIDDEN; Fri, 01 Aug 2025 14:14:16 -0400
Received: by mail-pl1-x632.google.com with SMTP id
d9443c01a7336-23fe9a5e5e8so9173695ad.0
for <bug-gnu-emacs@HIDDEN>; Fri, 01 Aug 2025 11:14:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1754072052; x=1754676852; darn=gnu.org;
h=mime-version:message-id:date:user-agent:subject:to:from:from:to:cc
:subject:date:message-id:reply-to;
bh=/dmaZa9O5eJ/+c409dkFZyD88+U/D6PBLO4sjtYnZ44=;
b=mg1tn2EY5lH6tznoNJZgXt5MC1TcIdRkKQLRh/Nv26dJUGgOo7cKrjUvqvll6bOjNZ
qWvDO+AA3JRpcTcBKGPmsvs4EH0QCYTz/F/bkd47YLQLkuanoFv1ANNMUe8iV+e/q7/8
z7Bv760Ev7KyXlEiNhEcEWdYre8BYmo6Uf3AWelOmjjm6lRLYPEJUbAX7FNaLjrInFEp
3p1JxkE+7AnbPgyV6snALt5eHiCFkw8xCnLbjr2McFSMlpztRGktvWL2Sk32MYjMaFCI
kpjC1NucRFp2PSSvadeNIWacyZd3taM8hYv+68kuswDN7B1f0L5Z0MXFHfY5+vLfq1sL
si1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1754072052; x=1754676852;
h=mime-version:message-id:date:user-agent:subject:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=/dmaZa9O5eJ/+c409dkFZyD88+U/D6PBLO4sjtYnZ44=;
b=d6qe6Jbnp9GHa1XcejMKXs021fv9g6CMvdljEYvnSb742jOlxHl6MOc174r4kRmlVq
MfHfuTtHHzT9dokz3Jb62ZfosfZIACM1AxbyatAgv60f+dNJ7lZOZGtuHOGxqeliQ9um
lBJT10x7qb/bsTkVXjX0xBwNb2O7Q92GiUyUhfaNMul7/KzM7VRBiVBBEEcj0t6DDLjR
GnZpZ6xxkHhkcn3akFarKYAfPtAbPbhJpmkZdKmCRSMB1oAn0d5kxptKMU38Er/MMG2+
oD6nxmfmdFZS3V7eusJfbDfMmO89HPxrNTKNUw+pA/PXOjG2+SWrHmettL6PaPxZBRLF
q1EQ==
X-Gm-Message-State: AOJu0YwN2jej6IBYoXNmTt4i357lCI7wTvy+zNn/hbwcfM6FwxpVfzz3
/Izmi3L9AzwvMXoW4E/NYfsSlKWeHenvGVyqSTCbwMecyguKkMCktlp5wEkWHO1Lv3M=
X-Gm-Gg: ASbGnctJT2CK5NldRX8a0gHFDD0XuyP6PxMxTPox5mU1lIzWqzxB6+xnVEp4N8z9jgW
FeK25GLzvn/R3PQ2hkJieYzRrqECItvC/wJNXID94ep5rAf9IRIn1Fan1vX783mLP0Oa3L4+DE1
PLGAJfaUkosuIsbItqd3wF69uI4ay0L0Dz7fyWSh2onWZx81t9WmVpu3MRF5dkzS6KyjE+GnWkE
GZuPbzTyCNCGS3F2PCziUjTkzx3z3Z1feiotP1RiX+XNPeRlFpkdOWlEwlslJfe+T/jybZ9NJ7d
DpdiaCfZE5ekaFLud19WrQDEpPdatek/ltAjJg2WAX0zzQmTXMwQfK8cgwOI8BCW3syv1Z6lK+h
YzaOqlyILE0nrXlGiXDLAgcKR
X-Google-Smtp-Source: AGHT+IEgKOgaqRBSsSOJ4peVrHpiHWkQ9G9epIVMA7NdJspmVg0bF06PVpn7rM0wLGQ31oMPu1kp4A==
X-Received: by 2002:a17:902:c9cd:b0:240:11cd:8502 with SMTP id
d9443c01a7336-24246f6d417mr4044115ad.13.1754072052026;
Fri, 01 Aug 2025 11:14:12 -0700 (PDT)
Received: from Tuxedo ([155.98.225.50]) by smtp.gmail.com with ESMTPSA id
d9443c01a7336-241d1ef6cb7sm48527555ad.26.2025.08.01.11.14.10
for <bug-gnu-emacs@HIDDEN>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 01 Aug 2025 11:14:11 -0700 (PDT)
From: Vincent Koppelmans <vincentkoppelmans@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 31.0.50
Date: Fri, 01 Aug 2025 12:14:10 -0600
Message-ID: <87cy9eq58t.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::632;
envelope-from=vincentkoppelmans@HIDDEN; helo=mail-pl1-x632.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Mailman-Approved-At: Sat, 02 Aug 2025 02:26:29 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
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
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Vincent Koppelmans <vincentkoppelmans@HIDDEN> Subject: bug#79147: Acknowledgement (Tangling source blocks with variables using drawer output includes unwanted new line in variable definition) Message-ID: <handler.79147.B.175411599211137.ack <at> debbugs.gnu.org> References: <87cy9eq58t.fsf@HIDDEN> X-Gnu-PR-Message: ack 79147 X-Gnu-PR-Package: emacs Reply-To: 79147 <at> debbugs.gnu.org Date: Sat, 02 Aug 2025 06:27:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 79147 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 79147: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79147 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.