From: Torsten Wagner <torsten.wagner@gmail.com>
To: Torsten Wagner <torsten.wagner@gmail.com>,
Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [babel] noweb and results for ob-screen?
Date: Fri, 23 Dec 2011 14:16:19 +0000 [thread overview]
Message-ID: <CAPaq-gNqB_QvinWyhx_1J60EiG5X1hwpWCsyBjEB4suwSbbbyQ@mail.gmail.com> (raw)
In-Reply-To: <87fwgc4pai.fsf@ucl.ac.uk>
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
next prev parent reply other threads:[~2011-12-23 14:16 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
2011-12-22 15:08 ` Eric S Fraga
2011-12-23 14:16 ` Torsten Wagner [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPaq-gNqB_QvinWyhx_1J60EiG5X1hwpWCsyBjEB4suwSbbbyQ@mail.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.