options(error=recover) produces ESS freeze

View: New views
7 Messages — Rating Filter:   Alert me  

options(error=recover) produces ESS freeze

by Peter Meilstrup :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I keep reproducing a very simple recipe for making ESS and the entire  
Emacs process freeze:

1. set options(error=recover)
2. Move to a buffer where there is a group of statements, one of which  
will produce an error. For example:

options(error=recover)
library(datasets)
avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),  
function(x)mean(x$breaks)))
#previous line generates error due to typo
print(avg)

3. use C-p or C-r etc. to evaluate the paragraph.
4. RESULT: emacs becomes completely unresponsive.

This makes ESS darn near unusable for me. This can't be normal, can it?

I'm using ESS 5.5 with R 2.10.0 on both emacs 22.1.1 (OS X built in)  
and Aquamacs (22.3.1).

Can anyone shed light?

Peter

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: options(error=recover) produces ESS freeze

by rsparapa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Peter Meilstrup wrote:

> I keep reproducing a very simple recipe for making ESS and the entire
> Emacs process freeze:
>
> 1. set options(error=recover)
> 2. Move to a buffer where there is a group of statements, one of which
> will produce an error. For example:
>
> options(error=recover)
> library(datasets)
> avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
> function(x)mean(x$breaks)))
> #previous line generates error due to typo
> print(avg)
>
> 3. use C-p or C-r etc. to evaluate the paragraph.
> 4. RESULT: emacs becomes completely unresponsive.
>
> This makes ESS darn near unusable for me. This can't be normal, can it?
>
> I'm using ESS 5.5 with R 2.10.0 on both emacs 22.1.1 (OS X built in) and
> Aquamacs (22.3.1).
>
> Can anyone shed light?
>
> Peter

What does "recover" do?  Does it mess with the prompt?  If so, then
don't do it.  ESS will not like that.

Rodney

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: options(error=recover) produces ESS freeze

by James W. MacDonald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Peter Meilstrup wrote:

> I keep reproducing a very simple recipe for making ESS and the entire
> Emacs process freeze:
>
> 1. set options(error=recover)
> 2. Move to a buffer where there is a group of statements, one of which
> will produce an error. For example:
>
> options(error=recover)
> library(datasets)
> avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
> function(x)mean(x$breaks)))
> #previous line generates error due to typo
> print(avg)
>
> 3. use C-p or C-r etc. to evaluate the paragraph.
> 4. RESULT: emacs becomes completely unresponsive.
>
> This makes ESS darn near unusable for me. This can't be normal, can it?

This works fine for me using R-2.10.0, emacs 22.3.1 and ess 5.6 (svn
checkout) on Windows or R-2.10.0, emacs 23.1.2 and ess 5.4 on Linux

 > options(error=recover)
 > library(datasets)
 > avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
+ function(x)mean(x$breaks)))
Error: unexpected ')' in:
"avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
function(x)mean(x$breaks)))"
No suitable frames for recover()
 > #previous line generates error due to typo
 > print(avg)
Error in print(avg) : object 'avg' not found

Enter a frame number, or 0 to exit

1: print(avg)

Selection: 0
 >

So I don't think it is necessarily an emacs/ess problem.

Best,

Jim



>
> I'm using ESS 5.5 with R 2.10.0 on both emacs 22.1.1 (OS X built in) and
> Aquamacs (22.3.1).
>
> Can anyone shed light?
>
> Peter
>
> ______________________________________________
> ESS-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

--
James W. MacDonald, M.S.
Biostatistician
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Parent Message unknown Re: options(error=recover) produces ESS freeze

by Keith Ponting :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Peter Meilstrup wrote:
> > I keep reproducing a very simple recipe for making ESS and the
entire
> > Emacs process freeze:
> >
> > 1. set options(error=recover)
> > 2. Move to a buffer where there is a group of statements, one of
which

