emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: [babel] Painless integration of source blocks with lan


From: Seth Burleigh
Subject: Re: [Orgmode] Re: [babel] Painless integration of source blocks with language
Date: Sun, 9 Jan 2011 21:49:58 -0600

My bad. I believe i did look up the functions, but they didn't do what i needed (or so i thought).
The code doesn't matter too much, let me explain the idea.

A file may contain many blocks of code. Lets look at a arbitrary block A. In the end, block A will somehow become noweb embedded into a source block which is actually tangled to a file. Lets call this source block C. find-chunk finds this source block, given the position of block A, checking also that the source has a type of "clojure". So, basically it searches for the string <<A>>, if it finds it, checks if the source block (with an arbitrary name, lets say my-block) is tangled, if not, it searches for   <<my-block>> until it actually finds a tangled source block.

tangle-chunk is used to tangle block A by finding block C (using find-chunk) and tangling that. It is basically copied from org-babel except that it uses mkdir to create any parent directories that do not exist (i think this should be included as an option in tangle file, btw, if it isn't)

So, conceptually we have many blocks which are noweb embedded into various source files, however indirectly. We want to find the source files that these blocks are embedded in so that we can (in the future) navigate from the block to the file number.
 '
Thats all that does, from line 110 up. I copied it from my previous posting.
From below that, i implement an emacs overlay, created by new-chunk. Basically all it does is associate a chunk of code in the buffer to a chunk of code in another chunk. We can 'add a link', i.e. append a chunk to its 'lp-link property.  

Next, we add the ability to replace the code of one chunk with another. This is what push-chunk does. Now, all that we have left is the code to create chunks from source blocks. 

Pushing code from one chunk to another code work with noweb embedding, but it was just a proof of concept anyways.

What i was imagining when i did this is that i would have a source code file which has various 'chunks' highlighted in different colors (various background colors), each having a 'link' to the appropriate source code chunk in the babel file. Thus, we could push changes from the source code files to the org-mode file and navigate between. This would eliminate the code markers. I was imagining that the tangled source code files could be viewed simply as an indirect buffer created from the org file, so we wouldn't need code markers to save the chunk info for future sessions - we would just generate it all from the org-file. 

 What is needed now is to be able to push from one chunk to another, except leaving any <<srcname>> blocks as they are.  With that, i believe the ideas mentioned in the first post could be fully implemented. 

reply via email to

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