Alan Schmitt <alan.schm...@polytechnique.org> writes: > Hello, > > It seems that ob-ocaml does not support ":results output". For instance, > evaluating the following block: > > #+begin_src ocaml :results output > Printf.printf "foo\nbar\n";; > #+end_src > > Does not result in the two lines "foo" and "bar" but in the value being > returned. > > Unfortunately I don't know enough of babel and emacs-lisp to extend > ob-ocaml to support this. Would someone be willing to guide me through > the `org-babel-execute:ocaml' function in ob-ocaml.el so that I can add > this functionality? >
You can step through the execution of `org-babel-execute:ocaml' by first evaluating the function with a prefix argument (meaning with the cursor within the function body press C-u C-A-x) which will edebug [1] the function. You can then evaluate an OCaml code block and when execution hits the `org-babel-execute:ocaml' it will pause, and you can step through the function by continuously pressing space bar. In this way you can see how the code is executed, and you can interactively look at the OCaml session buffer to see where output is printed. Pay special attention to the `org-babel-comint-with-output' function, which is probably where you'll need to make changes when the following holds. (member "output" (cdr (assoc :result-params params))) You can also look for the string "output" in other ob-*.el language files to see how output results are collected. Hope this helps, > > Thanks, > > Alan > Footnotes: [1] see (info "(elisp)Edebug") -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D