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

[BUG] Semicolon in juliaconsole environment no longer suppresses output #386

Closed
mossr opened this issue Aug 10, 2020 · 7 comments
Closed
Labels

Comments

@mossr
Copy link

mossr commented Aug 10, 2020

When using the juliaconsole environment from pythontex, semicolons no longer suppress outputs in Weave versions 0.10+ (v0.9.4 is the last working version).

Any pointers to help track this down, I'd be happy to help get this fixed.

@mossr mossr added the bug label Aug 10, 2020
@mossr mossr changed the title [BUG] Semicolon in juliaconsole environment does not suppress output [BUG] Semicolon in juliaconsole environment no longer suppresses output Aug 10, 2020
@mykelk
Copy link

mykelk commented Sep 1, 2020

I'm able to reproduce this issue and can confirm that v0.9.4 works.

@torfjelde
Copy link
Contributor

Seems like this line (which was introduced after v0.10) is the issue:

obj = include_string(mod, code, path) # TODO: fix line number

include_string doesn't respect ;, e.g.

julia> include_string(Main, "1 + 2;")
3

@aviatesk
Copy link
Member

@torfjelde thanks for tracking the problem. I introduced include_string in this commit just because it's easier way to respect filename and line numbers than to use Core.eval solution (, which needs bit of expression manipulation).

I feel a special casing that adds ; nothing when the input line ends with semicolon would be enough for handling this bug.

@torfjelde
Copy link
Contributor

How about

Weave.jl/src/run.jl

Lines 227 to 228 in 174585e

obj = include_string(mod, code, path) # TODO: fix line number
!isnothing(obj) && display(obj)
becomes

obj = include_string(mod, code, path) # TODO: fix line number
!isnothing(obj) && !REPL.ends_with_semicolon(code) && display(obj)

?

@aviatesk
Copy link
Member

ah sounds nice. wanna open a PR ?

@torfjelde
Copy link
Contributor

Sure thing 👍

torfjelde added a commit to torfjelde/Weave.jl that referenced this issue Sep 24, 2020
aviatesk added a commit that referenced this issue Sep 24, 2020
@aviatesk
Copy link
Member

will be fixed in v0.10.4

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

No branches or pull requests

4 participants