Seth Burleigh writes: > Preface: I hope attachments show up, i dont know if they are allowed .... > The attachments did make it through. > > Im currently interested in using babel for a medium size clojure project. I > think the below propositions would greatly benefit babel in accomplishing > literate programming. > > First part of the proposal to make this painless: > > In a literate document, you might very well have small chunks of code for > one ns scattered around and then finally combined using noweb into one file > and tangle the output. Currently, keys like > compile-file (C-c C-k), goto function definition (M-.), do not work at all > in the source blocks. This is unfortunate, and makes life very painful. So, > first we need to get these keys to work. > Heres how it can possibly be done. > > Lets say we want to compile the code in block A. Block B uses noweb syntax > to import block A, and then tangles to file src/B.clj. So we need to search > for the presence of <> in a tangled code chunk , tangle the chunk to a > file, go to the file buffer and position the cursor at the correct relative > position, and then invoke the appropriate function (in this case, > slime-compile-and-load-file). > > Ive attached two files which do this, the first one is an example org file > in which you can use the compile keystrokes on (after opening a slime server > for clojure). However, it doesnt position the cursor in the tangled file > correctly, but this is not needed for compile/load file. Its not a very good > implementation, but it works for this case. Also, it doesn't work when the > indirect buffer created by C-c ' is open. The advantage of this method is > that it can easily be generalized to any language, since the compiler gets > what it expects - a file of code to operate on. > > Second part of proposal: > > Literate documents are good for documentation, but if you're the author, you > dont need the documentation and it will certainly get in the way of you > writing code to keep having to type C-c ' to open various chunks of code. > Ideally, we would like to have our file of code (that is, the tangled file > output for one ns in clojure) as the top buffer, and our documentation at > the bottom. Changes to the code will automatically reflect itself in the > documentation (after a save). In order to accomplish this, there has to be a > method to map from tangled file line number, to the correct chunk name and > line number in the .org file. This might be accomplished by tangling code > like this: > ;;#chunk-name > ..code > ;;# > > I think this would be much more natural than editing each chunk separately. > Of course, the ;;# might become an annoyance, but im sure there might be a > better way. > With this mapping , we can develop the code until we get it right. Then we > can hit a keystroke and have our documentation jump to the correct line > number in the .org file, and then do all the documentation for that. > > With the line mapping ability also comes the ability to map errors in the > line number to numbers in the org file. Although, this probably wouldn't be > necessary, since we would be looking at the combined chunk file. > > > Any thoughts/ideas how to implement this? > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode