This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-25
Channels
- # asami (5)
- # babashka (38)
- # beginners (116)
- # calva (65)
- # chlorine-clover (4)
- # cider (8)
- # cljfx (6)
- # cljsrn (7)
- # clojure (18)
- # clojure-australia (1)
- # clojure-europe (49)
- # clojure-spec (6)
- # clojure-uk (4)
- # clojurescript (3)
- # clojureverse-ops (13)
- # core-async (2)
- # cryogen (1)
- # cursive (9)
- # datahike (32)
- # fulcro (3)
- # gratitude (17)
- # malli (4)
- # music (3)
- # nrepl (8)
- # off-topic (14)
- # releases (2)
- # rewrite-clj (3)
- # shadow-cljs (4)
- # vrac (1)
- # xtdb (4)
Hi everyone, I'm currently using nrepl with cider and would like to run a clojure function every time a s-exp is evaluated. I'm working on a cljfx project and I'm trying to get my scene reloaded every time a function is re-evaluated. Does anyone knows where to start? Do I need to build a middleware or is there any to add a hook to my user.clj? Thanks
Thanks @U09LZR36F. What hook should I use? Is it an emacs/cider hook or a nrepl client hook or cider-nrepl client hook? Sorry I'm new to the clojure ecosystem and I have to confess I don't know how all the pieces work.
A good example to start from is probably https://github.com/RickMoynihan/nrebl.middleware which does something similar to what you want - running a function after evaluation.
Hmm, actually that doesn't work how I expected. Lemme see if I can find you a better example.
https://github.com/vvvvalvalval/scope-capture-nrepl is a pretty close example, but not quite what you're trying to do either. This middleware wraps eval/load-file so that when you call them, the code is wrapped by the library. But instead you just want to call the handler, then run your result, something like:
(let [result (apply handler args)]
(reload-cljfx!)
result)
Thanks @U09LZR36F. This sounds a great start point. I will have a look.