I would like to use Emacs for literate programming.

I want my code to look like this .

<<class Hufftree definition>>=
template<typename DataType, typename Frequency> class Hufftree
  Hufftree public members
  Hufftree private members

In org-babel I can't give names to my code snippets which are spread all over the document and collect them together as shown below. Whenever I compile I want the tool to automatically insert <<member functions>> wherever I refer them.

Some text here. Blah blah...

<<my foo class>> ==
#+begin_src ruby 
class Foo{
    <<member functions>>

Something random to say about some other things. 

<<member functions>> ==
// code for member functions goes here 
  • 4
    I might help if you include what you want to do in your question rather than just linking it. It would also help if you provide an example of what you want to achieve and include how far you have gotten in achieving that. – N.N. Nov 14 '12 at 6:41
  • 1
    It would also help if you describe what you didn't like about org-babel because AFAIK it's easiest way to do literate programming. – Daimrod Nov 14 '12 at 7:34

You might want to check out Noweb, which allows literate programming in almost any language with LaTeX or Sphinx/reStructuredText syntax; you can see an example here).

You could then use the standard Emacs LaTeX writing facilities and maybe mix with a multiple-major mode to edit the code portions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.