diff --git a/NEWS.md b/NEWS.md index db94e422..b80ca542 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # reprex (development version) +* `reprex()` no longer includes the full traceback by default, as this is + only useful in relatively rare situations, and otherwise adds a bunch + of clutter (#448). + The unexported `prex_*()` functions protect the current session from option changes coming from reprex's own machinery, such as disabling color (#427). # reprex 2.0.2 diff --git a/R/reprex.R b/R/reprex.R index db7b9e31..f6920cb1 100644 --- a/R/reprex.R +++ b/R/reprex.R @@ -40,16 +40,10 @@ #' #' @section Error backtraces: #' -#' reprex sets the rlang option `rlang_backtrace_on_error_report = "full"`. -#' Combined with the knitr option `error = TRUE`, this means rlang errors are -#' displayed with a full backtrace. This basically eliminates the need to call -#' [rlang::last_error()] or [rlang::last_trace()] explicitly, although these -#' functions can be used in a reprex. -#' - -#' Insert a line containing the special comment `#'` in between the -#' error-causing code and the `last_error()` or `last_trace()` call, to fulfill -#' the requirement of being in separate chunks: +#' To use [rlang::last_error()] or [rlang::last_trace()] within a reprex, +#' you must place them in a different "chunk" to the code that generates an +#' error. The easiest way to do is to insert a line containing the special +#' comment `#'` after error-causing code: #' ``` r #' f <- function() rlang::abort('foo') diff --git a/R/reprex_document.R b/R/reprex_document.R index bbe5a789..7fccbeb8 100644 --- a/R/reprex_document.R +++ b/R/reprex_document.R @@ -135,7 +135,6 @@ reprex_opts <- function(venue = "gh") { ```{{r reprex-options, include = FALSE}} options( keep.source = TRUE, - rlang_backtrace_on_error_report = "full", crayon.enabled = FALSE, reprex.current_venue = "{venue}" ) diff --git a/R/reprex_render.R b/R/reprex_render.R index 5b8ae30e..b0e2145c 100644 --- a/R/reprex_render.R +++ b/R/reprex_render.R @@ -153,7 +153,6 @@ reprex_render_impl <- function(input, # should be kept in sync with what reprex_opts() sets opts_to_safeguard <- options( "keep.source", - "rlang_backtrace_on_error_report", "crayon.enabled" ) withr::defer(options(opts_to_safeguard)) diff --git a/man/reprex.Rd b/man/reprex.Rd index bc2d7ec0..7b71f2b0 100644 --- a/man/reprex.Rd +++ b/man/reprex.Rd @@ -163,15 +163,10 @@ code (see examples). \section{Error backtraces}{ -reprex sets the rlang option \code{rlang_backtrace_on_error_report = "full"}. -Combined with the knitr option \code{error = TRUE}, this means rlang errors are -displayed with a full backtrace. This basically eliminates the need to call -\code{\link[rlang:last_error]{rlang::last_error()}} or \code{\link[rlang:last_error]{rlang::last_trace()}} explicitly, although these -functions can be used in a reprex. - -Insert a line containing the special comment \verb{#'} in between the -error-causing code and the \code{last_error()} or \code{last_trace()} call, to fulfill -the requirement of being in separate chunks: +To use \code{\link[rlang:last_error]{rlang::last_error()}} or \code{\link[rlang:last_error]{rlang::last_trace()}} within a reprex, +you must place them in a different "chunk" to the code that generates an +error. The easiest way to do is to insert a line containing the special +comment \verb{#'} after error-causing code: \if{html}{\out{