From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Best Subject: Re: do sh source blocks ignore args? [7.8.09] Date: Thu, 26 Apr 2012 16:16:53 -0500 Message-ID: References: <87ehraxqs9.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNW3f-00042C-UQ for emacs-orgmode@gnu.org; Thu, 26 Apr 2012 17:17:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SNW3d-0005y7-HY for emacs-orgmode@gnu.org; Thu, 26 Apr 2012 17:16:59 -0400 Received: from mailhost.anl.gov ([130.202.113.50]:49873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNW3d-0005wi-BV for emacs-orgmode@gnu.org; Thu, 26 Apr 2012 17:16:57 -0400 Received: from mailhost.anl.gov (mailhost.anl.gov [130.202.113.50]) by localhost.anl.gov (Postfix) with ESMTP id 53D866B for ; Thu, 26 Apr 2012 16:16:54 -0500 (CDT) Received: from zimbra.anl.gov (zimbra.anl.gov [130.202.101.12]) by mailhost.anl.gov (Postfix) with ESMTP id 4105868 for ; Thu, 26 Apr 2012 16:16:54 -0500 (CDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.anl.gov (Postfix) with ESMTP id 3360E12923 for ; Thu, 26 Apr 2012 16:16:54 -0500 (CDT) Received: from zimbra.anl.gov ([127.0.0.1]) by localhost (zimbra.anl.gov [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1o6q17Gw-R-M for ; Thu, 26 Apr 2012 16:16:54 -0500 (CDT) Received: from mail-ob0-f169.google.com (mail-ob0-f169.google.com [209.85.214.169]) by zimbra.anl.gov (Postfix) with ESMTPSA id 0781112922 for ; Thu, 26 Apr 2012 16:16:53 -0500 (CDT) Received: by obbeh20 with SMTP id eh20so87752obb.0 for ; Thu, 26 Apr 2012 14:16:53 -0700 (PDT) In-Reply-To: <87ehraxqs9.fsf@gmx.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Org-mode version 7.8.09 How could this be? I ran it in a separate, minimally configured Emacs and got the good behavior, so org-version must be lying somehow or else not all of the functions were redefined when I upgraded. I thought a reload uncompiled would take care of this. I'll restart emacs and try it again. Thanks for the sanity check. On Thu, Apr 26, 2012 at 1:59 PM, Eric Schulte wrote: > Neil Best writes: > >> Can sh source block take arguments? =A0I get nothing. >> >> #+NAME: test(foo=3D"bar") >> #+BEGIN_SRC sh :session :results output verbatim replace >> =A0 echo "1. foo is $foo" >> =A0 echo "2. foo is ${foo}" >> #+END_SRC >> >> #+RESULTS: >> : 1. foo is >> : 2. foo is >> >> >> . . . but this is fine: >> >> #+NAME: test2 >> #+BEGIN_SRC sh :var foo=3D"bar" :session :results output verbatim >> replace >> =A0 echo "1. foo is $foo" >> =A0 echo "2. foo is ${foo}" >> #+END_SRC >> >> #+RESULTS: >> : 1. foo is bar >> : 2. foo is bar >> >> When I tried this: >> >> #+CALL: test("baz") >> >> I get "reference 'test' not found in this buffer" -- what does this >> mean? =A0I got a similar message when I tried to define a simple call >> using an R fragment that has a session associated with it. =A0Evaluating >> the code block with the default argument works fine, but a #+CALL: >> construct fails. =A0Maybe this is a separate issue. >> >> I trolled the web for relevant examples or reports but found none. =A0My >> setup is pretty much out-of-the-box. =A0I am on Ubuntu Oneiric so sh is >> a symlink to dash. =A0I was not aware of dash until now so I don't know >> what the implications of that are. >> >> This example may be overly trivial. =A0My ultimate goal is to generate >> shell scripts as function of the argument and tangle them out >> something like this: >> >> #+BEGIN_SRC sh :tangle someArg.sh >> =A0 <> >> #+END_SRC >> >> So the results of the "function" will be lines of script code with >> variables already interpolated using echo and a heredoc. =A0Note that >> test2 will not allow me to paramterize this, AFAIK. =A0I'll have to >> write each tangle block by hand but there's a small number of them. >> If there is a more clever way I am certainly interested, but it seems >> irrelevant until I understand what is happening above. =A0Thanks. =A0I a= m >> very intrigued by LP possibilities using Org after messing with Sweave >> for a year+, so please bear with me as I cut my teeth. >> > > Hi Neil, > > Are you using the latest version of Org-mode? =A0I ask because all of you= r > examples work as expected on my system, specifically I get the > following... > > Best, > > #+NAME: test(foo=3D"bar") > #+BEGIN_SRC sh :session :results output verbatim replace > =A0echo "1. foo is $foo" > =A0echo "2. foo is ${foo}" > #+END_SRC > > #+RESULTS: test > : 1. foo is bar > : 2. foo is bar > > . . . but this is fine: > > #+NAME: test2 > #+BEGIN_SRC sh :var foo=3D"bar" :session :results output verbatim > replace > =A0echo "1. foo is $foo" > =A0echo "2. foo is ${foo}" > #+END_SRC > > #+RESULTS: test2 > : 1. foo is bar > : 2. foo is bar > > #+RESULTS: > : 1. foo is bar > : 2. foo is bar > > When I tried this: > > #+CALL: test("baz") > > #+RESULTS: test("baz") > : 1. foo is baz > : 2. foo is baz > > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/