all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 @ /usr/local/share/emacs/site-lisp/org/)]
@ 2014-09-15 20:16 Ed Kademan
  2014-09-16 13:03 ` Rainer M Krug
  0 siblings, 1 reply; 23+ messages in thread
From: Ed Kademan @ 2014-09-15 20:16 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2826 bytes --]

I can't evaluate R code blocks in org files. For example the file with
contents:

--8<---------------cut here---------------start------------->8---
#+property: header-args:R :session R-foo

#+BEGIN_SRC R
  print(pi)
#+END_SRC
--8<---------------cut here---------------end--------------->8---

spawns an R session that reports:

--8<---------------cut here---------------start------------->8---
  Error: could not find function ".ess.eval"
--8<---------------cut here---------------end--------------->8---

and does not give me a result.
I am running ess-version: 14.09 and am invoking emacs as follows:

--8<---------------cut here---------------start------------->8---
#!/bin/sh

o=/usr/local/share/emacs/site-lisp/org
emacs -Q --eval="(progn
                  (add-to-list 'load-path \"$o\")
                  (require 'org)
                  (org-babel-do-load-languages
                   'org-babel-load-languages
                   '((R . t)))
                  (package-initialize)
                  (setq ess-ask-for-ess-directory 'nil
                        ess-directory \"~/R/\"))"
--8<---------------cut here---------------end--------------->8---

EdK

Emacs  : GNU Emacs 24.4.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.23)
 of 2014-08-23 on dl
Package: Org-mode version 8.3beta (release_8.3beta-362-ga92789 @ /usr/local/share/emacs/site-lisp/org/)

current state:
==============
(setq
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
			  org-babel-execute-safely-maybe)
 org-tab-first-hook '(org-hide-block-toggle-maybe
		      org-babel-hide-result-toggle-maybe
		      org-babel-header-arg-expand)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
		  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
		  org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-speed-command-hook '(org-speed-command-default-hook
			  org-babel-speed-command-hook)
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-show-block-all
		    append local]
		   5]
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook
		    org-babel-show-result-all append local]
		   5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
		     org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-load-languages '((R . t))
 org-confirm-shell-link-function 'yes-or-no-p
 )

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 @ /usr/local/share/emacs/site-lisp/org/)]
  2014-09-15 20:16 Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 @ /usr/local/share/emacs/site-lisp/org/)] Ed Kademan
@ 2014-09-16 13:03 ` Rainer M Krug
  2014-09-16 20:17   ` Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)] Charles Berry
  0 siblings, 1 reply; 23+ messages in thread
From: Rainer M Krug @ 2014-09-16 13:03 UTC (permalink / raw)
  To: Ed Kademan; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3184 bytes --]

Thanks - you came before me. I get the same error but managed to work around.

This is likely caused by the upgrade of ess, as I realized it after
upgrading to ess 14.09.

You can work around by 
1) evaluating the R code which gives the error message
2) quitting the R session
3) re-starting the R session manually in the same window (where the old
R session was)

I also send this to the ess mailing list.

Cheers,

Rainer


Ed Kademan <ed@kademan.org> writes:

> I can't evaluate R code blocks in org files. For example the file with
> contents:
>
> #+property: header-args:R :session R-foo
>
> #+BEGIN_SRC R
>   print(pi)
> #+END_SRC
>
> spawns an R session that reports:
>
>   Error: could not find function ".ess.eval"
>
> and does not give me a result.
> I am running ess-version: 14.09 and am invoking emacs as follows:
>
> #!/bin/sh
>
> o=/usr/local/share/emacs/site-lisp/org
> emacs -Q --eval="(progn
>                   (add-to-list 'load-path \"$o\")
>                   (require 'org)
>                   (org-babel-do-load-languages
>                    'org-babel-load-languages
>                    '((R . t)))
>                   (package-initialize)
>                   (setq ess-ask-for-ess-directory 'nil
>                         ess-directory \"~/R/\"))"
>
> EdK
>
> Emacs  : GNU Emacs 24.4.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.23)
>  of 2014-08-23 on dl
> Package: Org-mode version 8.3beta (release_8.3beta-362-ga92789 @ /usr/local/share/emacs/site-lisp/org/)
>
> current state:
> ==============
> (setq
>  org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
> 			  org-babel-execute-safely-maybe)
>  org-tab-first-hook '(org-hide-block-toggle-maybe
> 		      org-babel-hide-result-toggle-maybe
> 		      org-babel-header-arg-expand)
>  org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
> 		  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
> 		  org-optimize-window-after-visibility-change)
>  org-agenda-before-write-hook '(org-agenda-add-entry-text)
>  org-speed-command-hook '(org-speed-command-default-hook
> 			  org-babel-speed-command-hook)
>  org-babel-pre-tangle-hook '(save-buffer)
>  org-occur-hook '(org-first-headline-recenter)
>  org-metaup-hook '(org-babel-load-in-session-maybe)
>  org-confirm-elisp-link-function 'yes-or-no-p
>  org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
>  org-mode-hook '(#[nil "\300\301\302\303\304$\207"
> 		   [org-add-hook change-major-mode-hook org-show-block-all
> 		    append local]
> 		   5]
> 		 #[nil "\300\301\302\303\304$\207"
> 		   [org-add-hook change-major-mode-hook
> 		    org-babel-show-result-all append local]
> 		   5]
> 		 org-babel-result-hide-spec org-babel-hide-all-hashes)
>  org-metadown-hook '(org-babel-pop-to-session-maybe)
>  org-src-mode-hook '(org-src-babel-configure-edit-buffer
> 		     org-src-mode-configure-edit-buffer)
>  org-after-todo-state-change-hook '(org-clock-out-if-current)
>  org-babel-load-languages '((R . t))
>  org-confirm-shell-link-function 'yes-or-no-p
>  )

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at>  /usr/local/share/emacs/site-lisp/org/)]
  2014-09-16 13:03 ` Rainer M Krug
@ 2014-09-16 20:17   ` Charles Berry
  2014-09-17  3:25     ` [PATCH] WAS " Charles Berry
  0 siblings, 1 reply; 23+ messages in thread
From: Charles Berry @ 2014-09-16 20:17 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer <at> krugs.de> writes:

> 
> Thanks - you came before me. I get the same error but managed to work 
> around.
> 
> This is likely caused by the upgrade of ess, 

Likely.

But it may not be an ESS problem per se. 

M-x R starts a process that runs asynchronously. In interactive use there 
is no issue (barring something in .First() that slows the startup for
a very long time).

But, ...

If the  (rename-buffer ...) in org-babel-R-initiate-session
runs before all the setup that ESS performs in the process buffer is 
complete, chaos can result.

Not sure what the best way is to fix this.

