From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: org-style folding for a .emacs Date: Thu, 16 Jul 2009 17:31:28 -0600 Message-ID: References: <8763dwxiyu.fsf@stats.ox.ac.uk> <87ab35mzhq.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRaQQ-00026s-0v for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 19:31:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRaQL-0001yp-DJ for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 19:31:41 -0400 Received: from [199.232.76.173] (port=56223 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRaQL-0001ye-59 for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 19:31:37 -0400 Received: from mx20.gnu.org ([199.232.41.8]:15297) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MRaQK-0005aT-LP for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 19:31:36 -0400 Received: from mail-pz0-f202.google.com ([209.85.222.202]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MRaQI-0007a8-Q6 for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 19:31:35 -0400 Received: by pzk40 with SMTP id 40so281524pzk.14 for ; Thu, 16 Jul 2009 16:31:32 -0700 (PDT) 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: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org Hi S=C3=A9bastien, S=C3=A9bastien Vauban writes: > Hello Eric, > > "Eric Schulte" wrote: >> I've added some simplifying functions to the literate programming >> functionality of org-babel. It should now be easy to embed your elisp >> initialization into org-mode files. Specifically there is now a new >> `org-babel-load-file' function which can load the elisp portions of >> org-mode files in the same manner as the normal `load-file' command. >> >> To use this you need to clone the latest version of org-babel[1], and >> then add the following to your emacs initialization (this worked for me >> when a base emacs "emacs -Q"). >> >> (add-to-list 'load-path "~/path/to/org/lisp") >> (add-to-list 'load-path "~/path/to/org-babel/lisp") >> (require 'org-babel-init) >> ;; now you can load your org-mode files with embedded elisp >> (org-babel-load-file "~/path/to/org-mode-file.org") >> ;; for example >> (org-babel-load-file "~/path/to/org-babel/test-tangle.org") >> >> Hopefully this will provide the literate programming functionality >> without too much trouble. > > I'm a heavy user of "literate programming" for rapports I write for clien= ts > (in fact, for me, first, but I give them to our clients as well). > > Up to a couple of months ago, I was doing literate programming via LaTeX = and > nuweb, from Windows as my nuweb binary was just available for that platfo= rm. > So, writing a `.w' file from which I extract a `.tex' one and the source = code. > > Then, the last time I did it, I switched to doing such reports under Ubun= tu, > with the noweb package. That is a `.nw' file which is "compiled" to a `.t= ex', > and which is as well outputting all my code. > > This is nice, and works well. But, now, I am trying as hard as possible to > avoid writing LaTeX directly and let Org do the work for me. So, if I can= use > Org to create my `.tex' file and the source code from it as well (did I > understand correctly?), then that will be wonderful. > > Do you have examples or a tiny tutorial about this? > There are two small examples which should be helpful. First grab a copy of the org-babel code [1]. Then load org-babel [2]. To demonstrate extraction of code, open "test-tangle.org" file in the base of the org-babel directory and run `org-babel-tangle'. This should create a couple of source-code files in the same directory. To demonstrate creation of documents, open the "test-export.org" file in the base of the org-babel directory, and export it as you would any other org-mode file. The "exports" header argument controls how source-code blocks are exported, with the following options - none :: no part of the source-code block is exported in the document - results :: only the output of the evaluated block is exported - code :: the code itself is exported - both :: both the code and results are exported > > Best regards, > Seb > > PS- Excellent you're looking at this, because I thought I was the latest > "literate programmer" on earth. All the mailing lists about that are > dying. While I find the notion of literate programming very appealing, I have no practical experience with it. The literate programming functionality in org-babel was inspired by talking with Eric Neilsen and by the sense that literate programming fit with org-babel's focus on code blocks. As you are actually familiar with literate programming and tools like noweb, I would be very interested to hear your thoughts on the current and potential future literate programming implementations in org-babel. Best -- Eric Footnotes:=20 [1] git clone git://github.com/eschulte/org-babel.git [2]=20=20 (add-to-list 'load-path "~/path/to/org-babel/lisp") (require 'org-babel-init)