From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Gray Subject: 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 Message-ID: <867hzty9y0.fsf@portan.ibr.cs.tu-bs.de> References: <4A257492.5030300@fnal.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBmEq-0006mb-Q1 for emacs-orgmode@gnu.org; Wed, 03 Jun 2009 04:54:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBmEm-0006ks-W6 for emacs-orgmode@gnu.org; Wed, 03 Jun 2009 04:54:24 -0400 Received: from [199.232.76.173] (port=53440 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBmEm-0006ko-NQ for emacs-orgmode@gnu.org; Wed, 03 Jun 2009 04:54:20 -0400 Received: from main.gmane.org ([80.91.229.2]:33795 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MBmEm-0001Zu-9w for emacs-orgmode@gnu.org; Wed, 03 Jun 2009 04:54:20 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MBmEk-0000be-Pe for emacs-orgmode@gnu.org; Wed, 03 Jun 2009 08:54:18 +0000 Received: from portan.ibr.cs.tu-bs.de ([134.169.34.77]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Jun 2009 08:54:18 +0000 Received: from chrismgray by portan.ibr.cs.tu-bs.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Jun 2009 08:54:18 +0000 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 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): <> <> <> <>= f2 = fib(n - 2) <>= f1 = fib(n - 1) <>= 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