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

fixed show methods using Cairo for julia v0.5 #907

Merged
merged 2 commits into from
Oct 6, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/Gadfly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -969,18 +969,16 @@ end

try
getfield(Compose, :Cairo) # throws if Cairo isn't being used
@compat function show(io::IO, ::MIME"image/png", p::Plot)
@compat global show(io::IO, ::MIME"image/png", p::Plot) =
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be global function show?

Copy link
Author

Choose a reason for hiding this comment

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

function can be omitted for online functions :-) I did remove function on purpose as in julia v0.4 the following code works:

try
 global foo(x)=x+1
end

while the following code raises an error:

try
  global function foo(x)
    x+1
  end
end

Nevertheless, a different method for fixing this problem was suggested in JuliaLang/julia#18767 . So I'll give it a try. :-)

draw(PNG(io, Compose.default_graphic_width,
Compose.default_graphic_height), p)
end
Compose.default_graphic_height), p);
end

try
getfield(Compose, :Cairo) # throws if Cairo isn't being used
@compat function show(io::IO, ::MIME"application/postscript", p::Plot)
@compat global show(io::IO, ::MIME"application/postscript", p::Plot) =
draw(PS(io, Compose.default_graphic_width,
Compose.default_graphic_height), p)
end
Compose.default_graphic_height), p);
Copy link
Member

Choose a reason for hiding this comment

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

Semi-colon is unnecessary, right?

end

@compat function show(io::IO, ::MIME"text/plain", p::Plot)
Expand Down