emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.com>
To: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [babel] Uses for :session buffers
Date: Wed, 4 Nov 2009 11:26:25 -1000	[thread overview]
Message-ID: <585097C7-6165-400F-A209-D478284C796C@tsdye.com> (raw)
In-Reply-To: <4AF1E793.2080205@cs.tu-berlin.de>

On Nov 4, 2009, at 10:44 AM, Stephan Schmitt wrote:

>
> Thomas S. Dye wrote:
>> Aloha all,
>> I'm trying to comprehend the possibilities created by org-babel,  
>> and would like to draw on the experience of others if I could.
>> I recently discovered the buffer created by :session.  In my case,  
>> this is an R session that I am building to track the data  
>> collection phase of a research project.  I was delighted to find  
>> that it appears to have recorded everything my org file had done in  
>> that session.  I have a vague idea that it might be useful to save  
>> this as a log to prove that all the little source blocks in my org  
>> file indeed were called and executed successfully. I'm wondering:  
>> do other org-babelers use the :session buffer?  How?  For what  
>> purpose?
>
> Another advantage: you can set a variable in one source block
> and access it in the next one.
>
> Greetings,
> 	Stephan
>
Aloha Stephan,

Yes, this is a tremendous advantage.

I'm using my org file as a laboratory notebook.  The R source code  
blocks track data entry progress (among other things), so I need to re- 
establish sessions whenever I come back to the project.  I have an R  
source block that I run each time I open the org file.  It looks like  
something like this:

#+src_name r-adze-session
#+begin_src R :session adze :noweb :results output
  library(ggplot2)
  library(xtable)
  <<r-connect>>
  <<r-complete-2>>
  objects()
#+end_src

where <<r-connect>> connects R to our database server and <<r- 
complete-2>> is a query of the database that populates a data frame in  
the R session.  The call to objects() lets me know wether or not the  
session is populated with the objects I'm expecting to be there.

I'm particularly interested in the emacs buffer that is established  
for the session (in this case "adze"), which looks like this when I  
run r-adze-session:

tdye> library(ggplot2)
tdye> library(xtable)
tdye> library(RMySQL)
...

I'm wondering if there is a standard (or intended) use for this file,  
perhaps as a log, or if other org-babelers typically discard it, as  
I've been doing?

All the best,
Tom

>

>> Any tips or advice will be appreciated.
>> All the best,
>> Tom
>> Thomas S. Dye, Ph.D.

  reply	other threads:[~2009-11-04 21:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 19:24 [babel] Uses for :session buffers Thomas S. Dye
2009-11-04 20:44 ` Stephan Schmitt
2009-11-04 21:26   ` Thomas S. Dye [this message]
2009-11-04 22:02   ` Dan Davison
2009-11-04 23:00     ` Thomas S. Dye

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=585097C7-6165-400F-A209-D478284C796C@tsdye.com \
    --to=tsd@tsdye.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).