emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Uses for :session buffers
@ 2009-11-04 19:24 Thomas S. Dye
  2009-11-04 20:44 ` Stephan Schmitt
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2009-11-04 19:24 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 880 bytes --]

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?

Any tips or advice will be appreciated.

All the best,
Tom

Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com



[-- Attachment #1.2: Type: text/html, Size: 3360 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Uses for :session buffers
  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
  2009-11-04 22:02   ` Dan Davison
  0 siblings, 2 replies; 5+ messages in thread
From: Stephan Schmitt @ 2009-11-04 20:44 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode Mailing List


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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Uses for :session buffers
  2009-11-04 20:44 ` Stephan Schmitt
@ 2009-11-04 21:26   ` Thomas S. Dye
  2009-11-04 22:02   ` Dan Davison
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2009-11-04 21:26 UTC (permalink / raw)
  To: Org Mode Mailing List

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Uses for :session buffers
  2009-11-04 20:44 ` Stephan Schmitt
  2009-11-04 21:26   ` Thomas S. Dye
@ 2009-11-04 22:02   ` Dan Davison
  2009-11-04 23:00     ` Thomas S. Dye
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Davison @ 2009-11-04 22:02 UTC (permalink / raw)
  To: Stephan Schmitt; +Cc: Org Mode Mailing List

Stephan Schmitt <drmabuse@cs.tu-berlin.de> writes:

> 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?

Hi Tom,

For R users, org-babel is intended to be used in conjunction with ESS[1]
and personally I continue to use the inferior-ESS mode *R* buffer (aka R
session buffer) in a similar way to when I was using ESS alone. So for
example

1. In an ess-mode (R) edit buffer, I use the ess-eval-* family of
   functions to evaluate lines, regions, etc. In particular, to debug a
   code block I switch to an R edit buffer with C-c ', then evaluate
   line-by-line using C-c C-n (ess-eval-line-and-step).[2]
2. In an ess-mode (R) edit buffer, I use C-z (ess-switch-to-end-of-ESS)
   to switch to the R session buffer (inferior-ESS mode)
3. In the R session buffer, I try out evaluation of expressions, query
   data structure contents with str(), list objects in the environment,
   etc.
4. There are many other nice facilities provided by ESS when working in
   an R edit buffer with an associated active R session, such as object
   name completion, displaying formal arguments to functions while you
   type, etc.

I believe that to some extent you can work in a similar way with
interactive python and ruby sessions but personally I don't have much
experience with that yet. It was always a key aim of org-babel (made
easy by org-mode's C-c ') that it should not get in the way of whatever
other emacs facilities exist for working with interactive emacs sessions
in a particular language. Incidentally, maintaining this sort of
automatic compatibility with language-specific software like ESS is one
reason why I am slightly skeptical about the value of using org-babel in
a "dual major-mode" fashion as was suggested in a separate thread today.

Dan

Footnotes:

[1] http://ess.r-project.org/

>>
>
> Another advantage: you can set a variable in one source block
> and access it in the next one.
>
> Greetings,
> 	Stephan
>
>> Any tips or advice will be appreciated.
>>
>> All the best,
>> Tom
>>
>> Thomas S. Dye, Ph.D.
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Uses for :session buffers
  2009-11-04 22:02   ` Dan Davison
@ 2009-11-04 23:00     ` Thomas S. Dye
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2009-11-04 23:00 UTC (permalink / raw)
  To: Dan Davison; +Cc: Org Mode Mailing List

On Nov 4, 2009, at 12:02 PM, Dan Davison wrote:

> Stephan Schmitt <drmabuse@cs.tu-berlin.de> writes:
>
>> 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?
>
> Hi Tom,
>
> For R users, org-babel is intended to be used in conjunction with  
> ESS[1]
> and personally I continue to use the inferior-ESS mode *R* buffer  
> (aka R
> session buffer) in a similar way to when I was using ESS alone. So for
> example
>
> 1. In an ess-mode (R) edit buffer, I use the ess-eval-* family of
>   functions to evaluate lines, regions, etc. In particular, to debug a
>   code block I switch to an R edit buffer with C-c ', then evaluate
>   line-by-line using C-c C-n (ess-eval-line-and-step).[2]
> 2. In an ess-mode (R) edit buffer, I use C-z (ess-switch-to-end-of- 
> ESS)
>   to switch to the R session buffer (inferior-ESS mode)
> 3. In the R session buffer, I try out evaluation of expressions, query
>   data structure contents with str(), list objects in the environment,
>   etc.
> 4. There are many other nice facilities provided by ESS when working  
> in
>   an R edit buffer with an associated active R session, such as object
>   name completion, displaying formal arguments to functions while you
>   type, etc.
>
> I believe that to some extent you can work in a similar way with
> interactive python and ruby sessions but personally I don't have much
> experience with that yet. It was always a key aim of org-babel (made
> easy by org-mode's C-c ') that it should not get in the way of  
> whatever
> other emacs facilities exist for working with interactive emacs  
> sessions
> in a particular language. Incidentally, maintaining this sort of
> automatic compatibility with language-specific software like ESS is  
> one
> reason why I am slightly skeptical about the value of using org- 
> babel in
> a "dual major-mode" fashion as was suggested in a separate thread  
> today.
>
> Dan
>
> Footnotes:
>
> [1] http://ess.r-project.org/

Aloha Dan,

Thank you.  This is extremely helpful, much more convenient than the  
path I was following.

I think I'm beginning to understand what Eric meant when he wrote  
about emacs taking over his OS and org-mode taking over his emacs.   
It's astonishing to me how quickly and easily org-mode + org-babel  
took over my research project.  The transition from idea to  
implementation seems almost frictionless now, and I'm just getting  
started.

All the best,
Tom

>
>>>
>>
>> Another advantage: you can set a variable in one source block
>> and access it in the next one.
>>
>> Greetings,
>> 	Stephan
>>
>>> Any tips or advice will be appreciated.
>>>
>>> All the best,
>>> Tom
>>>
>>> Thomas S. Dye, Ph.D.
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-04 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-11-04 22:02   ` Dan Davison
2009-11-04 23:00     ` Thomas S. Dye

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).