emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [babel] noweb for :sessions?


From: Eric Schulte
Subject: Re: [Orgmode] [babel] noweb for :sessions?
Date: Mon, 19 Oct 2009 12:15:24 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (darwin)

Hi Tom,

That is an interesting proposal, and surprisingly simple to implement.
Please pull the latest version of Org-mode, and you will find that there
is now a :noweb header argument available for source-code blocks which
has the effect of expanding noweb references before source-block
evaluation (as you suggested below).  So for example the following
works.

--8<---------------cut here---------------start------------->8---
#+srcname: noweb-example
#+begin_src ruby 
  a = 28
#+end_src

#+begin_src ruby :noweb
  # <<noweb-example>>
  a + 4
#+end_src

#+resname:
: 32
--8<---------------cut here---------------end--------------->8---

Does this satisfy the behavior you were suggesting?

Thanks for the idea! -- Eric

"Thomas S. Dye" <address@hidden> writes:

> Aloha all,
>
> Is it possible to define frequently used code snippets in a generic way so 
> they can be used in different
> sessions?
>
> Something like this is what I have in mind:
>
> #+srcname: r-connect
> #+begin_src R :exports none :session any
> library(rMySQL)
> con <- dbConnect(MySQL(), user="user_name", password="password", 
>                      dbname="db_name", host="host_name")
> #+end_src
>
> #+srcname: r-query
> #+begin_src R :session session-1 
> # <<r-connect>>
> res <- dbGetQuery(con, "select * from table_name where 1")
> #+end_src
>
> Tom
>
> Thomas S. Dye, Ph.D.
>
> T. S. Dye & Colleagues, Archaeologists, Inc.
>
> Phone: (808) 529-0866 Fax: (808) 529-0884
>
> http://www.tsdye.com
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

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