[Rd] bug/suggestion: debugger should respect option "deparse.max.lines" when printing the call (PR#13647)

jbrzusto at fastmail.fm jbrzusto at fastmail.fm
Thu Apr 9 16:20:09 CEST 2009


Full_Name: John Brzustowski
Version: 2.8.1
OS: linux
Submission from: (NULL) (67.71.250.146)


When entering a debug()'ed function, the call printout is not limited by
options()$deparse.max.lines as it is when one uses browser() or trace().

Should it be?  If so, here's a patch:

diff -cr R-2.8.1/src/library/base/man/options.Rd
R-2.8.1-patched/src/library/base/man/options.Rd
*** R-2.8.1/src/library/base/man/options.Rd     2008-11-12 04:23:36.000000000
-0500
--- R-2.8.1-patched/src/library/base/man/options.Rd     2009-04-09
10:12:31.000000000 -0400
***************
*** 77,84 ****
        initialized (see \code{\link{Startup}}).}
  
      \item{\code{deparse.max.lines}:}{controls the number of lines used
!       when deparsing in \code{\link{traceback}} and
!       \code{\link{browser}}.  Initially unset, and only used if set to
        a positive integer.}
  
      \item{\code{digits}:}{controls the number of digits to print when
--- 77,85 ----
        initialized (see \code{\link{Startup}}).}
  
      \item{\code{deparse.max.lines}:}{controls the number of lines used
!       when deparsing in \code{\link{traceback}}, \code{\link{browser}},
!       and upon entry to a function whose debugging flag is set.
!       Initially unset, and only used if set to
        a positive integer.}
  
      \item{\code{digits}:}{controls the number of digits to print when
diff -cr R-2.8.1/src/main/eval.c R-2.8.1-patched/src/main/eval.c
*** R-2.8.1/src/main/eval.c     2008-10-05 18:05:02.000000000 -0400
--- R-2.8.1-patched/src/main/eval.c     2009-04-09 09:45:03.000000000 -0400
***************
*** 526,531 ****
--- 526,532 ----
      volatile  SEXP newrho;
      SEXP f, a, tmp;
      RCNTXT cntxt;
+     int itmp;
  
      /* formals = list of formal parameters */
      /* actuals = values to be bound to formals */
***************
*** 609,615 ****
--- 610,621 ----
      SET_DEBUG(newrho, DEBUG(op));
      if (DEBUG(op)) {
        Rprintf("debugging in: ");
+ 
+       itmp = asInteger(GetOption(install("deparse.max.lines"), R_BaseEnv));
+       if(itmp != NA_INTEGER && tmp > 0) R_BrowseLines = itmp;
        PrintValueRec(call,rho);
+       R_BrowseLines = 0;
+ 
        /* Is the body a bare symbol (PR#6804) */
        if (!isSymbol(body) & !isVectorAtomic(body)){
                /* Find out if the body is function with only one statement. */



More information about the R-devel mailing list