From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: [PATCH] Re: [BUG] [babel] R graphics header arg :units Date: Mon, 18 Jun 2012 17:36:02 -1000 Message-ID: References: <871uldd738.fsf@med.uni-goettingen.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgpEi-0001sz-GK for emacs-orgmode@gnu.org; Mon, 18 Jun 2012 23:36:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgpEg-0003Yt-D8 for emacs-orgmode@gnu.org; Mon, 18 Jun 2012 23:36:12 -0400 Received: from oproxy9.bluehost.com ([69.89.24.6]:50027) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SgpEg-0003YH-36 for emacs-orgmode@gnu.org; Mon, 18 Jun 2012 23:36:10 -0400 In-Reply-To: <871uldd738.fsf@med.uni-goettingen.de> (Andreas Leha's message of "Sun, 17 Jun 2012 22:19:39 +0200") 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: Andreas Leha Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Andreas Leha writes: > Hi all, > > I am having troubles in using the header argument :units which is > implemented for R source blocks. Example: > > #+begin_src R :results graphics :file wideplot.png :width 14 :height 7 :units "cm" > plot(1:10, 1:10) > #+end_src > > > This expands to > > : png(filename="wideplot.png",height=7,units=cm,width=14) > : plot(1:10, 1:10) > : dev.off() > > and leads -- when evaluated -- to the error > > : Fehler in match.arg(units, c("in", "px", "cm", "mm")) : > : 'arg' must be NULL or a character vector > > I guess this is a bug, correct? Otherwise, how do I correctly use > this header argument? > > Regards, > Andreas > > > Aloha all, The attached patch handles quoted string values for R device header arguments. With the patch the following works as expected: #+header: :width 100 :height 100 :units "mm" :res 120 #+BEGIN_SRC R :results graphics :file "test.png" x <- c(1,2,3,4,5) y <- x plot(x,y) #+END_SRC All the best, Tom --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-R.el-Handle-quoted-string-values-to-device-h.patch Content-Description: Patch for ob-R.el >From b8aa7b26f56300faadd1a40433208ef18db8ae73 Mon Sep 17 00:00:00 2001 From: Thomas Dye Date: Mon, 18 Jun 2012 17:26:09 -1000 Subject: [PATCH] * lisp/ob-R.el: Handle quoted string values to device header arguments --- lisp/ob-R.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index d23f269..0802736 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -260,7 +260,7 @@ current code buffer." (setq args (mapconcat (lambda (pair) (if (member (car pair) allowed-args) - (format ",%s=%s" + (format ",%s=%S" (substring (symbol-name (car pair)) 1) (cdr pair)) "")) params "")) -- 1.7.5.4 --=-=-= Content-Type: text/plain -- Thomas S. Dye http://www.tsdye.com --=-=-=--