emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] I need help extending ob-ocaml to support :results output


From: Eric Schulte
Subject: Re: [O] I need help extending ob-ocaml to support :results output
Date: Sun, 23 Mar 2014 19:50:54 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Alan Schmitt <address@hidden> 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



reply via email to

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