-
Notifications
You must be signed in to change notification settings - Fork 77
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
SCI env improvements #357
SCI env improvements #357
Conversation
zampino
commented
Dec 19, 2022
•
edited
Loading
edited
- allow to require codemirror classes by their own name
- expose namespaces from clojure-mode
Also doesn't work in the static app https://snapshots.nextjournal.com/clerk/build/0c3d838215278ac6b57b13457da774ec5b49d3c2/index.html#/notebooks/viewers/code.clj |
src/nextjournal/clerk/sci_env.clj
Outdated
|
||
(defmacro sci-copy-nss [& nss] | ||
(into {} (for [[_ ns] nss] | ||
[(list 'quote ns) `(sci.core/copy-ns ~ns (sci.core/create-ns '~ns))]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@borkdude any interest in getting such a convenience macro or something similar into sci?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or would it be possible to write this as a function if sci.core/copy-ns
also accepted a quoted symbol as the first arg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't intend to add this macro today since it hides the ability to pass in the result of sci/create-ns
which can carry metadata etc.
You have to do this using a macro since sci.core/copy-ns
is also a macro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or if not a quoted symbol, maybe a namespace:
(into {}
(map (fn [ns-sym] [ns-sym (sci.core/copy-ns (find-ns ns-sym) (sci.core/create-ns ns-sym))]))
'[nextjournal.clerk.parser nextjournal.clerk.render])
@zampino The errors probably have to do with non-top-level require and refer. Perhaps it works if you execute the require and usage of that require in two separate functions, but ultimately this is what |
# Conflicts: # src/nextjournal/clerk/sci_env.cljs
Need to re-evaluate all of them in a second step
by implementing IFn on ViewerEval