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

Evaluate print in evaluation environment #202

Merged
merged 5 commits into from
Jul 11, 2024
Merged

Evaluate print in evaluation environment #202

merged 5 commits into from
Jul 11, 2024

Conversation

hadley
Copy link
Member

@hadley hadley commented Jul 3, 2024

Fixes #192

This turned out to be rather straightforward to implement after all the refactoring, and while it's unlikely to affect much user code, I think the changes to the tests demonstrates its utility.

@hadley hadley requested review from lionel- and cderv July 3, 2024 20:32
Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates R CMD CHECK failure for knitr when building vignette
https://github.com/yihui/knitr/actions/runs/9791626150/job/27035802276

* creating vignettes ... ERROR
Error: --- re-building ‘docco-classic.Rmd’ using docco_classic_notangle
Quitting from lines 13-20 [setup] (docco-classic.Rmd)
Error: Error: processing vignette 'docco-classic.Rmd' failed with diagnostics:
object 'visible' not found
--- failed re-building ‘docco-classic.Rmd’

So we need to look to check this

NEWS.md Outdated Show resolved Hide resolved
NEWS.md Outdated Show resolved Hide resolved
Comment on lines +49 to +51
print_env <- new.env(parent = envir)
print_env$value <- value
evalq(print(value), envir = print_env)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@hadley
Copy link
Member Author

hadley commented Jul 8, 2024

Ah the problem is that knitr does this:

normal_print = default_handlers$value
formals(normal_print) = alist(x = , ... = )

@hadley
Copy link
Member Author

hadley commented Jul 8, 2024

I made yihui/knitr#2353 so we can eventually drop this extra code.

@hadley hadley merged commit eee3073 into main Jul 11, 2024
14 checks passed
@hadley hadley deleted the correct-print branch July 11, 2024 05:26
hadley added a commit that referenced this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Special handling for is.null(output_handler$text)
3 participants