timh at insightful.com
2006-Jul-06 23:35 UTC
[Rd] comment causes browser() to exit (PR#9063)
I'm trying to step through some code using browser(), executing one line at a time. Unfortunately, whenever I execute a comment line, the browser exits. I previously reported a similar problem with blank lines. These problems are a strong incentive to write poor code -- uncommented code with no blank lines to improve readability -- so that I can use browser() without it exiting at inconvenient times. Additional detail: (1) I'm running R inside emacs, with R in one buffer and a file containing code in another, using a macro to copy and paste a line at a time from the file to the R buffer. (2) The browser() call is inside a function. Right now the lines I'm sending to the browser are not part of the function, though usually they are. --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 2 minor = 3.1 year = 2006 month = 06 day = 01 svn rev = 38247 language = R version.string = Version 2.3.1 (2006-06-01) Windows XP Professional (build 2600) Service Pack 2.0 Locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 Search Path: .GlobalEnv, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base
If I'm not mistaken, this works as documented. As an example (typed directly into the Rgui console on WinXP): R> f <- function() { + browser() + cat("I'm here!\n") + cat("I'm still here!\n") + } R> f() Called from: f() Browse[1]> ## where to? I'm here! I'm still here! which I think is what you saw. However: R> f() Called from: f() Browse[1]> n debug: cat("I'm here!\n") Browse[1]> ## I'm here! debug: cat("I'm still here!\n") Browse[1]> I'm still here!>From ?browser:c (or just return) exit the browser and continue execution at the next statement. cont synonym for c. n enter the step-through debugger. This changes the meaning of c: see the documentation for debug. My interpretation of this is that, if the first thing typed (or pasted) in is something like a null statement (e.g., return, empty line, or comment), it's the same as 'c', but if the null statement follows 'n', then it behaves differently. _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.1 year 2006 month 06 day 01 svn rev 38247 language R version.string Version 2.3.1 (2006-06-01) Andy From: timh at insightful.com> > I'm trying to step through some code using browser(), > executing one line at a time. > Unfortunately, whenever I execute a comment line, the browser exits. > > I previously reported a similar problem with blank lines. > > These problems are a strong incentive to write poor code > -- uncommented code with no blank lines to improve > readability -- so that I can use browser() without it exiting > at inconvenient times. > > Additional detail: > (1) I'm running R inside emacs, with R in one buffer and a > file containing code in another, using a macro to copy and > paste a line at a time from the file to the R buffer. > (2) The browser() call is inside a function. > Right now the lines I'm sending to the browser are not part > of the function, though usually they are. > > > --please do not edit the information below-- > > Version: > platform = i386-pc-mingw32 > arch = i386 > os = mingw32 > system = i386, mingw32 > status > major = 2 > minor = 3.1 > year = 2006 > month = 06 > day = 01 > svn rev = 38247 > language = R > version.string = Version 2.3.1 (2006-06-01) > > Windows XP Professional (build 2600) Service Pack 2.0 > > Locale: > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > Search Path: > .GlobalEnv, package:methods, package:stats, > package:graphics, package:grDevices, package:utils, > package:datasets, Autoloads, package:base > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >
Maybe Matching Threads
- help("R_LIBS") brings up the wrong help file (PR#10475)
- Open .ssc .S ... files in R (PR#8690)
- is(x, "parent") returns FALSE when class(x) is c("child", "parent") (PR#10549)
- bad variable names when printing a data frame containing a matrix (PR#10730)
- round(4.5) does not work (PR#9439)