emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [BABEL] Tangling to a hierarchy of files?


From: Eric Schulte
Subject: Re: [Orgmode] [BABEL] Tangling to a hierarchy of files?
Date: Wed, 19 Jan 2011 00:22:04 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

"Charles C. Berry" <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]