[R] How to disable using "enter" key to exit the browser in debugging mode

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 13 12:20:52 CET 2011


You do not mean the "enter" key: it is not that which exits the 
browser but rather a newline (which can be entered via 'return', and 
in other ways).

This is part of the parser, and there is no way to turn it off.

Somehow other experienced R users have never encountered this.  But if 
you wish you could submit this as a 'wishlist' request to R-bugs, and 
if enough users support it (and especially if someone submits a 
high-quality patch to do this), it might be added in a future release.


On Wed, 12 Jan 2011, Feng Li wrote:

> Dear R,
>
> How can I disable using "enter" key to exit the browser() in debug mode? I
> would love to have this option because it is so annoying to jump out of the
> debugging mode unexpectedly when I don't want to. I guess some of us have
> encouraged at least one of these situations,
>
> 1, Accidentally pressed the enter key within the browser.
>
> 2, Copy and paste a piece of debugging code containing empty lines to the
> prompt within the debugging mode.
>
> 3, If I paste a piece of code to the prompt to debug as follows, it will
> eventually jump out before I can do anything.
>
> ####### copy starting from this line ##############
> test <- function()
> {
>     x<- 5
>     browser()
>     y<-4
> }
>
> test()
>
> ######## end of copy at this line ################
>
>
> Any suggestions are most welcome!
>
> Feng
>
> -- 
> Feng Li
> Department of Statistics
> Stockholm University
> 106 91 Stockholm, Sweden
> http://feng.li/
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list