A simple hack to temporarily solve the OP's problem is to force a pause 
before (rename-buffer ...) with (sleep-for 0.1) or something.

HTH,

Chuck

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH] WAS Re:  Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at>  /usr/local/share/emacs/site-lisp/org/)]
  2014-09-16 20:17   ` Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)] Charles Berry
@ 2014-09-17  3:25     ` Charles Berry
  2014-09-17  7:20       ` Rainer M Krug
  2014-09-18  1:17       ` Aaron Ecay
  0 siblings, 2 replies; 23+ messages in thread
From: Charles Berry @ 2014-09-17  3:25 UTC (permalink / raw)
  To: emacs-orgmode

Charles Berry <ccberry <at> ucsd.edu> writes:

> 
> Rainer M Krug <Rainer <at> krugs.de> writes:
> 
> > 
> > Thanks - you came before me. I get the same error but managed to work 
> > around.
> > 
> > This is likely caused by the upgrade of ess, 
> 
> Likely.
> 
> But it may not be an ESS problem per se. 
> 
> M-x R starts a process that runs asynchronously. In interactive use there 
> is no issue (barring something in .First() that slows the startup for
> a very long time).
> 
> But, ...
> 
> If the  (rename-buffer ...) in org-babel-R-initiate-session
> runs before all the setup that ESS performs in the process buffer is 
> complete, chaos can result.
> 
> Not sure what the best way is to fix this.
>

OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.

Chuck
==

From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
From: chasberry <ccberry@ucsd.edu>
Date: Tue, 16 Sep 2014 19:57:59 -0700
Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
 session startup

* lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
finished before `rename-buffer' is run.

TINYCHANGE
---
 lisp/ob-R.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index 41b943c..7575acf 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -35,6 +35,8 @@
 (declare-function inferior-ess-send-input "ext:ess-inf" ())
 (declare-function ess-make-buffer-current "ext:ess-inf" ())
 (declare-function ess-eval-buffer "ext:ess-inf" (vis))
+(declare-function ess-wait-for-process "ext:ess-inf" 
+		  (&optional proc sec-prompt wait force-redisplay))
 (declare-function org-number-sequence "org-compat" (from &optional to inc))
 (declare-function org-remove-if-not "org" (predicate seq))
 (declare-function org-every "org" (pred seq))
@@ -262,6 +264,7 @@ This function is called by `org-babel-execute-src-block'."
 	    ;; Session buffer exists, but with dead process
 	    (set-buffer session))
 	  (require 'ess) (R)
+	  (ess-wait-for-process)
 	  (rename-buffer
 	   (if (bufferp session)
 	       (buffer-name session)
-- 
1.8.5.2 (Apple Git-48)

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-17  3:25     ` [PATCH] WAS " Charles Berry
@ 2014-09-17  7:20       ` Rainer M Krug
  2014-09-17  7:26         ` Rainer M Krug
  2014-09-18  1:17       ` Aaron Ecay
  1 sibling, 1 reply; 23+ messages in thread
From: Rainer M Krug @ 2014-09-17  7:20 UTC (permalink / raw)
  To: Charles Berry; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2504 bytes --]

Charles Berry <ccberry@ucsd.edu> writes:

> Charles Berry <ccberry <at> ucsd.edu> writes:
>
>> 
>> Rainer M Krug <Rainer <at> krugs.de> writes:
>> 
>> > 
>> > Thanks - you came before me. I get the same error but managed to work 
>> > around.
>> > 
>> > This is likely caused by the upgrade of ess, 
>> 
>> Likely.
>> 
>> But it may not be an ESS problem per se. 
>> 
>> M-x R starts a process that runs asynchronously. In interactive use there 
>> is no issue (barring something in .First() that slows the startup for
>> a very long time).
>> 
>> But, ...
>> 
>> If the  (rename-buffer ...) in org-babel-R-initiate-session
>> runs before all the setup that ESS performs in the process buffer is 
>> complete, chaos can result.
>> 
>> Not sure what the best way is to fix this.
>>
>
> OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.

Thanks.

Haven't tried it yet, but I can't imagine any downside of this
patch. Could this be committed?

Rainer

>
> Chuck
> ==
>
> From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
> From: chasberry <ccberry@ucsd.edu>
> Date: Tue, 16 Sep 2014 19:57:59 -0700
> Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
>  session startup
>
> * lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
> finished before `rename-buffer' is run.
>
> TINYCHANGE
> ---
>  lisp/ob-R.el | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lisp/ob-R.el b/lisp/ob-R.el
> index 41b943c..7575acf 100644
> --- a/lisp/ob-R.el
> +++ b/lisp/ob-R.el
> @@ -35,6 +35,8 @@
>  (declare-function inferior-ess-send-input "ext:ess-inf" ())
>  (declare-function ess-make-buffer-current "ext:ess-inf" ())
>  (declare-function ess-eval-buffer "ext:ess-inf" (vis))
> +(declare-function ess-wait-for-process "ext:ess-inf" 
> +		  (&optional proc sec-prompt wait force-redisplay))
>  (declare-function org-number-sequence "org-compat" (from &optional to inc))
>  (declare-function org-remove-if-not "org" (predicate seq))
>  (declare-function org-every "org" (pred seq))
> @@ -262,6 +264,7 @@ This function is called by `org-babel-execute-src-block'."
>  	    ;; Session buffer exists, but with dead process
>  	    (set-buffer session))
>  	  (require 'ess) (R)
> +	  (ess-wait-for-process)
>  	  (rename-buffer
>  	   (if (bufferp session)
>  	       (buffer-name session)

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-17  7:20       ` Rainer M Krug
@ 2014-09-17  7:26         ` Rainer M Krug
  2014-09-17 23:14           ` Cook, Malcolm
       [not found]           ` <D4772401B9D976478C0895769BE3E7920F1ED33C@MBSRV02.sgc.loc>
  0 siblings, 2 replies; 23+ messages in thread
From: Rainer M Krug @ 2014-09-17  7:26 UTC (permalink / raw)
  To: Charles Berry; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2668 bytes --]

Rainer M Krug <Rainer@krugs.de> writes:

Using it, error is gone.

Rainer

> Charles Berry <ccberry@ucsd.edu> writes:
>
>> Charles Berry <ccberry <at> ucsd.edu> writes:
>>
>>> 
>>> Rainer M Krug <Rainer <at> krugs.de> writes:
>>> 
>>> > 
>>> > Thanks - you came before me. I get the same error but managed to work 
>>> > around.
>>> > 
>>> > This is likely caused by the upgrade of ess, 
>>> 
>>> Likely.
>>> 
>>> But it may not be an ESS problem per se. 
>>> 
>>> M-x R starts a process that runs asynchronously. In interactive use there 
>>> is no issue (barring something in .First() that slows the startup for
>>> a very long time).
>>> 
>>> But, ...
>>> 
>>> If the  (rename-buffer ...) in org-babel-R-initiate-session
>>> runs before all the setup that ESS performs in the process buffer is 
>>> complete, chaos can result.
>>> 
>>> Not sure what the best way is to fix this.
>>>
>>
>> OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.
>
> Thanks.
>
> Haven't tried it yet, but I can't imagine any downside of this
> patch. Could this be committed?
>
> Rainer
>
>>
>> Chuck
>> ==
>>
>> From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
>> From: chasberry <ccberry@ucsd.edu>
>> Date: Tue, 16 Sep 2014 19:57:59 -0700
>> Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
>>  session startup
>>
>> * lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
>> finished before `rename-buffer' is run.
>>
>> TINYCHANGE
>> ---
>>  lisp/ob-R.el | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/lisp/ob-R.el b/lisp/ob-R.el
>> index 41b943c..7575acf 100644
>> --- a/lisp/ob-R.el
>> +++ b/lisp/ob-R.el
>> @@ -35,6 +35,8 @@
>>  (declare-function inferior-ess-send-input "ext:ess-inf" ())
>>  (declare-function ess-make-buffer-current "ext:ess-inf" ())
>>  (declare-function ess-eval-buffer "ext:ess-inf" (vis))
>> +(declare-function ess-wait-for-process "ext:ess-inf" 
>> +		  (&optional proc sec-prompt wait force-redisplay))
>>  (declare-function org-number-sequence "org-compat" (from &optional to inc))
>>  (declare-function org-remove-if-not "org" (predicate seq))
>>  (declare-function org-every "org" (pred seq))
>> @@ -262,6 +264,7 @@ This function is called by `org-babel-execute-src-block'."
>>  	    ;; Session buffer exists, but with dead process
>>  	    (set-buffer session))
>>  	  (require 'ess) (R)
>> +	  (ess-wait-for-process)
>>  	  (rename-buffer
>>  	   (if (bufferp session)
>>  	       (buffer-name session)

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-17  7:26         ` Rainer M Krug
@ 2014-09-17 23:14           ` Cook, Malcolm
       [not found]           ` <D4772401B9D976478C0895769BE3E7920F1ED33C@MBSRV02.sgc.loc>
  1 sibling, 0 replies; 23+ messages in thread
From: Cook, Malcolm @ 2014-09-17 23:14 UTC (permalink / raw)
  To: 'Rainer M Krug', 'Charles Berry'
  Cc: 'emacs-orgmode@gnu.org'

Hiya,

Likewise - same problem here is fixed with injection of patch.  

Thanks!

~ malcolm_cook


 >-----Original Message-----
 >From: emacs-orgmode-bounces+mec=stowers.org@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers.org@gnu.org] On
 >Behalf Of Rainer M Krug
 >Sent: Wednesday, September 17, 2014 2:26 AM
 >To: Charles Berry
 >Cc: emacs-orgmode@gnu.org
 >Subject: Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at>
 >/usr/local/share/emacs/site-lisp/org/)]
 >
 >Rainer M Krug <Rainer@krugs.de> writes:
 >
 >Using it, error is gone.
 >
 >Rainer
 >
 >> Charles Berry <ccberry@ucsd.edu> writes:
 >>
 >>> Charles Berry <ccberry <at> ucsd.edu> writes:
 >>>
 >>>>
 >>>> Rainer M Krug <Rainer <at> krugs.de> writes:
 >>>>
 >>>> >
 >>>> > Thanks - you came before me. I get the same error but managed to work
 >>>> > around.
 >>>> >
 >>>> > This is likely caused by the upgrade of ess,
 >>>>
 >>>> Likely.
 >>>>
 >>>> But it may not be an ESS problem per se.
 >>>>
 >>>> M-x R starts a process that runs asynchronously. In interactive use there
 >>>> is no issue (barring something in .First() that slows the startup for
 >>>> a very long time).
 >>>>
 >>>> But, ...
 >>>>
 >>>> If the  (rename-buffer ...) in org-babel-R-initiate-session
 >>>> runs before all the setup that ESS performs in the process buffer is
 >>>> complete, chaos can result.
 >>>>
 >>>> Not sure what the best way is to fix this.
 >>>>
 >>>
 >>> OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.
 >>
 >> Thanks.
 >>
 >> Haven't tried it yet, but I can't imagine any downside of this
 >> patch. Could this be committed?
 >>
 >> Rainer
 >>
 >>>
 >>> Chuck
 >>> ==
 >>>
 >>> From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
 >>> From: chasberry <ccberry@ucsd.edu>
 >>> Date: Tue, 16 Sep 2014 19:57:59 -0700
 >>> Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
 >>>  session startup
 >>>
 >>> * lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
 >>> finished before `rename-buffer' is run.
 >>>
 >>> TINYCHANGE
 >>> ---
 >>>  lisp/ob-R.el | 3 +++
 >>>  1 file changed, 3 insertions(+)
 >>>
 >>> diff --git a/lisp/ob-R.el b/lisp/ob-R.el
 >>> index 41b943c..7575acf 100644
 >>> --- a/lisp/ob-R.el
 >>> +++ b/lisp/ob-R.el
 >>> @@ -35,6 +35,8 @@
 >>>  (declare-function inferior-ess-send-input "ext:ess-inf" ())
 >>>  (declare-function ess-make-buffer-current "ext:ess-inf" ())
 >>>  (declare-function ess-eval-buffer "ext:ess-inf" (vis))
 >>> +(declare-function ess-wait-for-process "ext:ess-inf"
 >>> +		  (&optional proc sec-prompt wait force-redisplay))
 >>>  (declare-function org-number-sequence "org-compat" (from &optional to inc))
 >>>  (declare-function org-remove-if-not "org" (predicate seq))
 >>>  (declare-function org-every "org" (pred seq))
 >>> @@ -262,6 +264,7 @@ This function is called by `org-babel-execute-src-block'."
 >>>  	    ;; Session buffer exists, but with dead process
 >>>  	    (set-buffer session))
 >>>  	  (require 'ess) (R)
 >>> +	  (ess-wait-for-process)
 >>>  	  (rename-buffer
 >>>  	   (if (bufferp session)
 >>>  	       (buffer-name session)
 >
 >--
 >Rainer M. Krug
 >email: Rainer<at>krugs<dot>de
 >PGP: 0x0F52F982

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-17  3:25     ` [PATCH] WAS " Charles Berry
  2014-09-17  7:20       ` Rainer M Krug
@ 2014-09-18  1:17       ` Aaron Ecay
  2014-09-18 15:17         ` Charles C. Berry
  1 sibling, 1 reply; 23+ messages in thread
From: Aaron Ecay @ 2014-09-18  1:17 UTC (permalink / raw)
  To: Charles Berry, emacs-orgmode

Hi all,

I have pushed the patch to the master branch, thanks to Chuck and to
Rainer and Malcom for testing it.

Chuck, it looks like you have already provided another “preliminary
patch” for org back in 2012 (commit 578a7f5a).  If it’s possible for
you, it might be good to do the copyright assignment described at
<http://orgmode.org/worg/org-contribute.html#sec-2> before you run
out of lifetime eligibility for TINYCHANGEs (which is ultimately
controlled by the emacs core developers and/or FSF’s lawyers, but
it’s widely taken to be 15 lines or fewer).

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-18  1:17       ` Aaron Ecay
@ 2014-09-18 15:17         ` Charles C. Berry
  0 siblings, 0 replies; 23+ messages in thread
From: Charles C. Berry @ 2014-09-18 15:17 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

[-- Attachment #1: Type: TEXT/PLAIN, Size: 667 bytes --]

On Wed, 17 Sep 2014, Aaron Ecay wrote:

> Hi all,
>
> I have pushed the patch to the master branch, thanks to Chuck and to
> Rainer and Malcom for testing it.
>
> Chuck, it looks like you have already provided another “preliminary
> patch” for org back in 2012 (commit 578a7f5a).  If it’s possible for
> you, it might be good to do the copyright assignment described at
> <http://orgmode.org/worg/org-contribute.html#sec-2> before you run
> out of lifetime eligibility for TINYCHANGEs (which is ultimately
> controlled by the emacs core developers and/or FSF’s lawyers, but
> it’s widely taken to be 15 lines or fewer).
>

OK. I just sent my form in.

Chuck

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
       [not found]           ` <D4772401B9D976478C0895769BE3E7920F1ED33C@MBSRV02.sgc.loc>
@ 2014-09-18 21:13             ` Cook, Malcolm
  2014-09-18 21:27               ` Aaron Ecay
  2014-09-18 22:34               ` Charles C. Berry
  0 siblings, 2 replies; 23+ messages in thread
From: Cook, Malcolm @ 2014-09-18 21:13 UTC (permalink / raw)
  To: 'Rainer M Krug', 'Charles Berry'
  Cc: 'emacs-orgmode@gnu.org'

Hi,

Hmm, I spoke too soon.... the problem is only partially fixed by this patch...

Trying to work with in org-mode with R code blocks attached to persistent sessions (i.e. adding ':session myRsession' to the code block header ) makes things start to break again, at least in my hands.

I'm going to wait till things settle down before trying to upgrade ESS again.

Thanks for the patch anyway.

Cheers,

Malcolm

 >-----Original Message-----
 >From: Cook, Malcolm
 >Sent: Wednesday, September 17, 2014 6:14 PM
 >To: 'Rainer M Krug'; 'Charles Berry'
 >Cc: 'emacs-orgmode@gnu.org'
 >Subject: RE: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at>
 >/usr/local/share/emacs/site-lisp/org/)]
 >
 >Hiya,
 >
 >Likewise - same problem here is fixed with injection of patch.
 >
 >Thanks!
 >
 >~ malcolm_cook
 >
 >
 > >-----Original Message-----
 > >From: emacs-orgmode-bounces+mec=stowers.org@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers.org@gnu.org] On
 > >Behalf Of Rainer M Krug
 > >Sent: Wednesday, September 17, 2014 2:26 AM
 > >To: Charles Berry
 > >Cc: emacs-orgmode@gnu.org
 > >Subject: Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at>
 > >/usr/local/share/emacs/site-lisp/org/)]
 > >
 > >Rainer M Krug <Rainer@krugs.de> writes:
 > >
 > >Using it, error is gone.
 > >
 > >Rainer
 > >
 > >> Charles Berry <ccberry@ucsd.edu> writes:
 > >>
 > >>> Charles Berry <ccberry <at> ucsd.edu> writes:
 > >>>
 > >>>>
 > >>>> Rainer M Krug <Rainer <at> krugs.de> writes:
 > >>>>
 > >>>> >
 > >>>> > Thanks - you came before me. I get the same error but managed to work
 > >>>> > around.
 > >>>> >
 > >>>> > This is likely caused by the upgrade of ess,
 > >>>>
 > >>>> Likely.
 > >>>>
 > >>>> But it may not be an ESS problem per se.
 > >>>>
 > >>>> M-x R starts a process that runs asynchronously. In interactive use there
 > >>>> is no issue (barring something in .First() that slows the startup for
 > >>>> a very long time).
 > >>>>
 > >>>> But, ...
 > >>>>
 > >>>> If the  (rename-buffer ...) in org-babel-R-initiate-session
 > >>>> runs before all the setup that ESS performs in the process buffer is
 > >>>> complete, chaos can result.
 > >>>>
 > >>>> Not sure what the best way is to fix this.
 > >>>>
 > >>>
 > >>> OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.
 > >>
 > >> Thanks.
 > >>
 > >> Haven't tried it yet, but I can't imagine any downside of this
 > >> patch. Could this be committed?
 > >>
 > >> Rainer
 > >>
 > >>>
 > >>> Chuck
 > >>> ==
 > >>>
 > >>> From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
 > >>> From: chasberry <ccberry@ucsd.edu>
 > >>> Date: Tue, 16 Sep 2014 19:57:59 -0700
 > >>> Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
 > >>>  session startup
 > >>>
 > >>> * lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
 > >>> finished before `rename-buffer' is run.
 > >>>
 > >>> TINYCHANGE
 > >>> ---
 > >>>  lisp/ob-R.el | 3 +++
 > >>>  1 file changed, 3 insertions(+)
 > >>>
 > >>> diff --git a/lisp/ob-R.el b/lisp/ob-R.el
 > >>> index 41b943c..7575acf 100644
 > >>> --- a/lisp/ob-R.el
 > >>> +++ b/lisp/ob-R.el
 > >>> @@ -35,6 +35,8 @@
 > >>>  (declare-function inferior-ess-send-input "ext:ess-inf" ())
 > >>>  (declare-function ess-make-buffer-current "ext:ess-inf" ())
 > >>>  (declare-function ess-eval-buffer "ext:ess-inf" (vis))
 > >>> +(declare-function ess-wait-for-process "ext:ess-inf"
 > >>> +		  (&optional proc sec-prompt wait force-redisplay))
 > >>>  (declare-function org-number-sequence "org-compat" (from &optional to inc))
 > >>>  (declare-function org-remove-if-not "org" (predicate seq))
 > >>>  (declare-function org-every "org" (pred seq))
 > >>> @@ -262,6 +264,7 @@ This function is called by `org-babel-execute-src-block'."
 > >>>  	    ;; Session buffer exists, but with dead process
 > >>>  	    (set-buffer session))
 > >>>  	  (require 'ess) (R)
 > >>> +	  (ess-wait-for-process)
 > >>>  	  (rename-buffer
 > >>>  	   (if (bufferp session)
 > >>>  	       (buffer-name session)
 > >
 > >--
 > >Rainer M. Krug
 > >email: Rainer<at>krugs<dot>de
 > >PGP: 0x0F52F982

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-18 21:13             ` Cook, Malcolm
@ 2014-09-18 21:27               ` Aaron Ecay
  2014-09-19  7:50                 ` Rainer M Krug
  2014-09-18 22:34               ` Charles C. Berry
  1 sibling, 1 reply; 23+ messages in thread
From: Aaron Ecay @ 2014-09-18 21:27 UTC (permalink / raw)
  To: Cook, Malcolm; +Cc: 'emacs-orgmode@gnu.org'

Hi Malcom,

2014ko irailak 18an, "Cook, Malcolm"-ek idatzi zuen:
> 
> Hi,
> 
> Hmm, I spoke too soon.... the problem is only partially fixed by this
> patch...
> 
> Trying to work with in org-mode with R code blocks attached to
> persistent sessions (i.e. adding ':session myRsession' to the code
> block header ) makes things start to break again, at least in my
> hands.
> 
> I'm going to wait till things settle down before trying to upgrade ESS
> again.
> 
> Thanks for the patch anyway.

Can you give an ECM <http://orgmode.org/worg/org-faq.html#ecm>?  I tried
to reconstruct what you are saying, but the patch seems to work as
expected for me.

(At the risk of being redundant, did you make sure that you are running
the most recent code including the patch?  The most foolproof way is to
navidate to the definition of ‘org-babel-R-initiate-session’ in ob-R.el,
verify that the call to ‘ess-wait-for-process’ is present, and use C-M-x
to reevaluate the defun.)

Thanks,

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-18 21:13             ` Cook, Malcolm
  2014-09-18 21:27               ` Aaron Ecay
@ 2014-09-18 22:34               ` Charles C. Berry
  2014-09-18 22:45                 ` Charles C. Berry
  1 sibling, 1 reply; 23+ messages in thread
From: Charles C. Berry @ 2014-09-18 22:34 UTC (permalink / raw)
  To: Cook, Malcolm; +Cc: 'emacs-orgmode@gnu.org'

On Thu, 18 Sep 2014, Cook, Malcolm wrote:

> Hi,
>
> Hmm, I spoke too soon.... the problem is only partially fixed by this patch...
>

> Trying to work with in org-mode with R code blocks attached to 
> persistent sessions (i.e. adding ':session myRsession' to the code block 
> header ) makes things start to break again, at least in my hands.

Really? I have been working for hours using the :session header with no 
problems.

What exactly breaks? Do you have an example?

FWIW, this works when I move my cursor into the source block and C-c C-c.

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC R :session myRsession
abc <- 1
abc+1
#+END_SRC
--8<---------------cut here---------------end--------------->8---

Producing

--8<---------------cut here---------------start------------->8---
#+RESULTS:
: 2
--8<---------------cut here---------------end--------------->8---

which is what I expect.

I use Org-mode version 8.3beta (release_8.3beta-366-gb2fca7.

(updated a few hours back)

>
> I'm going to wait till things settle down before trying to upgrade ESS again.

It would really help to be sure that this is not a problem with your 
setup. And if you can give a simple example that shows the problem, I'd 
appreciate it.

BTW, how does a 'persistent' session differ from all those other sessions?

Chuck

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-18 22:34               ` Charles C. Berry
@ 2014-09-18 22:45                 ` Charles C. Berry
  2014-10-07 19:34                   ` Henrik Singmann
  0 siblings, 1 reply; 23+ messages in thread
From: Charles C. Berry @ 2014-09-18 22:45 UTC (permalink / raw)
  To: Cook, Malcolm; +Cc: 'emacs-orgmode@gnu.org'

On Thu, 18 Sep 2014, Charles C. Berry wrote:

> On Thu, 18 Sep 2014, Cook, Malcolm wrote:
>
>> Hi,
>> 
>> Hmm, I spoke too soon.... the problem is only partially fixed by this 
>> patch...
>> 
>
>> Trying to work with in org-mode with R code blocks attached to persistent 
>> sessions (i.e. adding ':session myRsession' to the code block header ) 
>> makes things start to break again, at least in my hands.
>
> Really? I have been working for hours using the :session header with no 
> problems.
>
> What exactly breaks? Do you have an example?
>
> FWIW, this works when I move my cursor into the source block and C-c C-c.
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_SRC R :session myRsession
> abc <- 1
> abc+1
> #+END_SRC
> --8<---------------cut here---------------end--------------->8---
>
> Producing
>
> --8<---------------cut here---------------start------------->8---
> #+RESULTS:
> : 2
> --8<---------------cut here---------------end--------------->8---
>
> which is what I expect.
>
> I use Org-mode version 8.3beta (release_8.3beta-366-gb2fca7.
>
> (updated a few hours back)


Forget to mention:

ess-version: 14.09 [git: 9c248f1a026b6990d0cd0cd326d82854d5cafb26]


Chuck

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-18 21:27               ` Aaron Ecay
@ 2014-09-19  7:50                 ` Rainer M Krug
  0 siblings, 0 replies; 23+ messages in thread
From: Rainer M Krug @ 2014-09-19  7:50 UTC (permalink / raw)
  To: Cook, Malcolm; +Cc: 'emacs-orgmode@gnu.org'

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

Aaron Ecay <aaronecay@gmail.com> writes:

> Hi Malcom,
>
> 2014ko irailak 18an, "Cook, Malcolm"-ek idatzi zuen:
>> 
>> Hi,
>> 
>> Hmm, I spoke too soon.... the problem is only partially fixed by this
>> patch...
>> 
>> Trying to work with in org-mode with R code blocks attached to
>> persistent sessions (i.e. adding ':session myRsession' to the code
>> block header ) makes things start to break again, at least in my
>> hands.
>> 
>> I'm going to wait till things settle down before trying to upgrade ESS
>> again.
>> 
>> Thanks for the patch anyway.
>
> Can you give an ECM <http://orgmode.org/worg/org-faq.html#ecm>?  I tried
> to reconstruct what you are saying, but the patch seems to work as
> expected for me.

Haven't had a problem since I used the patch.

>
> (At the risk of being redundant, did you make sure that you are running
> the most recent code including the patch?  The most foolproof way is to
> navidate to the definition of ‘org-babel-R-initiate-session’ in ob-R.el,
> verify that the call to ‘ess-wait-for-process’ is present, and use C-M-x
> to reevaluate the defun.)

Also: if you are compile, did you compile after applying the patch? I
was looking once for an error for quite some time until I figured out
that I still had some old compiled files lurking around...

Rainer

>
> Thanks,

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-09-18 22:45                 ` Charles C. Berry
@ 2014-10-07 19:34                   ` Henrik Singmann
  2014-10-07 21:17                     ` Ista Zahn
  2014-10-08  1:21                     ` Charles Berry
  0 siblings, 2 replies; 23+ messages in thread
From: Henrik Singmann @ 2014-10-07 19:34 UTC (permalink / raw)
  To: emacs-orgmode

Dear all,

Sorry to resurrect this thread but I still have the issue discussed here. I get "Error: could not find function ".ess.eval"" when inside an R code block with :session *R* but not without :session *R*.

More specifically, in the following .org file the first code block works but not the second one:

--8<---------------cut here---------------start------------->8---
#+begin_src R
   date()
#+end_src

#+RESULTS:
: Tue Oct 07 19:31:21 2014

#+begin_src R :session *R*
   date()
#+end_src

#+RESULTS:

--8<---------------cut here---------------end--------------->8---

Note that I use the latest Emacs on Windows (24.3.1, i386-mingw-nt6.1.7601) with the latest Org-mode (version 8.3beta, release_8.3beta-427-g942eb6) and the current development version of ESS (the same happens for ESS 14.09). Interestingly and as reported, it does not happen when downgrading to ESS 13.09 (but as this was handled as an org-mode problem so far I decided to keep it on this list).

Furthermore, my .emacs file currently only consists of the following:

--8<---------------cut here---------------start------------->8---

(require 'org)
(require 'ess-site)

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
  '(inhibit-startup-screen t)
  )
  
  (custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
  )
  
  
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((emacs-lisp . nil)
	(R . t)))
	
(setq org-babel-R-command "C:/Progra~1/R/R-3.1.1/bin/x64/rterm.exe --slave --no-save")

--8<---------------cut here---------------end--------------->8---

The windows is Windows 7, 64 bit.

Can anybody reproduce or solve?

Henrik


Am 19.09.2014 um 00:45 schrieb Charles C. Berry:
> On Thu, 18 Sep 2014, Charles C. Berry wrote:
>
>> On Thu, 18 Sep 2014, Cook, Malcolm wrote:
>>
>>> Hi,
>>>
>>> Hmm, I spoke too soon.... the problem is only partially fixed by this patch...
>>>
>>
>>> Trying to work with in org-mode with R code blocks attached to persistent sessions (i.e. adding ':session myRsession' to the code block header ) makes things start to break again, at least in my hands.
>>
>> Really? I have been working for hours using the :session header with no problems.
>>
>> What exactly breaks? Do you have an example?
>>
>> FWIW, this works when I move my cursor into the source block and C-c C-c.
>>
>> --8<---------------cut here---------------start------------->8---
>> #+BEGIN_SRC R :session myRsession
>> abc <- 1
>> abc+1
>> #+END_SRC
>> --8<---------------cut here---------------end--------------->8---
>>
>> Producing
>>
>> --8<---------------cut here---------------start------------->8---
>> #+RESULTS:
>> : 2
>> --8<---------------cut here---------------end--------------->8---
>>
>> which is what I expect.
>>
>> I use Org-mode version 8.3beta (release_8.3beta-366-gb2fca7.
>>
>> (updated a few hours back)
>
>
> Forget to mention:
>
> ess-version: 14.09 [git: 9c248f1a026b6990d0cd0cd326d82854d5cafb26]
>
>
> Chuck
>
>

-- 
Dr. Henrik Singmann
Albert-Ludwigs-Universität Freiburg, Germany
http://www.psychologie.uni-freiburg.de/Members/singmann

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-07 19:34                   ` Henrik Singmann
@ 2014-10-07 21:17                     ` Ista Zahn
  2014-10-08  1:59                       ` Charles Berry
  2014-10-08  1:21                     ` Charles Berry
  1 sibling, 1 reply; 23+ messages in thread
From: Ista Zahn @ 2014-10-07 21:17 UTC (permalink / raw)
  To: Henrik Singmann; +Cc: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 4141 bytes --]

On Oct 7, 2014 3:41 PM, "Henrik Singmann" <
henrik.singmann@psychologie.uni-freiburg.de> wrote:
>
> Dear all,
>
> Sorry to resurrect this thread but I still have the issue discussed here.
I get "Error: could not find function ".ess.eval"" when inside an R code
block with :session *R* but not without :session *R*.
>
> More specifically, in the following .org file the first code block works
but not the second one:
>
> --8<---------------cut here---------------start------------->8---
> #+begin_src R
>   date()
> #+end_src
>
> #+RESULTS:
> : Tue Oct 07 19:31:21 2014
>
> #+begin_src R :session *R*
>   date()
> #+end_src
>
> #+RESULTS:
>
> --8<---------------cut here---------------end--------------->8---
>
> Note that I use the latest Emacs on Windows (24.3.1,
i386-mingw-nt6.1.7601) with the latest Org-mode (version 8.3beta,
release_8.3beta-427-g942eb6) and the current development version of ESS
(the same happens for ESS 14.09). Interestingly and as reported, it does
not happen when downgrading to ESS 13.09 (but as this was handled as an
org-mode problem so far I decided to keep it on this list).
>
> Furthermore, my .emacs file currently only consists of the following:
>
> --8<---------------cut here---------------start------------->8---
>
> (require 'org)
> (require 'ess-site)
>
> (custom-set-variables
>  ;; custom-set-variables was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  '(inhibit-startup-screen t)
>  )
>   (custom-set-faces
>  ;; custom-set-faces was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  )
>    (org-babel-do-load-languages
>   'org-babel-load-languages
>   '((emacs-lisp . nil)
>         (R . t)))
>
> (setq org-babel-R-command "C:/Progra~1/R/R-3.1.1/bin/x64/rterm.exe
--slave --no-save")
>
> --8<---------------cut here---------------end--------------->8---
>
> The windows is Windows 7, 64 bit.
>
> Can anybody reproduce or solve?

Yes, I can reproduce with emacs 24.3.1, org 8..2.3, and ess 14.09 on
Archlinux, but only if I don't start the R session first. If I do 'M-x
R' to manually start an R process it works fine, but if there is no R
process already running I get 'Error: could not find function
".ess.eval"'

Best,
Ista
>
> Henrik
>
>
> Am 19.09.2014 um 00:45 schrieb Charles C. Berry:
>
>> On Thu, 18 Sep 2014, Charles C. Berry wrote:
>>
>>> On Thu, 18 Sep 2014, Cook, Malcolm wrote:
>>>
>>>> Hi,
>>>>
>>>> Hmm, I spoke too soon.... the problem is only partially fixed by this
patch...
>>>>
>>>
>>>> Trying to work with in org-mode with R code blocks attached to
persistent sessions (i.e. adding ':session myRsession' to the code block
header ) makes things start to break again, at least in my hands.
>>>
>>>
>>> Really? I have been working for hours using the :session header with no
problems.
>>>
>>> What exactly breaks? Do you have an example?
>>>
>>> FWIW, this works when I move my cursor into the source block and C-c
C-c.
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+BEGIN_SRC R :session myRsession
>>> abc <- 1
>>> abc+1
>>> #+END_SRC
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> Producing
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+RESULTS:
>>> : 2
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> which is what I expect.
>>>
>>> I use Org-mode version 8.3beta (release_8.3beta-366-gb2fca7.
>>>
>>> (updated a few hours back)
>>
>>
>>
>> Forget to mention:
>>
>> ess-version: 14.09 [git: 9c248f1a026b6990d0cd0cd326d82854d5cafb26]
>>
>>
>> Chuck
>>
>>
>
> --
> Dr. Henrik Singmann
> Albert-Ludwigs-Universität Freiburg, Germany
> http://www.psychologie.uni-freiburg.de/Members/singmann
>
>

[-- Attachment #2: Type: text/html, Size: 5628 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-07 19:34                   ` Henrik Singmann
  2014-10-07 21:17                     ` Ista Zahn
@ 2014-10-08  1:21                     ` Charles Berry
  2014-10-08  9:57                       ` Henrik Singmann
  1 sibling, 1 reply; 23+ messages in thread
From: Charles Berry @ 2014-10-08  1:21 UTC (permalink / raw)
  To: emacs-orgmode

Henrik Singmann <henrik.singmann <at> psychologie.uni-freiburg.de> writes:

> 
> Dear all,
> 
> Sorry to resurrect this thread but I still have the issue discussed here.
I get "Error: could not find
> function ".ess.eval"" when inside an R code block with :session *R* but 
> not without :session *R*.
> 

Please confirm that when you do

 M-x find-function RET org-babel-R-initiate-session RET

and scroll down 15 lines:

 M-1 M-5 <down>

you see something like this:

          (ess-wait-for-process
           (get-process (or ess-local-process-name
                            ess-current-process-name)))


If not, there is something broken in your setup.

If you do see that code, please do

 C-x d <return>


and verify that ob-R.el is older than ob-R.elc. If it is not older delete
ob-R.elc and restart.

Let us know how it goes either way.
 
Chuck

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-07 21:17                     ` Ista Zahn
@ 2014-10-08  1:59                       ` Charles Berry
  0 siblings, 0 replies; 23+ messages in thread
From: Charles Berry @ 2014-10-08  1:59 UTC (permalink / raw)
  To: emacs-orgmode

Ista Zahn <istazahn <at> gmail.com> writes:

> 
> 
> 
> On Oct 7, 2014 3:41 PM, "Henrik Singmann" <henrik.singmann <at>
psychologie.uni-freiburg.de> wrote:
> >
> > Dear all,
> >
> > Sorry to resurrect this thread but I still have the issue discussed 
> > here. I get "Error: could not find function ".ess.eval"" when inside an 
> > R code block with :session *R* but not without :session *R*.
> >
[snip]
> >
> > Can anybody reproduce or solve?
> Yes, I can reproduce with emacs 24.3.1, org 8..2.3, and ess 14.09 on


org 8.2.3 ?? The last 8.2.3 release I see on git is 2013-11-15 05:58:32 
(GMT)

The ess 14 patch showed up on 2014-09-18 01:10:40 (GMT).


> Archlinux, but only if I don't start the R session first. If I do 'M-x
> R' to manually start an R process it works fine, but if there is no R
> process already running I get 'Error: could not find function
> ".ess.eval"'

Yes. (R) starts the session asynchronously, so in programmatic use
subsequent commands can jump the queue and confuse the process. 

This did not seem to matter before ess 14.

The 2014-09-18 01:10:40 (GMT) patch forces a wait for (R) to finish before
anymore commands are sent to the session.

So either update org-mode or downdate ess or replace
org-babel-R-initiate-session with the current version and recompile.

HTH,

Chuck

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-08  1:21                     ` Charles Berry
@ 2014-10-08  9:57                       ` Henrik Singmann
  2014-10-10  4:38                         ` Aaron Ecay
  0 siblings, 1 reply; 23+ messages in thread
From: Henrik Singmann @ 2014-10-08  9:57 UTC (permalink / raw)
  To: emacs-orgmode


I unfortunately can confirm that org-babel-R-initiate-session contains the lines you mentioned at exactly 15 lines down. Deleting ob-R.elc (which was of the same date as ob-R.el) didn't affect anything as did reloading org uncompiled (C-u C-c C-x !).

Henrik

Am 08.10.2014 um 03:21 schrieb Charles Berry:
> Henrik Singmann <henrik.singmann <at> psychologie.uni-freiburg.de> writes:
>
>>
>> Dear all,
>>
>> Sorry to resurrect this thread but I still have the issue discussed here.
> I get "Error: could not find
>> function ".ess.eval"" when inside an R code block with :session *R* but
>> not without :session *R*.
>>
>
> Please confirm that when you do
>
>   M-x find-function RET org-babel-R-initiate-session RET
>
> and scroll down 15 lines:
>
>   M-1 M-5 <down>
>
> you see something like this:
>
>            (ess-wait-for-process
>             (get-process (or ess-local-process-name
>                              ess-current-process-name)))
>
>
> If not, there is something broken in your setup.
>
> If you do see that code, please do
>
>   C-x d <return>
>
>
> and verify that ob-R.el is older than ob-R.elc. If it is not older delete
> ob-R.elc and restart.
>
> Let us know how it goes either way.
>
> Chuck
>
>
>
>

-- 
Dr. Henrik Singmann
Albert-Ludwigs-Universität Freiburg, Germany
http://www.psychologie.uni-freiburg.de/Members/singmann

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-08  9:57                       ` Henrik Singmann
@ 2014-10-10  4:38                         ` Aaron Ecay
  2014-10-10  9:18                           ` Henrik Singmann
  0 siblings, 1 reply; 23+ messages in thread
From: Aaron Ecay @ 2014-10-10  4:38 UTC (permalink / raw)
  To: Henrik Singmann, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

Hi Henrik,

2014ko urriak 8an, Henrik Singmann-ek idatzi zuen:
> 
> I unfortunately can confirm that org-babel-R-initiate-session contains
> the lines you mentioned at exactly 15 lines down. Deleting ob-R.elc
> (which was of the same date as ob-R.el) didn't affect anything as did
> reloading org uncompiled (C-u C-c C-x !).

I could reproduce this, also with recent git org and ESS.  It looks like
ESS is doing more complicated things, necessitating a more thorough
check that the session is in fact ready.

Can you test the attached patch?  It fixed the problem for me.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-R-fix-interaction-with-ESS-for-new-sessions.patch --]
[-- Type: text/x-diff, Size: 1045 bytes --]

From b91526d932728749609b27809eecb588c04e1a1e Mon Sep 17 00:00:00 2001
From: Aaron Ecay <aaronecay@gmail.com>
Date: Fri, 10 Oct 2014 00:35:41 -0400
Subject: [PATCH] ob-R: fix interaction with ESS for new sessions

* lisp/ob-R.el (org-babel-R-initiate-session): Properly wait on a new
ESS process.
---
 lisp/ob-R.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index ea33031..5d5006f 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -265,9 +265,10 @@ This function is called by `org-babel-execute-src-block'."
 	    ;; Session buffer exists, but with dead process
 	    (set-buffer session))
 	  (require 'ess) (R)
-	  (ess-wait-for-process
-	   (get-process (or ess-local-process-name
-			    ess-current-process-name)))
+	  (let ((R-proc (get-process (or ess-local-process-name
+					 ess-current-process-name))))
+	    (while (process-get R-proc 'callbacks)
+	      (ess-wait-for-process R-proc)))
 	  (rename-buffer
 	   (if (bufferp session)
 	       (buffer-name session)
-- 
2.1.2


[-- Attachment #3: Type: text/plain, Size: 24 bytes --]

Thanks,

-- 
Aaron Ecay

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-10  4:38                         ` Aaron Ecay
@ 2014-10-10  9:18                           ` Henrik Singmann
  2014-10-10 16:36                             ` Aaron Ecay
  0 siblings, 1 reply; 23+ messages in thread
From: Henrik Singmann @ 2014-10-10  9:18 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: aaronecay

Hi Aaron,

This patch also solves the problem for me. No more ".ess.eval" not found!

Thanks a lot,
Henrik


Am 10.10.2014 um 06:38 schrieb Aaron Ecay:
> Hi Henrik,
>
> 2014ko urriak 8an, Henrik Singmann-ek idatzi zuen:
>>
>> I unfortunately can confirm that org-babel-R-initiate-session contains
>> the lines you mentioned at exactly 15 lines down. Deleting ob-R.elc
>> (which was of the same date as ob-R.el) didn't affect anything as did
>> reloading org uncompiled (C-u C-c C-x !).
>
> I could reproduce this, also with recent git org and ESS.  It looks like
> ESS is doing more complicated things, necessitating a more thorough
> check that the session is in fact ready.
>
> Can you test the attached patch?  It fixed the problem for me.
>
>
>
> Thanks,
>

-- 
Dr. Henrik Singmann
Albert-Ludwigs-Universität Freiburg, Germany
http://www.psychologie.uni-freiburg.de/Members/singmann

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-10  9:18                           ` Henrik Singmann
@ 2014-10-10 16:36                             ` Aaron Ecay
  2014-12-09 21:07                               ` Cook, Malcolm
  0 siblings, 1 reply; 23+ messages in thread
From: Aaron Ecay @ 2014-10-10 16:36 UTC (permalink / raw)
  To: Henrik Singmann, emacs-orgmode

Hi Henrik,

2014ko urriak 10an, Henrik Singmann-ek idatzi zuen:
> 
> Hi Aaron,
> 
> This patch also solves the problem for me. No more ".ess.eval" not
> found!

Thanks for testing.  I’ve pushed the patch to the master branch.

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)]
  2014-10-10 16:36                             ` Aaron Ecay
@ 2014-12-09 21:07                               ` Cook, Malcolm
  0 siblings, 0 replies; 23+ messages in thread
From: Cook, Malcolm @ 2014-12-09 21:07 UTC (permalink / raw)
  To: Aaron Ecay, Henrik Singmann, emacs-orgmode@gnu.org

Hi, 

On this old subject, I too finally confirm the pushed patch addresses the issue - and - thanks.

 >-----Original Message-----
 >From: emacs-orgmode-bounces+mec=stowers.org@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers.org@gnu.org] On
 >Behalf Of Aaron Ecay
 >Sent: Friday, October 10, 2014 11:37 AM
 >To: Henrik Singmann; emacs-orgmode@gnu.org
 >Subject: Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at>
 >/usr/local/share/emacs/site-lisp/org/)]
 >
 >Hi Henrik,
 >
 >2014ko urriak 10an, Henrik Singmann-ek idatzi zuen:
 >>
 >> Hi Aaron,
 >>
 >> This patch also solves the problem for me. No more ".ess.eval" not
 >> found!
 >
 >Thanks for testing.  I’ve pushed the patch to the master branch.
 >
 >--
 >Aaron Ecay


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-12-09 21:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15 20:16 Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 @ /usr/local/share/emacs/site-lisp/org/)] Ed Kademan
2014-09-16 13:03 ` Rainer M Krug
2014-09-16 20:17   ` Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 <at> /usr/local/share/emacs/site-lisp/org/)] Charles Berry
2014-09-17  3:25     ` [PATCH] WAS " Charles Berry
2014-09-17  7:20       ` Rainer M Krug
2014-09-17  7:26         ` Rainer M Krug
2014-09-17 23:14           ` Cook, Malcolm
     [not found]           ` <D4772401B9D976478C0895769BE3E7920F1ED33C@MBSRV02.sgc.loc>
2014-09-18 21:13             ` Cook, Malcolm
2014-09-18 21:27               ` Aaron Ecay
2014-09-19  7:50                 ` Rainer M Krug
2014-09-18 22:34               ` Charles C. Berry
2014-09-18 22:45                 ` Charles C. Berry
2014-10-07 19:34                   ` Henrik Singmann
2014-10-07 21:17                     ` Ista Zahn
2014-10-08  1:59                       ` Charles Berry
2014-10-08  1:21                     ` Charles Berry
2014-10-08  9:57                       ` Henrik Singmann
2014-10-10  4:38                         ` Aaron Ecay
2014-10-10  9:18                           ` Henrik Singmann
2014-10-10 16:36                             ` Aaron Ecay
2014-12-09 21:07                               ` Cook, Malcolm
2014-09-18  1:17       ` Aaron Ecay
2014-09-18 15:17         ` Charles C. Berry

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.