emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Rainer M Krug <Rainer@krugs.de>, emacs-orgmode@gnu.org
Cc: Eric Schulte <schulte.eric@gmail.com>
Subject: Re: [PATCH] -for review- Tangling with variable transfer of variables
Date: Thu, 19 Jun 2014 17:09:23 -0400	[thread overview]
Message-ID: <87zjh8bo8s.fsf@gmail.com> (raw)
In-Reply-To: <m2ha3g8xei.fsf@krugs.de>

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:
> 
> Hi
> 
> 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.
> 
> Hope this does not work only for me.
> 
> From f77e982e17909f2098974356c304bd29db04da79 Mon Sep 17 00:00:00 2001
> From: "Rainer M. Krug" <R.M.Krug@gmail.com>
> Date: Thu, 19 Jun 2014 22:03:46 +0200
> Subject: [PATCH] lisp/ob-R.el: Fix tangling with tables
> 
> * 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.

> ---
>  lisp/ob-R.el | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> 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 value)))
>  	     (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.

>  	      (header (if (or (eq (nth 1 value) 'hline) colnames-p)
>  			  "TRUE" "FALSE"))
>  	      (row-names (if rownames-p "1" "NULL")))
>  	  (if (= max min)
> -	      (format "%s <- read.table(\"%s\",
> +	      (format "%s <- read.table(textConnection('%s'),

This will fail if ‘file’ contains an apostrophe character.  I guess you
need to escape apostrophes in ‘file’.

HTH,

-- 
Aaron Ecay

  reply	other threads:[~2014-06-19 21:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 20:19 [PATCH] -for review- Tangling with variable transfer of variables Rainer M Krug
2014-06-19 21:09 ` Aaron Ecay [this message]
2014-06-19 23:23   ` Charles Berry
2014-06-20 13:15     ` Rainer M Krug
2014-06-20 20:34       ` Rainer M Krug
2014-06-21 19:44         ` Charles C. Berry
2014-06-22  3:39           ` Aaron Ecay
2014-06-23 10:46             ` Rainer M Krug
2014-06-23  8:57           ` Rainer M Krug
2014-06-23  9:14           ` Rainer M Krug
2014-06-23 17:56             ` Charles C. Berry
2014-06-24 12:08               ` Rainer M Krug
2014-06-23 10:45           ` Rainer M Krug
2014-06-23 18:25             ` Charles C. Berry
2014-06-24 12:28               ` Rainer M Krug
2014-06-20 13:07   ` Rainer M Krug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjh8bo8s.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=Rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).