[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG] oddity tangling src_blk with :var [9.7-pre (release_9.6.26-1368-g1
From: |
Greg Minshall |
Subject: |
[BUG] oddity tangling src_blk with :var [9.7-pre (release_9.6.26-1368-g1ae978 @ /home/minshall/.emacs.d/straight/build/org/)] |
Date: |
Sat, 27 Apr 2024 13:05:52 +0300 |
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
hi. the following org block describes a problem i noticed. possibly
the fix is simply issuing an appropriate error message (and aborting the
process of tangling.
thanks for looking at this when you have a chance. and, apologies if
this is a FAQ.
cheers, Greg
#+begin_src org
,** introduction
this is to show an oddity -- a bug, or a security feature? -- in
tangling a source code block that has a variable (=:var=) header
argument.
if the variable =org-babel-load-languages= includes the source type of
the code block (e.g., "shell", "python", etc.), the variable will be
set in the tangled file. if =org-babel-load-languages= does *not*
include that source type, the variable will be unset in the tangled
file. without any error message.
(note that in a running emacs, *removing* elements from
=org-babel-load-languages= doesn't seem to cause this problem to
appear. maybe this is because the relevant "ob-..." files have
already been loaded?)
to see this, first *tangle* this file, to get works.el, fails.el, and
variable.sh, and then evaluate this code block:
,#+name: DemonstrateBehavior
,#+begin_src sh :results output
./works.el
echo -n "works.el: "
./variable.sh
./fails.el
echo -n "fails.el: "
./variable.sh
,#+end_src
,#+RESULTS: DemonstrateBehavior
: works.el: 2.4
: fails.el:
notice that after running fails.el, the 2.4 disappears.
,** this is the test code and blocks
here is the variable to be included.
,#+name: variable
| 2.4 |
and, the code block that includes that variable
,#+begin_src sh :var variable=variable :shebang #!/bin/sh :tangle variable.sh
echo "${variable}"
,#+end_src
tangling with this works
,#+begin_src elisp :tangle works.el :shebang "#!/usr/bin/env -S emacs
--script"
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)))
(org-babel-tangle-file "maybe.org")
,#+end_src
tangling with this fails (notice the absence of =(shell . t)=)
,#+begin_src elisp :tangle fails.el :shebang "#!/usr/bin/env -S emacs
--script"
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)))
(org-babel-tangle-file "maybe.org")
,#+end_src
#+end_src
Emacs : GNU Emacs 30.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.18.0)
of 2023-11-20
Package: Org mode version 9.7-pre (release_9.6.26-1368-g1ae978 @
/home/minshall/.emacs.d/straight/build/org/)
- [BUG] oddity tangling src_blk with :var [9.7-pre (release_9.6.26-1368-g1ae978 @ /home/minshall/.emacs.d/straight/build/org/)],
Greg Minshall <=