From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas S. Dye" Subject: Re: [babel] noweb does not work (as expected) Date: Sun, 8 Nov 2009 18:33:09 -1000 Message-ID: <1521DF86-F0CA-4730-A179-3C6F93C67825@tsdye.com> References: <200911091247.48775.torsten.wagner@googlemail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: multipart/mixed; boundary="===============1608588414==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7LwO-00016h-FL for emacs-orgmode@gnu.org; Sun, 08 Nov 2009 23:33:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7LwI-00015v-Rf for emacs-orgmode@gnu.org; Sun, 08 Nov 2009 23:33:19 -0500 Received: from [199.232.76.173] (port=46131 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7LwI-00015s-M8 for emacs-orgmode@gnu.org; Sun, 08 Nov 2009 23:33:14 -0500 Received: from outbound-mail-109.bluehost.com ([69.89.22.9]:55428) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N7LwI-00086v-32 for emacs-orgmode@gnu.org; Sun, 08 Nov 2009 23:33:14 -0500 In-Reply-To: <200911091247.48775.torsten.wagner@googlemail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Torsten Wagner Cc: Org Mode Mailing List --===============1608588414== Content-Type: multipart/alternative; boundary=Apple-Mail-8-261115790 --Apple-Mail-8-261115790 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Nov 8, 2009, at 5:47 PM, Torsten Wagner wrote: > Hi everyone, > > I tried to use the noweb-syntax to tangle all the pieces of source > code blocks > together as proposed by Tom. > > However, for some reasons it does not work. > I notice there are two different syntax for noweb. One propsed on > worg and the > other in examples here in the mailing list. Which one will be > correct ? or are > both correct but with different purpose ? > > I used the latest git-version and even tried the branch noweb-evaluate > > What I used was a source code block at the end of my org-file like: > All other blocks are defined above. > > #+srcname: makefile() > #+begin_src python :tangle simulate_ofdm :exports none > <> > <> > <> > <> > <> > #+end_src > #+resname: makefile > > However > the tangled file results only in > > #!/usr/bin/env python > # generated by org-babel-tangle > # [[file:~/test_noweb.org::*Result][makefile]] > > # makefile ends here > > An execution of block shows nothing on the *Shell output* buffer > It seems somehow I missunderstand which part of a block will replace a > <> variable. I thouht it will be replaced by the complete > source block > content during tangle. > > Any ideas ? > > Thanks, > > Torsten > > > _______________________________________________ > 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 Hi Torsten, I've been working successfully with your makefile idea. Here is one that works for me: -------------------------------------- #+begin_src R :noweb :session 135cultural <> <> # run queries <> <> <> <> # reshape query results and run PCA <> <> <> # make biplots <> <> # segment plot <> # make tables for LaTeX # <> <> #+end_src ------------------------------------------------- A typical source block looks like this: ------------------------------------------------- #+srcname: r-load-libraries #+begin_src R library(RMySQL) library(reshape) library(xtable) #+end_src ------------------------------------------------- Note that I don't :tangle this, but use the :noweb feature, instead. Also, my "makefile" runs all its :noweb source blocks in a :session, where the environment set up by each source block can persist and be referenced by other source blocks. This particular makefile has run successfully dozens of times, as I fix little things and add new ones. I don't know if this is the best way to accomplish this, or if it is what you are trying to achieve at the moment. But, it looks to me as if you might want to :noweb instead of :tangle and perhaps establish a :session in case your source blocks need to communicate with one another. HTH, Tom Thomas S. Dye, Ph.D. T. S. Dye & Colleagues, Archaeologists, Inc. Phone: (808) 529-0866 Fax: (808) 529-0884 http://www.tsdye.com --Apple-Mail-8-261115790 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
On Nov 8, 2009, at = 5:47 PM, Torsten Wagner wrote:

Hi = everyone,

I tried to use the noweb-syntax to tangle all the = pieces of source code blocks
together as proposed by = Tom.

However, for some reasons it does not work.
I notice = there are two different syntax for noweb. One propsed on worg and the =
other in examples here in the mailing list. Which one will be = correct ? or are
both correct but with different purpose ?

I = used the latest git-version and even tried the branch = noweb-evaluate

What I used was a source code block at the end of = my org-file like:
All other blocks are defined = above.

#+srcname: makefile()
#+begin_src python :tangle = simulate_ofdm :exports none
 <<block1>>
=  <<block2>>
 <<block3>>
=  <<block4>>
=  <<block5>>
#+end_src
#+resname: = makefile

However
the tangled file results only in =

#!/usr/bin/env python
# generated by org-babel-tangle
# = [[file:~/test_noweb.org::*Result][makefile]]

# makefile ends = here

An execution of block shows nothing on the *Shell output* = buffer
It seems somehow I missunderstand which part of a block will = replace a
<<noweb>>  variable. I thouht it will be = replaced by the complete source block
content during tangle. =

Any ideas = ?

Thanks,

Torsten


_______________________________= ________________
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
<= br>
Hi Torsten,

I've been working = successfully with your makefile idea.  Here is one that works for = me:

--------------------------------------
<= div>
#+begin_src R :noweb :session = 135cultural 
   = <<r-load-libraries>>
   = <<r-connect>>
   # run = queries
   = <<r-135-artifacts-wt-cultural>>
   = <<r-135-artifacts-ct-cultural>>
   = <<r-135-inverts-cultural>>
   = <<r-135-verts-cultural>>
   # reshape = query results and run PCA
   = <<r-135-reshape>>
   = <<r-135-merge>>
   = <<r-135-prcomp>>
   # make = biplots
   = <<r-135-plot-pca-1-2-cultural>>
   = <<r-135-plot-pca-2-3-cultural>>
   # = segment plot
   = <<r-135-stars-cultural>>
   # make = tables for LaTeX
  # = <<r-135-table-pca>>
   = <<r-disconnect>>
#+end_src

= -------------------------------------------------

A typical source block looks like = this:

-------------------------------------------= ------

#+srcname: = r-load-libraries
#+begin_src = R
  library(RMySQL)
  library(resh= ape)
  library(xtable)
#+end_src
<= br>
-------------------------------------------------
=

Note that I don't :tangle this, but use the :noweb = feature, instead.  Also, my "makefile" runs all its :noweb source = blocks in a :session, where the environment set up by each source block = can persist and be referenced by other source blocks.  This = particular makefile has run successfully dozens of times, as I fix = little things and add new ones.

I don't know if = this is the best way to accomplish this, or if it is what you are trying = to achieve at the moment.  But, it looks to me as if you might want = to :noweb instead of :tangle and perhaps establish a :session in case = your source blocks need to communicate with one = another.

HTH,
Tom

<= /div>

Thomas S. Dye, Ph.D.

T. S. Dye & Colleagues, = Archaeologists, Inc.

Phone: (808) 529-0866 Fax: (808) 529-0884

=

= --Apple-Mail-8-261115790-- --===============1608588414== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1608588414==--