From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: [PATCH] -for review- Tangling with variable transfer of variables Date: Sat, 21 Jun 2014 12:44:01 -0700 Message-ID: References: <87zjh8bo8s.fsf@gmail.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyRD9-0007dI-VB for emacs-orgmode@gnu.org; Sat, 21 Jun 2014 15:44:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WyRD3-0004My-4q for emacs-orgmode@gnu.org; Sat, 21 Jun 2014 15:44:27 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:22138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyRD2-0004Mg-S8 for emacs-orgmode@gnu.org; Sat, 21 Jun 2014 15:44:21 -0400 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: Rainer M Krug Cc: emacs-orgmode@gnu.org, Eric Schulte On Fri, 20 Jun 2014, Rainer M Krug wrote: > Attached please find =the reworked patch. > > 1) uses local() and closes connection > 2) does not leave a variable cal;led file behind > Seems to work on a few test cases. I'd move the strings to defconsts. Putting a newline before each `%S' will outdent the first line of :var value when it is echoed in the session log so it will be easier to view. === With Eric's input on this: Would you also change this at the end of org-babel-R-assign-elisp: res})" name file header row-names max)))) - (format "%s <- %s" name (org-babel-R-quote-tsv-field value)))) + (format "%s <- %S" name + (if (stringp value) value (prin1-to-string value))))) ?? I think this is innocuous for plain strings with no internal quotes, but allows almost anything to be passed to R as a string. So :var x=[1 2 3 "4" 5] will be passed to R as x <- "[1 2 3 \"4\" 5]" instead of x <- "[1 2 3 "4" 5] which throws an error. And this just works: #+NAME: latex-capt #+BEGIN_SRC latex \begin{math} y = X\beta, \mbox{where } \beta = %beta% \end{math} #+END_SRC #+BEGIN_SRC R :var ytxt=latex-capt :results raw :wrap latex beta <- 1.234 sub("%beta%",beta,ytxt) #+END_SRC HTH, Chuck