emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [babel] noweb and results for ob-screen?


From: Torsten Wagner
Subject: Re: [O] [babel] noweb and results for ob-screen?
Date: Mon, 19 Dec 2011 20:18:49 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111108 Thunderbird/8.0

Hmmm...

I looked a bit into it and it seems screen can log the session into a file. org-mode could read the total number of lines of that file before executing a new block of the same session and add the number of line feeds for the executed source code block. Hence, we would know at which point the "result" would start. However, this would add the entire output of the source code block as result. One could limit the result to the last send command by the above method too. Just splitting the source code block internally into two parts. The first one contains all but the last command, the second contains only the last command.

As for noweb, I can't see from the source code why it should not work. Does someone have an idea about that. I gave names to all my source code blocks. Then I defined a source code block with the header argument :noweb true. However all <<names>> lines are send to screen instead of the content of so called source code blocks.

I also looked into variables. However, this seems to be a bit tricky, the problem is screen runs interactively, hence, you could run all kind of other stuff in the screen session, e.g., python, emacs, a serial terminal, etc. . How could org-mode know if it has to warp the variable according to python-, shell-, lisp- or any other syntax.

Might it be possible (and does it make sense) to simply enable some kind of macro-like replacement. E.g.
:var _X_=3
would replace all _X_ by 3. There would be no formal syntax and no format rules. Just a simple greedy search and replace. Thus, the user can/have to think by himself how a variable name would have to look like to get no conflict with the target language.
E.g.
:var var=12
could be a bad idea if the source code would be
test = var
var2 = 12
def variant():

because it would be replaced by

test = 12
122 = 12
def 12iant():

We could not rely on spaces around variables because some languages might not allow spaces. That is

test=12 can not be written test = 12

However, source code blocks are normally relatively small and the user could use any kind of scheme which makes a distinction with the target language within screen easy (using all kind of seldom used characters _,%,#, etc.)

Any thoughts or ideas?

I really like the interactive screen functionality which allows me to perform all kind of tasks interactively within a screen session.

Torsten


On 12/17/2011 06:38 PM, Torsten Wagner wrote:
Hi,
recently I discovered babel in combination with screen. I really like it.
However, I tried to use noweb but it seems not to work.  Getting it working
would allow to write "tasks" and arbitrary combine them to bigger tasks.

I would be interested in results too.  Would be nice to receive some
feedback from above tasks.  Thus, one could document the success or
results.  For now I have to copy results from the screen terminal which is
kind of error prone.

Any chance to enhance ob-screen with the above features?

Totti





reply via email to

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