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: Fri, 23 Dec 2011 14:16:19 +0000

Hi Eric,

thanks for pushing this up :)
Well as far as I understood, ob-sh is at the final end (after
org-babel did its job) a shell script which will be executed.
ob-screen is an interactive connection to a screen session. Everything
inside the source cgode block will be sent to this session.
This is not limited to terminal commands, but could e.g., be
keystrokes for a ncurse based program, a serial terminal, etc.
Furthermore all is send over "as-it-is"
Thus you could have different code blocks and concatenate them to
complex commands.

E.g., (not complex but for demo ;) )

#+src_name copy
#+begin_src screen :session copy
cp -ar
#+end_src

#+src_name source1
#+begin_src screen :session copy
~/data
#+end_src

#+src_name source2
#+begin_src screen :session copy
~/picture
#+end_src

#+src_name target1
#+begin_src screen :session copy
/media/sdb1

#+end_src

#+src_name target2
#+begin_src screen :session copy
/media/sdb2

#+end_src

Now you could call the code-blocks in the desired combination to create e.g.
cp -ar ~/data /media/sdb1
or
cp -ar ~/picture /media/sdb2
etc.

Please note that the target blocks contain an empty line to send over
a carriage return and hence start the final command in the screen
session.

Guess you could easily think of far more complex examples.
The screen session is running parallel in an window beside emacs
(guess it might be even possible to run it within emacs by e.g.
eshell).
Thus it is perfect to augmented the tasks.

Unfortunately, ob-screen seems to have no idea of variables and
results. Furthermore, I did not get noweb working but did not see why
it should not work.

At the moment I try to use it to open a serial terminal and talk to an
measurement device.
I can easily send over the commands necessary to talk to the device,
but having noweb would allow me to combine different commands into
small scripts. Like

<<open_device>>
<<set-up_device>>
<<read_measurement>>
<<close_device>>
Each of those might contain many lines of cryptic ASCII characters and numbers

You can try

#+src_name start_emacs
#+begin_src screen :session emacs
emacs -nw

#+end_src

#+src_name hello_emacs_world
#+begin_src screen :session emacs
Hello Emacs World !!!!

#+end_src

Hope you get the idea :D

Now imagine if you could send in variables, get results and being able
to put different code blocks together.


Torsten



reply via email to

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