Fork me on GitHub
#reveal
<
2021-03-09
>
motform08:03:04

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".

motform08:03:04

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}

motform08:03:19

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.

motform08:03:48

I see there is also the :env key, but that seems unwieldly when working with evaluations of unspecified depth.

vlaaad09:03:00

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

vlaaad09:03:48

i.e. (vlaaad.reveal.ext/open-view ...)

vlaaad09:03:05

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) ...)

motform09:03:10

That works great, thank you for the fast response!

motform09:03:27

+ the noet about the ns-loading

motform09:03:46

I'm really liking the remote-controlling so far! The only thing I'm missing would be a command to close the result panel

motform09:03:37

But other than that, it's really magical to see your data come to life directly from the editor!

vlaaad12:03:44

That's what I was aiming for :)

vlaaad12:03:24

Re closing the result panel — do you mean latest opened panel, or all panels?

motform12:03:04

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!

vlaaad20:03:18

I think it makes sense, I added it to my todo list, thanks!