emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <Rainer@krugs.de>
To: Charles Berry <ccberry@ucsd.edu>
Cc: emacs-orgmode@gnu.org
Subject: 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/)]
Date: Wed, 17 Sep 2014 09:20:14 +0200	[thread overview]
Message-ID: <m2ha06n26p.fsf@krugs.de> (raw)
In-Reply-To: <loom.20140917T052011-462@post.gmane.org> (Charles Berry's message of "Wed, 17 Sep 2014 03:25:57 +0000 (UTC)")

[-- 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 --]

  reply	other threads:[~2014-09-17  7:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ha06n26p.fsf@krugs.de \
    --to=rainer@krugs.de \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).