emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)
@ 2015-12-08  9:14 Alan Schmitt
  2015-12-14 12:04 ` Alan Schmitt
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Schmitt @ 2015-12-08  9:14 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

Hello,

I have found that commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b breaks
evaluation of ocaml code. With the following init file (the
`package-initialize' is there for tuareg to be available):

#+begin_src emacs-lisp
(add-to-list 'load-path "/Users/schmitta/projets/org-mode/lisp")

(require 'org)

(package-initialize)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((ocaml . t)))
#+end_src

When I evaluate this block I get this result:

#+BEGIN_SRC ocaml :results code verbatim :exports results
1 + "toto";;
#+END_SRC

#+results:
#+BEGIN_SRC ocaml
Characters 4-10:
  1 + "toto";;;;
      ^^^^^^
Error: This expression has type string but an expression was expected of type
         int
#+END_SRC

After commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b I get this:

#+results:
#+BEGIN_SRC ocaml
;;
      ^^^^^^
Error: This expression has type string but an expression was expected of type
         int
#+END_SRC

I tried to debug this but `org-babel-comint-with-output' is a macro and
I don't know how to debug macros …

Thanks for any help regarding this (for instance telling me how to
edebug macros).

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated December 6, 2015, Mauna Loa Obs.): 400.80 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)
  2015-12-08  9:14 evaluation issue with ocaml code (due to changes to org-babel-comint-with-output) Alan Schmitt
@ 2015-12-14 12:04 ` Alan Schmitt
  2015-12-16 20:29   ` Alan Schmitt
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Schmitt @ 2015-12-14 12:04 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

Hello,

I could use some help to debug this. Could someone please tell me how to
debug a macro (I would like to step through it using edebug)?

Thanks,

Alan

On 2015-12-08 10:14, Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> I have found that commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b breaks
> evaluation of ocaml code. With the following init file (the
> `package-initialize' is there for tuareg to be available):
>
> #+begin_src emacs-lisp
> (add-to-list 'load-path "/Users/schmitta/projets/org-mode/lisp")
>
> (require 'org)
>
> (package-initialize)
>
> (org-babel-do-load-languages
>  'org-babel-load-languages
>  '((ocaml . t)))
> #+end_src
>
> When I evaluate this block I get this result:
>
> #+BEGIN_SRC ocaml :results code verbatim :exports results
> 1 + "toto";;
> #+END_SRC
>
> #+results:
> #+BEGIN_SRC ocaml
> Characters 4-10:
>   1 + "toto";;;;
>       ^^^^^^
> Error: This expression has type string but an expression was expected of type
>          int
> #+END_SRC
>
> After commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b I get this:
>
> #+results:
> #+BEGIN_SRC ocaml
> ;;
>       ^^^^^^
> Error: This expression has type string but an expression was expected of type
>          int
> #+END_SRC
>
> I tried to debug this but `org-babel-comint-with-output' is a macro and
> I don't know how to debug macros …
>
> Thanks for any help regarding this (for instance telling me how to
> edebug macros).
>
> Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated December 13, 2015, Mauna Loa Obs.): 401.31 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)
  2015-12-14 12:04 ` Alan Schmitt
@ 2015-12-16 20:29   ` Alan Schmitt
  2015-12-18  8:18     ` Alan Schmitt
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Schmitt @ 2015-12-16 20:29 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 331 bytes --]

Hello,

I finally found the issue (using the plain debugger): the call to
org-babel-comint-with-output was set to remove the echo, but the only
time there is an echo of the full body is when a single line function
has an error, and this echo is useful to show where the error is. Here
is a patch that makes sure the echo is kept.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-ob-ocaml.el-Keep-echo-to-display-ocaml-errors.patch --]
[-- Type: text/x-patch, Size: 906 bytes --]

From 59e6912e6bf769fff2f48b6c2af95bda918d0cd9 Mon Sep 17 00:00:00 2001
From: Alan Schmitt <alan.schmitt@polytechnique.org>
Date: Wed, 16 Dec 2015 21:19:23 +0100
Subject: [PATCH] ob-ocaml.el: Keep echo to display ocaml errors

* ob-ocaml.el (org-babel-execute:ocaml): call
`org-babel-comint-with-output' with nil `remove-echo' argument.
---
 lisp/ob-ocaml.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-ocaml.el b/lisp/ob-ocaml.el
index 48f8aba..68ac859 100644
--- a/lisp/ob-ocaml.el
+++ b/lisp/ob-ocaml.el
@@ -66,7 +66,7 @@
          (session (org-babel-prep-session:ocaml
 		   (cdr (assoc :session params)) params))
          (raw (org-babel-comint-with-output
-		  (session org-babel-ocaml-eoe-output t full-body)
+		  (session org-babel-ocaml-eoe-output nil full-body)
 		(insert
 		 (concat
 		  (org-babel-chomp full-body) ";;\n"
-- 
2.6.4


[-- Attachment #1.3: Type: text/plain, Size: 1338 bytes --]


For the record, the problem I wanted to fix.

On 2015-12-14 13:04, Alan Schmitt <alan.schmitt@polytechnique.org> writes:

>> I have found that commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b breaks
>> evaluation of ocaml code. With the following init file (the
>> `package-initialize' is there for tuareg to be available):
>>
>> #+begin_src emacs-lisp
>> (add-to-list 'load-path "/Users/schmitta/projets/org-mode/lisp")
>>
>> (require 'org)
>>
>> (package-initialize)
>>
>> (org-babel-do-load-languages
>>  'org-babel-load-languages
>>  '((ocaml . t)))
>> #+end_src
>>
>> When I evaluate this block I get this result:
>>
>> #+BEGIN_SRC ocaml :results code verbatim :exports results
>> 1 + "toto";;
>> #+END_SRC
>>
>> #+results:
>> #+BEGIN_SRC ocaml
>> Characters 4-10:
>>   1 + "toto";;;;
>>       ^^^^^^
>> Error: This expression has type string but an expression was expected of type
>>          int
>> #+END_SRC
>>
>> After commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b I get this:
>>
>> #+results:
>> #+BEGIN_SRC ocaml
>> ;;
>>       ^^^^^^
>> Error: This expression has type string but an expression was expected of type
>>          int
>> #+END_SRC

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated December 13, 2015, Mauna Loa Obs.): 401.31 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)
  2015-12-16 20:29   ` Alan Schmitt
@ 2015-12-18  8:18     ` Alan Schmitt
  2015-12-18 21:38       ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Schmitt @ 2015-12-18  8:18 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2828 bytes --]

Hello,

Can I push this?

Thanks,

Alan

On 2015-12-16 21:29, Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> I finally found the issue (using the plain debugger): the call to
> org-babel-comint-with-output was set to remove the echo, but the only
> time there is an echo of the full body is when a single line function
> has an error, and this echo is useful to show where the error is. Here
> is a patch that makes sure the echo is kept.
>
> From 59e6912e6bf769fff2f48b6c2af95bda918d0cd9 Mon Sep 17 00:00:00 2001
> From: Alan Schmitt <alan.schmitt@polytechnique.org>
> Date: Wed, 16 Dec 2015 21:19:23 +0100
> Subject: [PATCH] ob-ocaml.el: Keep echo to display ocaml errors
>
> * ob-ocaml.el (org-babel-execute:ocaml): call
> `org-babel-comint-with-output' with nil `remove-echo' argument.
> ---
>  lisp/ob-ocaml.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/ob-ocaml.el b/lisp/ob-ocaml.el
> index 48f8aba..68ac859 100644
> --- a/lisp/ob-ocaml.el
> +++ b/lisp/ob-ocaml.el
> @@ -66,7 +66,7 @@
>           (session (org-babel-prep-session:ocaml
>  		   (cdr (assoc :session params)) params))
>           (raw (org-babel-comint-with-output
> -		  (session org-babel-ocaml-eoe-output t full-body)
> +		  (session org-babel-ocaml-eoe-output nil full-body)
>  		(insert
>  		 (concat
>  		  (org-babel-chomp full-body) ";;\n"
> -- 
> 2.6.4
>
>
> For the record, the problem I wanted to fix.
>
> On 2015-12-14 13:04, Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>>> I have found that commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b breaks
>>> evaluation of ocaml code. With the following init file (the
>>> `package-initialize' is there for tuareg to be available):
>>>
>>> #+begin_src emacs-lisp
>>> (add-to-list 'load-path "/Users/schmitta/projets/org-mode/lisp")
>>>
>>> (require 'org)
>>>
>>> (package-initialize)
>>>
>>> (org-babel-do-load-languages
>>>  'org-babel-load-languages
>>>  '((ocaml . t)))
>>> #+end_src
>>>
>>> When I evaluate this block I get this result:
>>>
>>> #+BEGIN_SRC ocaml :results code verbatim :exports results
>>> 1 + "toto";;
>>> #+END_SRC
>>>
>>> #+results:
>>> #+BEGIN_SRC ocaml
>>> Characters 4-10:
>>>   1 + "toto";;;;
>>>       ^^^^^^
>>> Error: This expression has type string but an expression was expected of type
>>>          int
>>> #+END_SRC
>>>
>>> After commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b I get this:
>>>
>>> #+results:
>>> #+BEGIN_SRC ocaml
>>> ;;
>>>       ^^^^^^
>>> Error: This expression has type string but an expression was expected of type
>>>          int
>>> #+END_SRC
>
> Best,
>
> Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated December 13, 2015, Mauna Loa Obs.): 401.31 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)
  2015-12-18  8:18     ` Alan Schmitt
@ 2015-12-18 21:38       ` Nicolas Goaziou
  2015-12-21  8:06         ` Alan Schmitt
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-12-18 21:38 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Can I push this?

I have no objection.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)
  2015-12-18 21:38       ` Nicolas Goaziou
@ 2015-12-21  8:06         ` Alan Schmitt
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Schmitt @ 2015-12-21  8:06 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

On 2015-12-18 22:38, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Can I push this?
>
> I have no objection.

Thanks, I pushed it.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated December 13, 2015, Mauna Loa Obs.): 401.31 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-21  8:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08  9:14 evaluation issue with ocaml code (due to changes to org-babel-comint-with-output) Alan Schmitt
2015-12-14 12:04 ` Alan Schmitt
2015-12-16 20:29   ` Alan Schmitt
2015-12-18  8:18     ` Alan Schmitt
2015-12-18 21:38       ` Nicolas Goaziou
2015-12-21  8:06         ` Alan Schmitt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).