I'm experimenting a bit with the remote control capabilities for an emacs-mode that I'm making, but I'm having some trouble with the :ns
key in the command map. I get that it changes the ns for anything evaluated, but it seems to mean that it is unable to find reveal-functions when I specify a namespace :cause "Unable to resolve symbol: open-view in this context"
.
I think it makes sense, I added it to my todo list, thanks!
From the example:
(defn add-1 [x]
(+ 1 x))
{:vlaaad.reveal/command '(open-view {:fx/type vlaaad.reveal.ext/action-view
:action :vlaaad.reveal.action/view:table
:value (add-1 1)})
:ns 'foo.core}
The reason for this is that I want to be able to eval a form in the editor and send the result directly to a view. I recon this could also be done by evaluating the form using regular evaluation, save the result and then pipe that result into the reveal/command map, but that would cause the original evaluation to show up in the reveal history.
I see there is also the :env
key, but that seems unwieldly when working with evaluations of unspecified depth.
Hi! open-view is a function in vlaaad.reveal.ext ns, if you are using different ns, you should use fully-qualified call to open-view
i.e. (vlaaad.reveal.ext/open-view ...)
btw right now this ns is not loaded by Reveal automatically, but when invoking Reveal command it will make sure the ns is loaded before evaluation. This means just using full form might throw exception if user didn't require that ns before. More reliable way to open the view when using different ns is requiring-resolve, i.e. ((requiring-resolve 'vlaaad.reveal.ext/open-view) ...)
That works great, thank you for the fast response!
+ the noet about the ns-loading
I'm really liking the remote-controlling so far! The only thing I'm missing would be a command to close the result panel
But other than that, it's really magical to see your data come to life directly from the editor!
That's what I was aiming for :)
Re closing the result panel — do you mean latest opened panel, or all panels?
Probaby both. I can see there being times when you want to quickly look up a view, then get back to main repl and times when you have no idea how many panels deep you are. Like macroexpand/macroexpand-1!