From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Need control over insertion point of variables in code blocks Date: Fri, 22 Jul 2011 10:02:55 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016363b8e1e96e49204a8a3e44e Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkAhE-0003wu-St for emacs-orgmode@gnu.org; Fri, 22 Jul 2011 04:02:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QkAhD-00029I-QE for emacs-orgmode@gnu.org; Fri, 22 Jul 2011 04:02:56 -0400 Received: from mail-qw0-f41.google.com ([209.85.216.41]:62455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkAhD-000296-Mi for emacs-orgmode@gnu.org; Fri, 22 Jul 2011 04:02:55 -0400 Received: by qwa26 with SMTP id 26so1342866qwa.0 for ; Fri, 22 Jul 2011 01:02:55 -0700 (PDT) In-Reply-To: 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: Dirk Scharff Cc: Org mailing list --0016363b8e1e96e49204a8a3e44e Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Fri, Jul 22, 2011 at 9:55 AM, Dirk Scharff wrote: > Hi > > Am 22.07.2011 um 09:34 schrieb Rainer M Krug: > > For tangling: you could put from __future__ imports into the :shebang a= nd > use padline ":padline no", i.e.: > > #+source: the_test > #+begin_src python :var x=3D3 :tangle test.py :results output :shebang fr= om > __future__ imports :padline no > print x > #+end_src > > which results in > > from __future__ imports > print x > > Keep in mind, that I have NEVER used python (although I should=85). > > > While I'd not call that a clean solution to the problem it will keep me > going for now. > Agreed - but it works. Good. > > Thank you very much for pointing that possibility out, I haven't thought > about trying to move the import statement. > > As for python: its a nice language worth trying in my opinion ;) > Sounds like it - I just need time..... Cheers and good luck with your thesis, Rainer > > > With this i could do the table calculation manually by inserting 100-1000 > call statements (in the real use case I need for my masters-thesis) but i= t > would be really nice if i could use a table cell as argument for > code-blocks. > > A second problem I have at the moment lies with the execution of >> source-blocks in tables. What I'd like to do: >> >> | argument | result | >> | 1 | #ERROR | >> | | | >> #+TBLFM: $2=3Dcall_the_test(x=3D$<) >> >> I guess I'm just doing something wrong here. Executing the #+Tblfm resul= ts >> in the error: "reference $< not found in buffer". How do I do the refere= nce >> correctly in this case? >> >> You can test both cases in the attached org-file. >> > > > best regards, > Dirk > --=20 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax (F): +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug --0016363b8e1e96e49204a8a3e44e Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable

On Fri, Jul 22, 2011 at 9:55 AM, Dirk Sc= harff <= dirk.scharff@googlemail.com> wrote:
Hi

Am 22.07.201= 1 um 09:34 schrieb Rainer M Krug:

For tangling: you could put =A0= =A0from __future__ imports into the :shebang and use padline ":padline= no", i.e.:

#+source: the_test
#+begin_src python :v= ar x=3D3 :tangle test.py :results output :shebang from __future__ imports := padline no
print x
#+end_src

which resul= ts in

from __future__ imports
print= x

Keep in mind, that I have NEVER use= d python (although I should=85).

While I'd not call that a clean solut= ion to the problem it will keep me going for now.=A0

Agreed - but it works. Good.
=A0=A0

Thank you very much= for pointing that possibility out, I haven't thought about trying to m= ove the import statement.=A0

As for python: its a = nice language worth trying in my opinion ;) =A0

Sounds like it - I just need t= ime.....

Cheers and good luck with your thesis,

Rainer
=A0


With this i could do the table calculation manually by inserting 100-1000 = call statements (in the real use case I need for my masters-thesis) but it = would be really nice if i could use a table cell as argument for code-block= s.=A0

=
A second problem I have at the moment lies with the execution of source-blo= cks in tables. What I'd like to do:

| argument | result |
| =A0 =A0 =A0 =A01 | #ERROR |
| =A0 =A0 =A0 =A0 =A0| =A0 =A0 =A0 =A0|
#+TBLFM: $2=3Dcall_the_test(x=3D$<)

I guess I'm just doing something wrong here. Executing the #+Tblfm resu= lts in the error: "reference $< not found in buffer". How do I= do the reference correctly in this case?

You can test both cases in the attached org-file.


best regards,
Dirk<= /div>



--
Rainer M. Kr= ug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl.= Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch UniversitySouth Africa

Tel : =A0 =A0 =A0 +33 - (0)9 53 10 27 44
Cell: =A0 = =A0 =A0 +33 - (0)6 85 62 59 98
Fax (F): =A0 =A0 =A0 +33 - (0)9 58 10 27 = 44

Fax (D): =A0 =A0+49 - (0)3 21 21 25 22 44

email: =A0 =A0 =A0= Rainer@krugs.de

Skype: =A0 =A0 =A0RMkrug

--0016363b8e1e96e49204a8a3e44e--