[ESS] emacs hangs / freezes when R hangs

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Oct 5 15:52:00 CEST 2010


Hi Lars,

On Mon, Oct 4, 2010 at 7:52 PM, Lars Schmidt-Thieme
<schmidt-thieme at ismll.de> wrote:
> Dear ess maintainers,
>
> if you evaluate a line or region in R (ess-eval-line/region), in the current
> implementation emacs waits for R to complete. This means esp. that
> * you cannot continue to edit while R is computing something concurrently
>  and
> * if R hangs (e.g., in an infinite loop), emacs hangs / freezes and it is
>  difficult to interrupt R.

Thanks for offering a way to handle these issues, two things:

(1) It doesn't look like your attachments came through to the mailing
list -- perhaps they're not allowed? Maybe you can pry posting a gist?

http://gist.github.com/

(2) In certain situations, ctrl-g does the trick you're after. The one
case I find it doesn't work to my "satisfaction" is when I'm
evaluating a large region of code. In my experience with these cases,
if there is a long running function call, ctrl-g will in fact return
control to emacs, but it will also stop evaluation when the long
running function returns -- it won't continue to the next line.

Using ctrl-g when I C-c C-l (run an entire file) works just fine,
though. It also works fine when I just call a long running function by
itself ...

Just thought I'd bring that to your attention if you weren't aware of
it already, though I'm also curious to see what your solutions look
like.

Cheers,
-steve

>
> This behavior has been reported by several users in the past and can
> be easily reproduced by evaluating
>>  while (T) 1+1;
>
> Attached is a proposal how to change this behavior so that emacs is no
> longer waiting for R to complete, but sends the code to R (still line
> by line, so input and output still will be nicely aligned), and then
> lets the user continue to edit files.
> * ess-inf.el is taken from ess 5.7.1 release (as packaged for ubuntu)
>  and all places where I changed things have been marked.
> * linefeeder.el is a generic solution for sending input line-by-line to
>  comint processes.
> To test it: just replace ess-inf.el in ess 5.7.1 by the version attached
> and add linefeeder.el to the ess lisp directory, then run ess-eval-region
> in an R buffer. I tested it with Gnu Emacs 23.1.1, R 2.10.1 and ess 5.7.1
> on Linux.
>
> If you could give it a try and consider it for integration in an upcoming
> ess release, I would be very happy. Feel free to take the bits you
> think are useful.
>
> The idea is very simple: instead of chopping the code into lines
> and feeding it line-by-line in the main edit thread (ess-eval-linewise),
> one sends just a single line and ends activity in this thread,
> catching the next R prompt through a comint-output-filter-function
> and then sending the next line.
>
> Regards
>  Lars
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
>



-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the ESS-help mailing list