Eric Schulte <schulte.e...@gmail.com> writes:

> Rainer M Krug <rai...@krugs.de> writes:
>
>> Eric Schulte <schulte.e...@gmail.com> 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: rai...@krugs.de
>>>>
>>>> ≈* 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: 
>>>> 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:
>>
>
> Your previous example works as expected for me with the latest patch.
>
>     * Load R packages and data
>
>     #+BEGIN_SRC R :results output
>     cat("Loading Data\n")
>     #+END_SRC
>
>     #+RESULTS:
>     : Loading Data
>
> Please double check that you applied the patch and reloaded Org-mode,
> and if the bug persists provide another minimal example.

Sorry - no idea what went wrong, but I assumed I applied the old
patch.

I applied the patch and it is working.

Cheers,

Rainer

>
> Thanks,
>
>>
>> ,----
>> | 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-names) (: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 <schulte.e...@gmail.com>
>>> 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=function(e){plot(x=-1:1, y=-1:1, type='n', 
>>> xlab='', ylab='', axes=FALSE); text(x=0, y=0, labels=e$message, col='red'); 
>>> paste('ERROR', e$message, sep=' : ')}); 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")))
>>>  
>>>  (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-block'."
>>>        (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=function(e){plot(x=-1:1, y=-1:1, 
>>> type='n', xlab='', ylab='', axes=FALSE); text(x=0, y=0, labels=e$message, 
>>> col='red'); paste('ERROR', e$message, sep=' : ')}); dev.off()"))
>>> +                      inside)
>>> +                    "\n")))
>>>        (result
>>>         (org-babel-R-evaluate
>>>          session full-body result-type result-params
>>> -- 
>>> 1.9.1

-- 
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:      rai...@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to