emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] adding a language - problems
@ 2011-09-28 22:19 Thorsten
  2011-09-28 22:56 ` Thorsten
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten @ 2011-09-28 22:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi list, 
I'm on my way to add a new (intrpreted) lisp dialect to org-babel, but
encounter a few difficulties. Here is my little testprogramm:

---------------------
#+tblname: tbl1
| 1 | 2 | 3 |
|---+---+---|
| 4 | 5 | 6 |
| 7 | 8 | 9 |


# external evaluation (no session)
#+srcname: pico-calc
#+begin_src picolisp :var tab=tbl1 :results value :hlines no 
  (+ (caar tab) (caar (cdr tab)))
#+end_src

# org-babel-error output:
[/tmp/babel-22634XBd/picolisp-script-22634K-K:1] !? (display (prog (let
(tab '((1 2 3) (4 5 6) (7 8 9))) (+ (caar tab) (caar (cdr tab))))))
display -- Undefined


#  with session
#+srcname: pico-calc
#+begin_src picolisp :var tab=tbl1 :results value :hlines no :session "p1"
  (+ (caar tab) (caar (cdr tab)))
#+end_src

#+results: pico-calc
[finishes with no output]

# session buffer:
(prog (let (tab '((1 2 3) (4 5 6) (7 8 9))) 
(+ (caar tab) (caar (cdr tab)))) )
"org-babel-picolisp-eoe"
-> 5
: -> "org-babel-picolisp-eoe"

---------------

I do not know where undefined 'display' comes from in the error message
- seems to be a org-babel internal thing. What can I do about that,
where do I have to look?

The session evaluation works already, but there is a problem with the
eoe string. If I don't use it, Emacs hangs forever - waiting for the
session to return? If I use it, the right value is calculated, but not
returned - because the eoe string is evaluated after the source-body?

Thanks for any tips
Thorsten

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

* Re: [babel] adding a language - problems
  2011-09-28 22:19 [babel] adding a language - problems Thorsten
@ 2011-09-28 22:56 ` Thorsten
  2011-09-29 12:48   ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten @ 2011-09-28 22:56 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten <quintfall@googlemail.com> writes:

