From: Greg Minshall <minshall@umich.edu>
To: emacs-orgmode@gnu.org
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 [thread overview]
Message-ID: <139512.1714212352@archlinux> (raw)
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/)
next reply other threads:[~2024-04-27 10:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-27 10:05 Greg Minshall [this message]
2024-04-28 12:29 ` [BUG] oddity tangling src_blk with :var [9.7-pre (release_9.6.26-1368-g1ae978 @ /home/minshall/.emacs.d/straight/build/org/)] Ihor Radchenko
2024-04-28 18:54 ` Greg Minshall
2024-04-29 12:48 ` Ihor Radchenko
2024-04-30 7:38 ` Greg Minshall
2024-04-30 10:33 ` Ihor Radchenko
2024-05-01 17:41 ` Greg Minshall
2024-05-01 17:47 ` Ihor Radchenko
2024-05-02 13:01 ` Greg Minshall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=139512.1714212352@archlinux \
--to=minshall@umich.edu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.