[ESS] Debugging in R

Kasper Daniel Hansen kaha at biostat.ku.dk
Sat Jun 25 01:29:11 CEST 2005


On Fri, 24 Jun 2005, Ross Boylan wrote:

> On Fri, 2005-06-24 at 21:41 +0200, Kasper Daniel Hansen wrote:
> ...
> > 
> > I think that what Martin observed is that some ESS functionality hangs. 
> > Eg. ESS has tab completion for the help function, and that does not work 
> > in a recover session. But I think that what you are describing is 
> > something different - that everything hangs? 
> Correct.
> > So let me clarify: when I do 
> > options(error = recover) it works exactly as under the console - but I 
> > might have problems with some extended ESS functionality.
> > 
> > Your message seems to indicate that it worked recently. I am using 
> > Emacs 22.0.50.1 under Mac Os Tiger with ESS 52.8 (the newest).
> > 
> > I am not sure I can help further - I am quite mystified if using 
> > options(error = recover) crashes the Emacs session...
> > 
> I've narrowed the problem down.  I did
> foo <- function() stop("")
> options(error=recover)
> foo()
> 
> under ESS and everything worked fine.  However, when I put the call
> foo() in a file and did C-c C-l, everything hung.  It is not using any
> CPU.
> 
> So I guess the standard input is redirected to the file, and gets stuck.
> Is there a way around that?

Ahh you. Well in that case I get exactly the same results like you - I 
guess the interactivity screws up (which is kind of natural). You 
shoudl be able to regain control of Emacs by using C-g, but that will not 
give you the results you want. You can get what you want by doing
  source("test.R")
instead of C-c C-l. What I sually do is having the script open in a 
separate buffer and then use 
  C-c C-n to step through it a line at a time
  C-c C-f to evaulate a function
and
  C-c C-b to dump the whole buffer.

In the last case it will hang at the error like it does with C-c C-l but 
by pressing C-g I can regain control and when I switch to the *R* buffer I 
see the recoveer prompt waiting for me.

I guess I am simply using another type of workflow, I never use C-c C-l 
(but now someone will tell me it is the best thing since sliced bread :)

Kasper




More information about the ESS-help mailing list