From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [PATCH] -for review- Tangling with variable transfer of variables Date: Fri, 20 Jun 2014 15:07:42 +0200 Message-ID: References: <87zjh8bo8s.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxyXz-00032b-OT for emacs-orgmode@gnu.org; Fri, 20 Jun 2014 09:08:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxyXs-00050m-PO for emacs-orgmode@gnu.org; Fri, 20 Jun 2014 09:08:03 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:49558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxyXs-00050g-Gh for emacs-orgmode@gnu.org; Fri, 20 Jun 2014 09:07:56 -0400 Received: by mail-wi0-f177.google.com with SMTP id r20so772893wiv.10 for ; Fri, 20 Jun 2014 06:07:55 -0700 (PDT) In-Reply-To: <87zjh8bo8s.fsf@gmail.com> (Aaron Ecay's message of "Thu, 19 Jun 2014 17:09:23 -0400") 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 Cc: Eric Schulte --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Aaron Ecay writes: > Hi Rainer, > > I have not tested the patch (I rarely use :var), but here are some > comments from reading the patch. > > 2014ko ekainak 19an, Rainer M Krug-ek idatzi zuen: >>=20 >> Hi >>=20 >> This patch should fix the problem of tangling with variable transfer of >> tables. It uses a textConection() instead of a file to transfer the >> table. This results in variable transfer of variables in R, without >> having to include additional files. >>=20 >> Hope this does not work only for me. >>=20 >> From f77e982e17909f2098974356c304bd29db04da79 Mon Sep 17 00:00:00 2001 >> From: "Rainer M. Krug" >> Date: Thu, 19 Jun 2014 22:03:46 +0200 >> Subject: [PATCH] lisp/ob-R.el: Fix tangling with tables >>=20 >> * lisp/ob-R.el (org-babel-R-assign-elisp): Fix variable transfer of >> tables by using text connections in R instead of files. Variable >> transfer of tables does not depend on files anymore, i.e. works also >> when tangling. > > The changelog comment should not be indented on the subsequent lines. > I believe the standard is also to double-space after sentence-ending > periods. OK - I'll fix this. > >> --- >> lisp/ob-R.el | 13 ++++--------- >> 1 file changed, 4 insertions(+), 9 deletions(-) >>=20 >> diff --git a/lisp/ob-R.el b/lisp/ob-R.el >> index a3ae1ec..88f65f3 100644 >> --- a/lisp/ob-R.el >> +++ b/lisp/ob-R.el >> @@ -190,25 +190,20 @@ This function is called by `org-babel-execute-src-= block'." >> (if (listp value) >> (let* ((lengths (mapcar 'length (org-remove-if-not 'sequencep val= ue))) >> (max (if lengths (apply 'max lengths) 0)) >> - (min (if lengths (apply 'min lengths) 0)) >> - (transition-file (org-babel-temp-file "R-import-"))) >> + (min (if lengths (apply 'min lengths) 0))) >> ;; Ensure VALUE has an orgtbl structure (depth of at least 2). >> (unless (listp (car value)) (setq value (list value))) >> - (with-temp-file transition-file >> - (insert >> - (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field)) >> - "\n")) >> - (let ((file (org-babel-process-file-name transition-file 'noquote)) >> + (let ((file (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field))) > > As a cosmetic issue, you might want to pick a different name for this > variable now that it no longer holds a file name. Well - I thought about it, but it holds the value which is passed to the argument "file" so I left it as it is to make this clear. > >> (header (if (or (eq (nth 1 value) 'hline) colnames-p) >> "TRUE" "FALSE")) >> (row-names (if rownames-p "1" "NULL"))) >> (if (=3D max min) >> - (format "%s <- read.table(\"%s\", >> + (format "%s <- read.table(textConnection('%s'), > > This will fail if =E2=80=98file=E2=80=99 contains an apostrophe character= . I guess you > need to escape apostrophes in =E2=80=98file=E2=80=99. True - I did not think to much into the escaping issue.=20 Thanks,=20=20 Rainer > > HTH, =2D-=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 : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJTpDIiAAoJENvXNx4PUvmCe0EIAKhAMLevYlajVGXfbSnS8Vcz 6+Dt95wzYM86kbjz8/OI6A55hvhnj4VPSMei+8F2JPafeRfbd1IUsnYx8tMZduzn 8OLf49oo/hJRei5a7lNnhvBGmUdcx6vudDeMvcM24xFXDWZxE6/JgQ3KpnNwrB6w Ajfbw6U2ouejV5zJkDKL6bXuUbwb72foKnODBZTH5YRPVCT5ae1KfZhn8Rc/U4Vj h2hWzBx4ZSgCkrPWQduZ8LC1AnPRcoZl9YHIpfek4QggBjH1GF0Q/ewf2wCGgbME Uyh/Wnt9t4dGfoQmgtR45lAIdqtddPpf/mxQ/XGKdR+SnUT/vY/XbDkTnWTIdug= =CcI/ -----END PGP SIGNATURE----- --=-=-=--