emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: A tool for creating source code files from example and src


From: Chris Gray
Subject: [Orgmode] Re: A tool for creating source code files from example and src blocks in org files
Date: Wed, 03 Jun 2009 10:53:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Eric H. Neilsen, Jr. wrote:

> Hi,

> First, thank you Carsten and others, for putting this thing together;
> org-mode is the most useful tool I've run across in a long time.

> I recently put together a few commands to create source code files
> from SRC and EXAMPLE blocks in org-mode files. The original idea is to
> be able to compile examples in my notes without needing to merge them
> into a separate source file by hand. As I was writing it I realized
> this is exactly the same tool one needs to turn org-mode into a
> literate programming tool (see http://www.literateprogramming.com/ ),
> so I adopted some of the nomenclature. (I tried literate programming a
> few years ago, and gave up in frustration with the tools. I am tempted
> to try again with org-mode.)

I was just thinking that literate programming and org-mode would go
great together.  

> The two user level commands are org-tangle and org-untangle, best
> explained through example. Running org-tangle in a buffer that looks
> like this:

> ---------------------- begin /tmp/test.org ---------------------------
> * Some file

> Some text here

> #+CHUNK file1.sh 1

I think using numbers to order the chunks is probably not the best
idea.  When I wrote the one small program I wrote with literate
programming, I really liked being able to write pseudocode with the chunks
that get substituted.  Like this (admittedly poor example):

def fib(n):
    <<find fib_{n - 2}>>
    <<find fib_{n - 1}>>
    <<return the sum>>

<<find fib_{n - 2}>>=
f2 = fib(n - 2)

<<find fib_{n - 1}>>=
f1 = fib(n - 1)

<<return the sum>>=
return f2 + f1

> Is there any interest in this? My organization's rules for releasing
> code to open source projects are being revised, but I am likely to be
> able to do so under a BSD-like license. If there is interest, I will
> push to try and figure out how to do this, and maybe even see if I can
> do the assignment of copyright stuff needed for it to get under the
> main umbrella (although I am not optimistic).

If you put it in a git repo somewhere, I will put some time aside for
it.  

Cheers,
Chris





reply via email to

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