Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent prex from changing certain session options #427

Closed
jennybc opened this issue Sep 14, 2022 · 1 comment
Closed

Prevent prex from changing certain session options #427

jennybc opened this issue Sep 14, 2022 · 1 comment
Labels
feature a feature request or enhancement

Comments

@jennybc
Copy link
Member

jennybc commented Sep 14, 2022

Now, first, remember that prex() is unexported precisely because it creates leakage between your current R session and your (re)prex. So in general, prex() users have to take the bad with the good.

But we could try harder to leave certain things the way we found them.

Consider these options, which we inject into to-be-(re)prexed code:

reprex/R/reprex_document.R

Lines 131 to 141 in 318363c

reprex_opts <- function(venue = "gh") {
string <- glue('
```{{r reprex-options, include = FALSE}}
options(
keep.source = TRUE,
rlang_backtrace_on_error_report = "full",
crayon.enabled = FALSE,
reprex.current_venue = "{venue}"
)
```')
}

prex() could note the original values of keep.source, rlang_backtrace_on_error_report, and crayon.enabled and make a point of scheduling their restoration.

@jennybc jennybc added the feature a feature request or enhancement label Sep 14, 2022
@jennybc
Copy link
Member Author

jennybc commented Sep 15, 2022

Before the fix

Screen Shot 2022-09-15 at 4 03 37 PM

After the fix

Screen Shot 2022-09-15 at 4 02 50 PM

jennybc added a commit that referenced this issue Sep 15, 2022
jennybc added a commit that referenced this issue Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant