Recently, I added to this answer to the question “How to specify a directory to tangle all code blocks into”, the following comment: “AFAICS, specifying a subdirectory in the argument of :tangle doesn't have any effect”.
At least that is what I see with the following property:
#+PROPERTY: header-args :padline no :mkdirp yes :tangle my/sub/directory/myfile.foo :exports both :noweb yes :eval always
and tangling triggered with org-babel-tangle
(C-c C-v t
), the file myfile.foo
is created in the current directory and not in the subdirectory my/sub/directory/
.
But I discovered that if the tangling is run non-interactively (in batch mode, outside of Emacs
) with the command:
emacs -Q letgut.org --batch -f org-babel-tangle --kill
then the file myfile.foo
is, as expected, created in the subdirectory my/sub/directory/
.
Do you understand the reason for the difference between these two ways of tangling and how to make org-babel-tangle
behave like the command above?
my/sub/directorory
and creates the filemyfile.foo
in that subdirectory. Check whatdefault-directory
is (withC-h v default-directory
), make sure that you can create the subdirectory in that directory (mkdir -p my/sub/directory
from the shell - you can delete it afterwards to try again). Also, the#+PROPERTY:
keyword line needs to be active: if you just added it, make sure you doC-c C-c
on it to activate it; or close the file and reopen it.M-x org-babel-view-src-block-info
on a source block to see e.g. whether theheader-args
property is set to what you think it is set.C-c C-c
on the#+PROPERTY
line to activate it? Or close and re-open the file? It seems to work. I suggest removing your comment on the other answer.#+PROPERTY:
keyword line wasn't active. Strangely,C-c C-c
on it has the effect to change the mode from Org to LaTeX (AUCTeX). You can make you comment an answer and I'll accept it.