emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Torsten Wagner <torsten.wagner@gmail.com>
To: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [babel] noweb and results for ob-screen?
Date: Mon, 19 Dec 2011 20:18:49 +0900	[thread overview]
Message-ID: <4EEF1D99.8060902@gmail.com> (raw)
In-Reply-To: <CAPaq-gMXgxEwUvS5XdN7jP6ban8ki4Jj3q5Xiz=PPBF1Spp8Cg@mail.gmail.com>

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	other threads:[~2011-12-19 11:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAPaq-gOhsRRwEiu6GqkphpsqdQDAuOQ2WBK24h-16a+o25Tw1A@mail.gmail.com>
2011-12-17  9:38 ` [babel] noweb and results for ob-screen? Torsten Wagner
2011-12-19 11:18   ` Torsten Wagner [this message]
2011-12-22 15:08   ` Eric S Fraga
2011-12-23 14:16     ` Torsten Wagner
2011-12-30 12:56       ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EEF1D99.8060902@gmail.com \
    --to=torsten.wagner@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).