** creating a directory when needed for tangling
:PROPERTIES:
:DATE: 2011-01-19
:END:
(ns something)
a helper function for the above
(defun mkdir-p (file &optional dir)
"Create any parent directories of FILE if missing and return FILE."
(make-directory (file-name-directory file) (or dir ".")) file)
#+end_src
allows the following
#+begin_src clojure :tangle (mkdir-p "src/foo.clj")
(ns something)
#+end_src
There is now a new header argument controlling this behavior
#+begin_src emacs-lisp :mkdirp yes :tangle novel/nested/directories/finally.clj
(message "contents")
#+end_src