all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] oddity tangling src_blk with :var [9.7-pre (release_9.6.26-1368-g1ae978 @ /home/minshall/.emacs.d/straight/build/org/)]
@ 2024-04-27 10:05 Greg Minshall
  2024-04-28 12:29 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Minshall @ 2024-04-27 10:05 UTC (permalink / raw)
  To: emacs-orgmode

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/)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-02 13:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-27 10:05 [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
2024-04-28 12:29 ` 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

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.