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, On this old subject, I too finally confirm the pushed patch addresses the issue - and - thanks. -Original Message- From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers@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
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 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
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
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 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. From b91526d932728749609b27809eecb588c04e1a1e Mon Sep 17 00:00:00 2001 From: Aaron Ecay aarone...@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 Thanks, -- Aaron Ecay
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/)]
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
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/)]
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
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/)]
On Oct 7, 2014 3:41 PM, Henrik Singmann henrik.singm...@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
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/)]
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
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/)]
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
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/)]
Aaron Ecay aarone...@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: Raineratkrugsdotde PGP: 0x0F52F982 pgpA9l5zEFamR.pgp Description: PGP signature
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/)]
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
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, 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@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers@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 rai...@krugs.de writes: Using it, error is gone. Rainer Charles Berry ccbe...@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 ccbe...@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: Raineratkrugsdotde PGP: 0x0F52F982
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 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
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/)]
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
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/)]
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
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/)]
Charles Berry ccbe...@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 ccbe...@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: Raineratkrugsdotde PGP: 0x0F52F982 pgpnuTGfJgstT.pgp Description: PGP signature
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 rai...@krugs.de writes: Using it, error is gone. Rainer Charles Berry ccbe...@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 ccbe...@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: Raineratkrugsdotde PGP: 0x0F52F982 pgp_LdElBmteT.pgp Description: PGP signature
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@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers@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 rai...@krugs.de writes: Using it, error is gone. Rainer Charles Berry ccbe...@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 ccbe...@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: Raineratkrugsdotde PGP: 0x0F52F982
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 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
[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/)]
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 ccbe...@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)