> Hi list, 
> I'm on my way to add a new (intrpreted) lisp dialect to org-babel, but
> encounter a few difficulties. Here is my little testprogramm:
>
> ---------------------
> #+tblname: tbl1
> | 1 | 2 | 3 |
> |---+---+---|
> | 4 | 5 | 6 |
> | 7 | 8 | 9 |
>
>
> # external evaluation (no session)
> #+srcname: pico-calc
> #+begin_src picolisp :var tab=tbl1 :results value :hlines no 
>   (+ (caar tab) (caar (cdr tab)))
> #+end_src
>
> # org-babel-error output:
> [/tmp/babel-22634XBd/picolisp-script-22634K-K:1] !? (display (prog (let
> (tab '((1 2 3) (4 5 6) (7 8 9))) (+ (caar tab) (caar (cdr tab))))))
> display -- Undefined
>
>
> #  with session
> #+srcname: pico-calc
> #+begin_src picolisp :var tab=tbl1 :results value :hlines no :session "p1"
>   (+ (caar tab) (caar (cdr tab)))
> #+end_src
>
> #+results: pico-calc
> [finishes with no output]
>
> # session buffer:
> (prog (let (tab '((1 2 3) (4 5 6) (7 8 9))) 
> (+ (caar tab) (caar (cdr tab)))) )
> "org-babel-picolisp-eoe"
> -> 5
> : -> "org-babel-picolisp-eoe"
>
> ---------------
>
> I do not know where undefined 'display' comes from in the error message
> - seems to be a org-babel internal thing. What can I do about that,
> where do I have to look?
>
> The session evaluation works already, but there is a problem with the
> eoe string. If I don't use it, Emacs hangs forever - waiting for the
> session to return? If I use it, the right value is calculated, but not
> returned - because the eoe string is evaluated after the source-body?
>
> Thanks for any tips
> Thorsten


Sorry, I encountered the undefined 'display' in source code I copied
from ob-scheme, I deleted it, and then external evaluation succeeded -
but again without output. 
So I seem to be quite close, evaluation work and the right value is
calculated - but not returned yet. 

cheers
Thorsten 

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

* Re: [babel] adding a language - problems
  2011-09-28 22:56 ` Thorsten
@ 2011-09-29 12:48   ` Eric Schulte
  2011-09-29 18:27     ` Thorsten
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2011-09-29 12:48 UTC (permalink / raw)
  To: Thorsten; +Cc: emacs-orgmode

Thorsten <quintfall@googlemail.com> writes:

> Thorsten <quintfall@googlemail.com> writes:
>
>> Hi list, 
>> I'm on my way to add a new (intrpreted) lisp dialect to org-babel, but
>> encounter a few difficulties. Here is my little testprogramm:
>>
>> ---------------------
>> #+tblname: tbl1
>> | 1 | 2 | 3 |
>> |---+---+---|
>> | 4 | 5 | 6 |
>> | 7 | 8 | 9 |
>>
>>
>> # external evaluation (no session)
>> #+srcname: pico-calc
>> #+begin_src picolisp :var tab=tbl1 :results value :hlines no 
>>   (+ (caar tab) (caar (cdr tab)))
>> #+end_src
>>
>> # org-babel-error output:
>> [/tmp/babel-22634XBd/picolisp-script-22634K-K:1] !? (display (prog (let
>> (tab '((1 2 3) (4 5 6) (7 8 9))) (+ (caar tab) (caar (cdr tab))))))
>> display -- Undefined
>>
>>
>> #  with session
>> #+srcname: pico-calc
>> #+begin_src picolisp :var tab=tbl1 :results value :hlines no :session "p1"
>>   (+ (caar tab) (caar (cdr tab)))
>> #+end_src
>>
>> #+results: pico-calc
>> [finishes with no output]
>>
>> # session buffer:
>> (prog (let (tab '((1 2 3) (4 5 6) (7 8 9))) 
>> (+ (caar tab) (caar (cdr tab)))) )
>> "org-babel-picolisp-eoe"
>> -> 5
>> : -> "org-babel-picolisp-eoe"
>>
>> ---------------
>>
>> I do not know where undefined 'display' comes from in the error message
>> - seems to be a org-babel internal thing. What can I do about that,
>> where do I have to look?
>>
>> The session evaluation works already, but there is a problem with the
>> eoe string. If I don't use it, Emacs hangs forever - waiting for the
>> session to return? If I use it, the right value is calculated, but not
>> returned - because the eoe string is evaluated after the source-body?
>>

I assume you're using `org-babel-comint-with-output' to collect results?
If you're still having issues I'd suggest looking at some of the other
uses of this function in other ob-*.el files for example of ways that
it's use can be customized through code in the BODY section.

>>
>> Thanks for any tips Thorsten
>
>
> Sorry, I encountered the undefined 'display' in source code I copied
> from ob-scheme, I deleted it, and then external evaluation succeeded -
> but again without output. 

Hopefully ":results output" is already working and it is just ":results
value" which requires more work.  "results value" external evaluation
generally works by wrapping the body of the code block in a form which
will collect the result of the code block and print them to STDOUT.
Writing this wrapped body to a temporary file, evaluating this temporary
file, and then collecting the results from STDOUT.  I'd suggest
confirming that each of the above steps are working independently.

> 
> So I seem to be quite close, evaluation work and the right value is
> calculated - but not returned yet.
>

I hope the above helps.  Let me know if you run into any more issues.

Cheers -- Eric

>
> cheers
> Thorsten 
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: [babel] adding a language - problems
  2011-09-29 12:48   ` Eric Schulte
@ 2011-09-29 18:27     ` Thorsten
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten @ 2011-09-29 18:27 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

> Thorsten <quintfall@googlemail.com> writes:
>
>> Thorsten <quintfall@googlemail.com> writes:
>>
>>> Hi list, 
>>> I'm on my way to add a new (intrpreted) lisp dialect to org-babel, but
>>> encounter a few difficulties. Here is my little testprogramm:
>>>
>>> ---------------------
>>> #+tblname: tbl1
>>> | 1 | 2 | 3 |
>>> |---+---+---|
>>> | 4 | 5 | 6 |
>>> | 7 | 8 | 9 |
>>>
>>>
>>> # external evaluation (no session)
>>> #+srcname: pico-calc
>>> #+begin_src picolisp :var tab=tbl1 :results value :hlines no 
>>>   (+ (caar tab) (caar (cdr tab)))
>>> #+end_src
>>>
>>> # org-babel-error output:
>>> [/tmp/babel-22634XBd/picolisp-script-22634K-K:1] !? (display (prog (let
>>> (tab '((1 2 3) (4 5 6) (7 8 9))) (+ (caar tab) (caar (cdr tab))))))
>>> display -- Undefined
>>>
>>>
>>> #  with session
>>> #+srcname: pico-calc
>>> #+begin_src picolisp :var tab=tbl1 :results value :hlines no :session "p1"
>>>   (+ (caar tab) (caar (cdr tab)))
>>> #+end_src
>>>
>>> #+results: pico-calc
>>> [finishes with no output]
>>>
>>> # session buffer:
>>> (prog (let (tab '((1 2 3) (4 5 6) (7 8 9))) 
>>> (+ (caar tab) (caar (cdr tab)))) )
>>> "org-babel-picolisp-eoe"
>>> -> 5
>>> : -> "org-babel-picolisp-eoe"
>>>
>>> ---------------
>>>
>>> I do not know where undefined 'display' comes from in the error message
>>> - seems to be a org-babel internal thing. What can I do about that,
>>> where do I have to look?
>>>
>>> The session evaluation works already, but there is a problem with the
>>> eoe string. If I don't use it, Emacs hangs forever - waiting for the
>>> session to return? If I use it, the right value is calculated, but not
>>> returned - because the eoe string is evaluated after the source-body?
>>>
>
> I assume you're using `org-babel-comint-with-output' to collect results?
> If you're still having issues I'd suggest looking at some of the other
> uses of this function in other ob-*.el files for example of ways that
> it's use can be customized through code in the BODY section.

yes, I use org-babel-comint-with-output more or less in the way it is
used in ob-scheme.el. 

>
>>>
>>> Thanks for any tips Thorsten
>>
>>
>> Sorry, I encountered the undefined 'display' in source code I copied
>> from ob-scheme, I deleted it, and then external evaluation succeeded -
>> but again without output. 
>
> Hopefully ":results output" is already working and it is just ":results
> value" which requires more work.

No, it isn't working - same thing as with :results value - no error
messages, but nothing is returned either and no output. I have to take a
deeper look at whats happening behind the scenes.

>  "results value" external evaluation
> generally works by wrapping the body of the code block in a form which
> will collect the result of the code block and print them to STDOUT.
> Writing this wrapped body to a temporary file, evaluating this temporary
> file, and then collecting the results from STDOUT.  I'd suggest
> confirming that each of the above steps are working independently.
>
>> 
>> So I seem to be quite close, evaluation work and the right value is
>> calculated - but not returned yet.
>>
>
> I hope the above helps.  Let me know if you run into any more issues.
>
> Cheers -- Eric

Thanks so far, I'll try to understand the workings of ob.el & friends
better and then hope to get things to work.  

cheers
Thorsten 

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

end of thread, other threads:[~2011-09-29 18:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-28 22:19 [babel] adding a language - problems Thorsten
2011-09-28 22:56 ` Thorsten
2011-09-29 12:48   ` Eric Schulte
2011-09-29 18:27     ` Thorsten

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).