Hi Ihor and Max,

Just a follow-up note that I am unlikely to be able to complete this patch 
anytime soon. Re-alignment of priorities because my need for :var header 
support in Org Babel is mitigated by a different method of injecting variables 
into Org Babel sections: Use noweb.

I find this more powerful than =:var=. The examples below show (1) setting a 
bash environment variable in screen, or (2) printing from a Python prompt after 
sshing to a remote computer. It is language agnostic. Because it uses 
PROPERTIES and not :var, it also lets me work in Org Column View mode.

* Header
:PROPERTIES:
:foo: 42
:END:

#+NAME: ex1-screen-bash
#+BEGIN_SRC screen
export foo="<<get_property("foo")>>"
#+END_SRC

#+NAME: ex2-ssh-python
#+BEGIN_SRC bash
ssh somewhere
python
print("<<get_property("foo")>>")
#+END_SRC

#+CALL: ex2-ssh-python()

#+RESULTS:
: foo


The relevant section from my library-of-babel is:

* Properties into header args
:PROPERTIES:
:hellomessage: hello
:END:

https://emacs.stackexchange.com/questions/41922/

#+NAME: get_property
#+BEGIN_SRC emacs-lisp :var prop_name="" :results silent
(org-with-point-at org-babel-current-src-block-location
  (org-entry-get nil prop_name t))
#+END_SRC

** Example Usage

*** Header arg

#+HEADER: :var prop_message=(org-entry-get nil "hellomessage" t)
#+BEGIN_SRC emacs-lisp
  (message prop_message)
#+END_SRC

#+RESULTS:
: hello

*** Noweb
#+BEGIN_SRC emacs-lisp :noweb yes
  (message "<<get_property("hellomessage")>>")
#+END_SRC

#+RESULTS:
: hello

#+BEGIN_SRC bash :noweb yes :results verbatim
echo "<<get_property("hellomessage")>>"
#+END_SRC

#+RESULTS:
: hello

If hope this helps someone if they need it.

  -k.

Reply via email to