From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [BABEL] BUG Re: Omitting try/catch blocks from tangled R code? Date: Mon, 31 Mar 2014 09:52:09 +0200 Message-ID: References: <52F498AE.6090802@krugs.de> <87siruamo3.fsf@gmail.com> <52F5326C.7010505@krugs.de> <877g7syio6.fsf@gmail.com> <87txawwwh6.fsf@gmail.com> <87r45xeabf.fsf@gmail.com> <87fvm8gxok.fsf@gmail.com> <87siq7g2j5.fsf@gmail.com> <87d2h71qqc.fsf@bagel.gateway.pace.com> <87fvlzg45i.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]:59838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUX17-0005bP-EB for emacs-orgmode@gnu.org; Mon, 31 Mar 2014 03:52:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUX11-0000EY-5P for emacs-orgmode@gnu.org; Mon, 31 Mar 2014 03:52:25 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:44627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUX10-0000EM-S9 for emacs-orgmode@gnu.org; Mon, 31 Mar 2014 03:52:19 -0400 Received: by mail-wg0-f48.google.com with SMTP id l18so5552236wgh.7 for ; Mon, 31 Mar 2014 00:52:17 -0700 (PDT) In-Reply-To: <87fvlzg45i.fsf@gmail.com> (Eric Schulte's message of "Sun, 30 Mar 2014 08:19:37 -0600") 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: Eric Schulte Cc: emacs-orgmode@gnu.org, Charles Berry --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eric Schulte writes: >> >> Apologies - I am still struggling with encryption...... >> >> So here is my example: >> >> --8<---------------cut here---------------start------------->8--- >> #+TITLE: single_to_multi >> #+DATE: <2013-10-15 Tue> >> #+AUTHOR: Rainer M. Krug >> #+EMAIL: Rainer@krugs.de >> >> =E2=89=88* Load R packages and data >> #+BEGIN_SRC R >> cat("Loading Data\n") >> #+END_SRC >> --8<---------------cut here---------------end--------------->8--- >> >> I am using only org loaded and R enabled. >> >> C-c C-c on the block produces the error >> >> emacs version:=20 >> GNU Emacs 24.3.1 (x86_64-apple-darwin13.0.0, Carbon Version 1.6.0 >> AppKit 1265) of 2014-02-13 on Rainers-MacBook-Pro-2.local >> >> org version: >> Org-mode version 8.2.5h (release_8.2.5h-837-gb296cc @ >> /Users/rainerkrug/.emacs.d/org-mode/lisp/) >> > > Thanks, a fixed version of the patch is attached. If this works please > let me know and I'll apply. Still the same error: ,---- | Debugger entered--Lisp error: (wrong-type-argument sequencep 99) | Mapconcat(identity "cat(\"YEAR\")" "\n") | Org-babel-execute:R("cat(\"YEAR\")" ((:comments . "") (:shebang . "") (= :cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports .= "code") (:results . "replace output") (:session . "none") (:hlines . "no")= (:result-type . output) (:result-params "output" "replace") (:rowname-name= s) (:colname-names))) | org-babel-execute-src-block(nil) | org-babel-execute-src-block-maybe() | org-babel-execute-maybe() | org-babel-execute-safely-maybe() | run-hook-with-args-until-success(org-babel-execute-safely-maybe) | org-ctrl-c-ctrl-c(nil) | call-interactively(org-ctrl-c-ctrl-c nil nil) `---- Cheers, Rainer > > Best, > > > From d67248db79faf19e1bdcac0230c37670b6115bdd Mon Sep 17 00:00:00 2001 > From: Eric Schulte > Date: Sun, 23 Mar 2014 20:01:37 -0600 > Subject: [PATCH] only wrap R code graphics-file on execution > > Move this out of the expand-body function so that it is *never* > applied to tangled code. > --- > lisp/ob-R.el | 40 +++++++++++++++++++++------------------- > 1 file changed, 21 insertions(+), 19 deletions(-) > > diff --git a/lisp/ob-R.el b/lisp/ob-R.el > index 62aa7f2..780d99f 100644 > --- a/lisp/ob-R.el > +++ b/lisp/ob-R.el > @@ -97,24 +97,15 @@ this variable.") > "Expand BODY according to PARAMS, return the expanded body." > (let ((graphics-file > (or graphics-file (org-babel-R-graphical-output-file params)))) > - (mapconcat > - #'identity > - (let ((inside > - (append > - (when (cdr (assoc :prologue params)) > - (list (cdr (assoc :prologue params)))) > - (org-babel-variable-assignments:R params) > - (list body) > - (when (cdr (assoc :epilogue params)) > - (list (cdr (assoc :epilogue params))))))) > - (if graphics-file > - (append > - (list (org-babel-R-construct-graphics-device-call > - graphics-file params)) > - inside > - (list "},error=3Dfunction(e){plot(x=3D-1:1, y=3D-1:1, type= =3D'n', xlab=3D'', ylab=3D'', axes=3DFALSE); text(x=3D0, y=3D0, labels=3De$= message, col=3D'red'); paste('ERROR', e$message, sep=3D' : ')}); dev.off()"= )) > - inside)) > - "\n"))) > + (mapconcat #'identity > + (append > + (when (cdr (assoc :prologue params)) > + (list (cdr (assoc :prologue params)))) > + (org-babel-variable-assignments:R params) > + (list body) > + (when (cdr (assoc :epilogue params)) > + (list (cdr (assoc :epilogue params))))) > + "\n"))) >=20=20 > (defun org-babel-execute:R (body params) > "Execute a block of R code. > @@ -127,7 +118,18 @@ This function is called by `org-babel-execute-src-bl= ock'." > (colnames-p (cdr (assoc :colnames params))) > (rownames-p (cdr (assoc :rownames params))) > (graphics-file (org-babel-R-graphical-output-file params)) > - (full-body (org-babel-expand-body:R body params graphics-file)) > + (full-body > + (let ((inside > + (list (org-babel-expand-body:R body params graphics-file)))) > + (mapconcat #'identity > + (if graphics-file > + (append > + (list (org-babel-R-construct-graphics-device-call > + graphics-file params)) > + inside > + (list "},error=3Dfunction(e){plot(x=3D-1:1, y=3D-1:1, type=3D'n= ', xlab=3D'', ylab=3D'', axes=3DFALSE); text(x=3D0, y=3D0, labels=3De$messa= ge, col=3D'red'); paste('ERROR', e$message, sep=3D' : ')}); dev.off()")) > + inside) > + "\n"))) > (result > (org-babel-R-evaluate > session full-body result-type result-params > --=20 > 1.9.1 =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJTOR6vAAoJENvXNx4PUvmC7YcH/Rsq/9nrXFfs3P3vrc2l29vO ITCIWpT8ETQ8fdPR4vMS1fGuXfON2kpHzrGvBRIjx0HKqeSEkpJ34+e0TOCW+oZl ApGyPkHGttJwbPmGv5VCsvtEHGnUT2zXhjEdrFSBbb5q3KyhABYwq1MlRC2nA2dL oGx4idPv6+1+7/nnKpqRQc8aTvL88Q+xNVdWajFFHqNBb5v+mWxRQnl2yYTVOX7s 0ldkce5Y+wNLdp0WHcQMDQpSFB0a+fuwlO0jUKGBdqOpd/mgQer6PlludpUxT1zS /RORARs/wOscnhSC/oi+XLEUmZrZvFRdbA4fDLwaea+aRehLawHoeTwl7wy44Q0= =CATI -----END PGP SIGNATURE----- --=-=-=--