> > will produce an error. For example:
> >
> > options(error=recover)
> > library(datasets)
> > avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
> > function(x)mean(x$breaks)))
> > #previous line generates error due to typo
> > print(avg)
> >
> > 3. use C-p or C-r etc. to evaluate the paragraph.
> > 4. RESULT: emacs becomes completely unresponsive.
> >
> > This makes ESS darn near unusable for me. This can't be normal, can
> it?
>
> This works fine for me using R-2.10.0, emacs 22.3.1 and ess 5.6 (svn
> checkout) on Windows or R-2.10.0, emacs 23.1.2 and ess 5.4 on Linux
>
>  > options(error=recover)
>  > library(datasets)
>  > avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
> + function(x)mean(x$breaks)))
> Error: unexpected ')' in:
> "avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
> function(x)mean(x$breaks)))"
> No suitable frames for recover()
>  > #previous line generates error due to typo  > print(avg) Error in
> print(avg) : object 'avg' not found
>
> Enter a frame number, or 0 to exit
>
> 1: print(avg)
>
> Selection: 0
>  >
>
> So I don't think it is necessarily an emacs/ess problem.
>
> Best,
>
> Jim
>
>
>
> >
> > I'm using ESS 5.5 with R 2.10.0 on both emacs 22.1.1 (OS X built in)
> > and Aquamacs (22.3.1).
> >
> > Can anyone shed light?
> >

I think I have seen similar behaviour under earlier versions of R/ESS.
Your example above does not do it for me, but if I add a bit more on the
end I get the freeze (ESS 5.5, R-2.9.2, Vincent Goulet's Emacs 23.1
modified 3, Windows Vista):

options(error=recover)
library(datasets)
avg <- by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
function(x)mean(x$breaks)))
#previous line generates error due to typo
print(avg)
ff <- function()
  {
}

Execute the above with <ctrl>C <ctrl>R, and everything hangs. The
solution for me is <ctrl>G, at which point things unstick nicely and I
get the (different) prompt ("Selection:") issued by recover. (<ctrl>G is
also useful in other circumstances, such as invoking some operation
which takes a long time to complete.)

HTH

Keith

Keith Ponting
Aurix Ltd, Malvern WR14 3SZ  UK

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: options(error=recover) produces ESS freeze

by Martin Maechler-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "RoSp" == Rodney Sparapani <rsparapa@...>
>>>>>     on Thu, 05 Nov 2009 16:38:28 -0600 writes:

    RoSp> Peter Meilstrup wrote:
    >> I keep reproducing a very simple recipe for making ESS
    >> and the entire Emacs process freeze:
    >>
    >> 1. set options(error=recover) 2. Move to a buffer where
    >> there is a group of statements, one of which will produce
    >> an error. For example:
    >>
    >> options(error=recover) library(datasets) avg <-
    >> by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
    >> function(x)mean(x$breaks))) #previous line generates
    >> error due to typo print(avg)
    >>
    >> 3. use C-p or C-r etc. to evaluate the paragraph.
    >> 4. RESULT: emacs becomes completely unresponsive.
    >>
    >> This makes ESS darn near unusable for me. This can't be
    >> normal, can it?
    >>
    >> I'm using ESS 5.5 with R 2.10.0 on both emacs 22.1.1 (OS
    >> X built in) and Aquamacs (22.3.1).
    >>
    >> Can anyone shed light?
    >>
    >> Peter

    RoSp> What does "recover" do?  Does it mess with the prompt?

Yes, in case of an error it does of course: You automatically
end in a debugger dialog when an error occurs.
This is a very nice, useful, and often recommend way to debug
code in R.

    RoSp> If so, then don't do it.  ESS will not like that.

well, that's not the answer a good R user wants to hear.

   {But note: The simply workaround *IS*  'C-g'  aka  "Ctrl G" !! }

Keith Ponting, in his reproducible example of today, in this thread,
mentions that the prompt is '^Selection: '
in his case.
So one could argue that  ESS  should be fixed and detect
'^Selection: '  as a prompt.
The bad news is that with R being multilingual, you only get
'Selection: ' if you are in an English language locale, or if
there's no valid translation available for that R.
E.g. in a German language locale, you get
     'Fehler'  instead of 'Error'
and  'Auswahl' instead of 'Selection'

Now, we'd need pretty sophisticated code in ESS which would be
able to catch these things correctly independent of the current
locale.
I think a smart solution would be:
1) When ESS starts up R, quickly find out what word the current
   locale uses for  "Error"  and what for "Selection" and store
   these.
2a) Later, ESS "should know" if options(error=recover) is active.
    {or more generally, just if the 'error' options differs from NULL}
   
2b) In those cases, it should not wait for the default prompt
    necessarily, but rather for the equivalent of "Selection: "

Hmm, pretty messy, unfortunately.

For the moment, I'd rather advertize the workaround  

---->  ===         ------
---->  C-g   aka  "Ctrl G" !!
---->  ===         ------

Martin Maechler, ETH Zurich

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: options(error=recover) produces ESS freeze

by Richard M. Heiberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How about changing the recover prompt to
"Selection> "
If R-core doesn't want to do that, than ESS could probably do it (although
that is probably equivalent to Martin's suggestion # 1).

I believe we already can handle any text string before the "> " sequence.


Rich

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: options(error=recover) produces ESS freeze

by Peter Meilstrup :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 9, 2009, at 5:54 AM, Martin Maechler wrote:

>>> I keep reproducing a very simple recipe for making ESS
>>> and the entire Emacs process freeze:
>>>
>>> 1. set options(error=recover) 2. Move to a buffer where
>>> there is a group of statements, one of which will produce
>>> an error. For example:
>>>
>>> options(error=recover) library(datasets) avg <-
>>> by(warpbreaks, list(warpbreaks$wool, warpbreaks$tnsion),
>>> function(x)mean(x$breaks))) #previous line generates
>>> error due to typo print(avg)
>>>
>>> 3. use C-p or C-r etc. to evaluate the paragraph.
>>> 4. RESULT: emacs becomes completely unresponsive.
>>>
>>> This makes ESS darn near unusable for me. This can't be
>>> normal, can it?
>>>
>>> I'm using ESS 5.5 with R 2.10.0 on both emacs 22.1.1 (OS
>>> X built in) and Aquamacs (22.3.1).
>>>
>>> Can anyone shed light?
>>>
>>> Peter
>
>   {But note: The simply workaround *IS*  'C-g'  aka  "Ctrl G" !! }
>
> Keith Ponting, in his reproducible example of today, in this thread,
> mentions that the prompt is '^Selection: '
> in his case.
> So one could argue that  ESS  should be fixed and detect
> '^Selection: '  as a prompt.
> The bad news is that with R being multilingual, you only get
> 'Selection: ' if you are in an English language locale, or if
> there's no valid translation available for that R.
> E.g. in a German language locale, you get
>     'Fehler'  instead of 'Error'
> and  'Auswahl' instead of 'Selection'
>
> Now, we'd need pretty sophisticated code in ESS which would be
> able to catch these things correctly independent of the current
> locale.
> I think a smart solution would be:
> 1) When ESS starts up R, quickly find out what word the current
>   locale uses for  "Error"  and what for "Selection" and store
>   these.
> 2a) Later, ESS "should know" if options(error=recover) is active.
>    {or more generally, just if the 'error' options differs from NULL}
>
> 2b) In those cases, it should not wait for the default prompt
>    necessarily, but rather for the equivalent of "Selection: "
>
> Hmm, pretty messy, unfortunately.
>
> For the moment, I'd rather advertize the workaround
>
> ---->  ===         ------
> ---->  C-g   aka  "Ctrl G" !!
> ---->  ===         ------

Thanks Martin. Ctrl-G works for now.

Since "Selection:" comes from utils::menu(), which in turn calls  
gettext(), might it be a more general solution to sidestep the  
internationalization issues you raise, and instead have a way to  
detect when utils::menu or gettext is being called, perhaps putting a  
trace on gettext during ESS startup?

Peter

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help