From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Maier Subject: [BABEL] Tangling to a hierarchy of files? Date: Wed, 19 Jan 2011 04:02:00 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=43317 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfPIB-0000n3-Mt for emacs-orgmode@gnu.org; Tue, 18 Jan 2011 23:05:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfPIA-0002jY-Qm for emacs-orgmode@gnu.org; Tue, 18 Jan 2011 23:05:07 -0500 Received: from lo.gmane.org ([80.91.229.12]:40093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfPIA-0002in-Gk for emacs-orgmode@gnu.org; Tue, 18 Jan 2011 23:05:06 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PfPI8-00023H-LM for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 05:05:04 +0100 Received: from pool-71-120-219-15.rlghnc.dsl-w.verizon.net ([71.120.219.15]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Jan 2011 05:05:04 +0100 Received: from christopher.maier by pool-71-120-219-15.rlghnc.dsl-w.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Jan 2011 05:05:04 +0100 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: emacs-orgmode@gnu.org 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 (I'm trying to automatically generate a Leiningen project for Clojure, if that helps any.) If I tangle an Org file that contains a block like this, and I haven't already created a "src" directory, then I get an error ("Opening output file: No such file or directory..."). I could create a shell script block in my file that will create whatever directory hierarchy I need, but it looks like I'd have to manually execute that prior to tangling my source code. I've seen some examples on the mailing list using Emacs Lisp code blocks to set up a custom org-babel-pre-tangle-hook, but it still seems that there's a manual execution step required. Is there a better (maybe already built-in?) way to achieve this? Ideally, I'd eventually like to set things up so that I could invoke a single function that would create the file hierarchy, tangle the files, generate documentation, and then run tests and other build-related stuff. Is that possible without leaving Org? Thanks in advance for any help.