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

Communicate vignette includes interactive output #175

Open
hadley opened this issue Nov 2, 2023 · 1 comment
Open

Communicate vignette includes interactive output #175

hadley opened this issue Nov 2, 2023 · 1 comment

Comments

@hadley
Copy link
Member

hadley commented Nov 2, 2023

Like:

#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

I tried explicitly disabling with:

options(rlang_interactive = FALSE)

But that didn't do anything. But I don't understand why is_interactive() would be true in the first place?

@hadley
Copy link
Member Author

hadley commented Nov 2, 2023

It looks like deprecate_warn0() gets called twice, the second time with call stack

     ▆
  1. └─rmarkdown::render("vignettes/test.Rmd")
  2.   └─knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  3.     └─knitr:::process_file(text, output)
  4.       ├─knitr:::handle_error(...)
  5.       │ └─base::withCallingHandlers(...)
  6.       ├─base::withCallingHandlers(...)
  7.       ├─knitr:::process_group(group)
  8.       └─knitr:::process_group.block(group)
  9.         └─knitr:::call_block(x)
 10.           └─knitr:::block_exec(params)
 11.             └─knitr:::eng_r(options)
 12.               ├─base::unlist(sew(res, options))
 13.               ├─knitr::sew(res, options)
 14.               └─knitr:::sew.list(res, options)
 15.                 └─base::lapply(x, sew, options, ...)
 16.                   ├─knitr (local) FUN(X[[i]], ...)
 17.                   ├─rlang (local) sew.rlang_warning(X[[i]], ...)
 18.                   ├─base::NextMethod()
 19.                   └─knitr:::sew.warning(X[[i]], ...)
 20.                     ├─knitr:::msg_wrap(...)
 21.                     │ └─base::grep("\n", message)
 22.                     │   └─base::is.factor(x)
 23.                     ├─base::sprintf("Warning%s: %s", call, conditionMessage(x))
 24.                     ├─base::conditionMessage(x)
 25.                     └─rlang:::conditionMessage.rlang_warning(x)
 26.                       └─rlang::cnd_message(c)
 27.                         └─rlang:::cnd_message_format(cnd, ...)
 28.                           └─rlang:::cnd_message_lines(cnd, ...)
 29.                             └─rlang::cnd_footer(cnd, ...)
 30.                               └─rlang:::exec_cnd_method("footer", cnd, ...)
 31.                                 └─lifecycle (local) method(cnd, ...)

Oh because footer() is generated lazily so it gets recomputed by knitr::sew() which is run in an interactive context.

This is super confusing but doesn't affect the rendered site, just the local previews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant