[ESS] options(error=recover) produces ESS freeze

Martin Maechler maechler at stat.math.ethz.ch
Mon Nov 9 14:54:37 CET 2009

>>>>> "RoSp" == Rodney Sparapani <rsparapa at mcw.edu>
>>>>>     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
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
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

More information about the ESS-help mailing list