I want org babel to take account of the dir header property when i use org-babel-tangle.
E.g.
#+begin_src bash :dir ~/blubb
echo $PWD
#+end_src
or even
#+begin_src bash :dir /ssh:someone@somewhere|sudo:anotherone@somewhere:somedir
echo $(hostname) $USER $PWD
#+end_src
When I do org-babel-tangle it creates a bash file with just the echo statement. I would like it to do a dir change, or wrap it in an ssh statement for the second example. (Same issue when I do org-export: the dir information is lost).
Has anybody found a solution for that?
This patch adds the ability to tangle to the header-args :dir value. I needed this to tangle to remote hosts. I'm sure it's not ready to be upstreamed, but I don't really know the first thing about making it ready, if anyone could provide some insight or guidance, I would appreciate it. It at least worked for me, twice. I have noticed that `file-exists-p` doesn't appear to work over tramp, and I was unable to find a emacs function that did work in my short search.
I have only tested this in the with a global property header-args setting :dir with a trailing slash, and without a trailing slash like the example below.
C-c C-c next line to load property
C-c C-c next source block to check if our connection works, we're sudo'd, and our to-be-tangled file doesn't already exist.
C-u C-c C-v C-t next source block to tangle only the single block. (C-u to tangle the single block isn't necessary in this demo because there is only one :tangle'd block, but I prefer to tangle one at a time)
C-c C-c next source block to check that we sucessfully tangled
Viola.