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

Fix org-babel workflow when auto wrapping main function #485

Merged
merged 2 commits into from Jan 18, 2023

Conversation

psibi
Copy link
Collaborator

@psibi psibi commented Jan 8, 2023

This bug is easily reproducible when you use try something like this:

let x = [1,2,3,4,5,6];
println!("{x:?}");

And then try executing it. While you will get the result properly, you could see in the Messages buffer that that would be some errors related to compilation buffer.

And the reason is this: It tries to do rustfmt on the babel block and fails. In this fix, I just disable doing rustfmt when we have enabled automatic wrapping or when we instruct it to wrap the main function.

Another alternative fix could be do rustfmt on the wrapped main function and the remove the wrapped main function and render it again on the babel blocks. But IMO, that's going to be very fragile.

This bug is easily reproducible when you use try something like this:

```
let x = [1,2,3,4,5,6];
println!("{x:?}");
```

And then try executing it. While you will get the result properly, you
could see in the Messages buffer that that would be some errors
related to compilation buffer.

And the reason is this: It tries to do rustfmt on the babel block and
fails. In this fix, I just disable doing rustfmt when we have enabled
automatic wrapping or when we instruct it to wrap the main function.

Another alternative fix could be do rustfmt on the wrapped main
function and the remove the wrapped main function and render it again
on the babel blocks. But IMO, that's going to be very fragile.
@psibi psibi requested a review from brotzeit January 17, 2023 04:07
@brotzeit
Copy link
Owner

Works for me.

@psibi psibi merged commit 464496f into brotzeit:master Jan 18, 2023
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.

None yet

2 participants