Skip to content

Commit

Permalink
Make fake_bind compatible to runic. (#3106)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu authored Jan 22, 2025
1 parent 3f17def commit 8ca430d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runner/PlutoRunner/src/bonds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,12 @@ end

"""
Will be inserted in saved notebooks that use the @bind macro, make sure that they still contain legal syntax when executed as a vanilla Julia script. Overloading `Base.get` for custom UI objects gives bound variables a sensible value.
Also turns off JuliaFormatter formatting to avoid issues with the formatter trying to change code that the user does not control. See https://domluna.github.io/JuliaFormatter.jl/stable/#Turn-off/on-formatting
Also turns off Runic and JuliaFormatter formatting to avoid issues with the formatter trying to change code that the user does not control. See https://domluna.github.io/JuliaFormatter.jl/stable/#Turn-off/on-formatting or https://github.com/fredrikekre/Runic.jl?tab=readme-ov-file#toggle-formatting
"""
const fake_bind = """macro bind(def, element)
const fake_bind = """
macro bind(def, element)
#! format: off
quote
return quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local el = \$(esc(element))
global \$(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
Expand Down

0 comments on commit 8ca430d

Please sign in to comment.