From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Illiterate programming question Date: Wed, 30 Mar 2011 16:52:40 -0600 Message-ID: <87mxkcrzk7.fsf@gmail.com> References: <4D93935B.1020402@sift.info> <8766.1301520804@alphaville.usa.hp.com> <4D93A425.9070604@sift.info> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=56349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q54Fr-0001rT-RC for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 18:52:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q54Fq-0006tc-8b for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 18:52:47 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:47276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q54Fq-0006tW-41 for emacs-orgmode@gnu.org; Wed, 30 Mar 2011 18:52:46 -0400 Received: by iwg8 with SMTP id 8so2294760iwg.0 for ; Wed, 30 Mar 2011 15:52:45 -0700 (PDT) In-Reply-To: <4D93A425.9070604@sift.info> (Robert Goldman's message of "Wed, 30 Mar 2011 16:44:05 -0500") 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: rpgoldman@sift.info Cc: nicholas.dokos@hp.com, Org Mode Robert Goldman writes: > On 3/30/11 Mar 30 -4:33 PM, Nick Dokos wrote: >> Robert Goldman wrote: >> >>> I would like to do the opposite of literate programming (hence the >>> subject line!): >>> >>> I would like to pull into my org file snippets from a code file. I know >>> that org-mode will let me import /entire/ source code files. Is there >>> some way to say "Import the region of this file between these two >>> delimiters?" >>> >>> If not, do you think it would be hard to add this feature? I already >>> have the snappy name, after all! >>> >> >> I don't really understand: can't you cut and paste? > > Yes, but if I cut and paste the text of the code that I am describing > may change out from under my text. If I import the code, it stays in > sync (at least when the document is exported). > Babel does have a way to bring changes back from pure source code into code blocks in an Org-mode document. While it isn't perfect (especially if you make extensive use of noweb references or variables) there are mechanisms to maintain such a /sync/. To try this out, tangle out code with the ":comments yes" header argument, then change an element of the tangled source code, and use the `org-babel-detangle' function to bring the changes back into the Org-mode document. Improving the detangling (or "illiterate") features is an area ripe for future Babel development. Cheers -- Eric