From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BABEL] Tangling to a hierarchy of files? Date: Wed, 19 Jan 2011 00:22:04 -0700 Message-ID: <87tyh5icir.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=58102 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfSMu-00053V-3x for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 02:22:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfSMt-0001u7-0L for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 02:22:11 -0500 Received: from mail-yi0-f47.google.com ([209.85.218.47]:40828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfSMs-0001u3-T6 for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 02:22:10 -0500 Received: by yie16 with SMTP id 16so179120yie.34 for ; Tue, 18 Jan 2011 23:22:10 -0800 (PST) In-Reply-To: (Charles C. Berry's message of "Tue, 18 Jan 2011 22:45:42 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Charles C. Berry" Cc: Christopher Maier , emacs-orgmode@gnu.org "Charles C. Berry" writes: > On Wed, 19 Jan 2011, Christopher Maier wrote: > >> I've been experimenting with literate programming using Org mode recently and am >> really enjoying it. I am trying to figure out the best way to create a nested >> hierarchy of tangled files from a single Org file, and am not sure the best way >> to go about it. >> >> I know that, for example, this block, when tangled, will produce a file >> "foo.clj" in the same directory as my Org file... so far so good. >> >> #+begin_src clojure :tangle foo.clj >> (ns foo) >> >> (defn my-inc [x] >> (+ x 1)) >> #+end_src >> >> However, I would like to be able to do something like this: >> >> #+begin_src clojure :tangle src/foo.clj >> (ns foo) >> >> (defn my-inc [x] >> (+ x 1)) >> #+end_src >> In addition to the solution Charles posted, it is possible to put arbitrary elisp forms into header arguments, so the following alternative to your block above will create the directory (if it doesn't already exist) whenever the block is tangled or evaluated. #+begin_src clojure :tangle (prog1 "src/foo.clj" (make-directory "src" ".")) (ns foo) (defn my-inc [x] (+ x 1)) #+end_src Cheers -- Eric