diff options
author | Alan Schmitt <alan.schmitt@polytechnique.org> | 2013-05-02 11:46:27 +0200 |
---|---|---|
committer | Alan Schmitt <alan.schmitt@polytechnique.org> | 2013-05-07 09:55:14 +0200 |
commit | 69464bf13522e40027beefce8e1655f96292ed91 (patch) | |
tree | eef6312ac0c8d7f022897861735ebf10f7f9ca76 | |
parent | e79e8943ded4f1e3f2929560a3496fae8eec73c5 (diff) | |
download | org-mode-69464bf13522e40027beefce8e1655f96292ed91.tar.gz |
Babel ocaml: Fix the interaction with the toplevel
* lisp/ob-ocaml.el (org-babel-execute:ocaml): Always append ";;" at the end of
the expression before sending it to the toplevel.
(org-babel-execute:ocaml): Do not remove the type information if "verbatim" is a
results parameter of the code block.
(org-babel-ocaml-parse-output): Make sure the complete type is taken into
account when matching against known types.
-rw-r--r-- | lisp/ob-ocaml.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/ob-ocaml.el b/lisp/ob-ocaml.el index 6a83908..03500bb 100644 --- a/lisp/ob-ocaml.el +++ b/lisp/ob-ocaml.el @@ -63,7 +63,7 @@ (session org-babel-ocaml-eoe-output t full-body) (insert (concat - (org-babel-chomp full-body)"\n"org-babel-ocaml-eoe-indicator)) + (org-babel-chomp full-body)";;\n"org-babel-ocaml-eoe-indicator)) (tuareg-interactive-send-input))) (clean (car (let ((re (regexp-quote org-babel-ocaml-eoe-output)) out) @@ -74,10 +74,13 @@ (progn (setq out t) nil)))) (mapcar #'org-babel-trim (reverse raw)))))))) (org-babel-reassemble-table - (let ((raw (org-babel-trim clean))) - (org-babel-result-cond (cdr (assoc :result-params params)) - ;; strip type information from output - (if (string-match "= \\(.+\\)$" raw) (match-string 1 raw) raw) + (let ((raw (org-babel-trim clean)) + (result-params (cdr (assoc :result-params params)))) + (org-babel-result-cond result-params + ;; strip type information from output unless verbatim is specified + (if (and (not (member "verbatim" result-params)) + (string-match "= \\(.+\\)$" raw)) + (match-string 1 raw) raw) (org-babel-ocaml-parse-output raw))) (org-babel-pick-name (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) @@ -113,7 +116,7 @@ (defun org-babel-ocaml-parse-output (output) "Parse OUTPUT. OUTPUT is string output from an ocaml process." - (let ((regexp "%s = \\(.+\\)$")) + (let ((regexp "[^:]+ : %s = \\(.+\\)$")) (cond ((string-match (format regexp "string") output) (org-babel-read (match-string 1 output))) |