-
Notifications
You must be signed in to change notification settings - Fork 139
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
sew()
method for warnings and messages
#1551
Comments
I think warnings are most important as you want to get a traceback for them, since otherwise they're very difficult to pin down when you're not in an interactive context. |
The tricky part is that we need to save the warnings that occurred in the current document and reset the list when a new document starts. Do you know if there's an easy way to achieve that @cderv? Is there a hook that runs when knitr starts knitting, that we could use to reset our warning list? |
If I understand correctly this is related to this issue yihui/knitr#2219 where suggestion would be to make those method lives in knitr directly ? In that scenario, it would be probably easier to reset after knitting a document, right ? Currently in knitr, we do have a way to store error, message and warnings with internal
During knitting, all messages, warnings and errors are stored (it happens in Anyway, we have currently a way to store message, error and warning and the list is reset at the start of each knitting. Would that be useful ? Probably more for an internal implementation than in rlang.
We don't have those kind of hooks, but probably something we could easily add. So on both account, we can definitely adapt knitr so that this is feasible. |
This is complicated and I was initially a bit confused regarding Hadley's needs. Here is a summary of the three main integration points between rlang and knitr:
It turns out that Hadley only needs Given that these features are closely related to rlang (global options, |
Thanks Lionel.
So if I understand correctly, the only thing that would help at the knitr level would be adding some init and final hooks for
Previous comment being
If you need access to the warnings, would the |
It looks like we could use I think we could fully implement |
@cderv I just figured out I can use the same trick to detect new knitr sessions than we already do in |
Oh clever. Learning a lot by seeing how rlang works and how you solve this. Thanks for sharing thoughts process.
Oh now I see what you need. Indeed we only use the message internal that we format. BTW
I think it would be possible to provide something like this. Several ways to make that happen. But you don't need anymore it now right ? Using the pointer solves your issue right ? I still think the init / final hooks are a good thing to have though. I'll keep that in mind if we have a new usage that comes |
yup it's fixed in #1557.
Sounds good! |
Awesome thanks. All good. That is really cool feature that are coming in next rlang ! |
rlang/R/cnd-message.R
Lines 309 to 326 in 90ef6d1
The text was updated successfully, but these errors were encountered: