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: Rainer M Krug
Subject: Re: [Orgmode] [BABEL] Tangling to a hierarchy of files?
Date: Wed, 19 Jan 2011 11:05:33 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14pre) Gecko/20110114 Lightning/1.0b2 Shredder/3.1.8pre

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/19/2011 08:22 AM, Eric Schulte wrote:
> "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

Would it be possible, to include this into tangling, i.e. if the folder
in which the source file should be created does not exist, create it?

I remember vaguely a discussion along these lines some time ago, but I
don't remember the outcome?

Rainer

> 
> Cheers -- Eric
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      address@hidden

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk02t20ACgkQoYgNqgF2egqJcwCeMaM/k5MeTsZ07crbr0CfpCMB
zrkAniGC6QejbjMsksxnD7I/QS3em0Xh
=+yMc
-----END PGP SIGNATURE-----



reply via email to

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