Not sure how it's obvious or granted as I am pretty new to the clojure world but I am really loving having a repl namespace in our projects, compiling the repl file kicks in the (web) application in the same way it gets kicked in from the -main.
Server goes up, any time we C-x X-s a file we also compile it and changes are picked up. As Jay said, anything special - it just works: something I missed in most of the IDEs I've used in the past. On Mon, Jun 10, 2013 at 12:32 PM, Jay Fields <j...@jayfields.com> wrote: > 2013/6/8 Jay Fields <j...@jayfields.com> > >>> My favorite recent addition - I can run my app from within emacs, >>> allowing me to change my app with a simple C-x C-e and see my changes >>> immediately in the running app (no restart, refresh or reload necessary). >> >> >> Would you mind to extend on that ? >> >> How is this done, exactly ? > > > Sure. I assume you have some top level function that you call to 'start' > your application. If you ever use 'lein run', then I'm probably talking > about the -main function in whatever namespace you specify as your main > namespace (e.g. > https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L130) > > Let's pretend your main namespace is my-main. > > First I start a new nrepl. M-x nrepl-jack-in > Then I open my-main in a new buffer. C-x C-f my_main.clj > (If there isn't one already) I put a comment at the bottom of the namespace. > c-tab > In the comment, I put (-main) and, after the parenthesis, I C-x C-e to > evaluate the previous form. > > At that point my app is running from within Emacs. Now I can go to any form > in the codebase and C-x C-e, which will evaluate the form in my running > nrepl, which is also running my app. Let's say I have some function that's > being called every minute and printing the time via println. I can go to > that function and change the format of the output, C-x C-e the entire > function, and the next println will be in my new format. There are a few > gotchas (it's problematic to redef a defmulti, once you've passed a f in as > a parameter you can't redef it), but for the 95% case I don't need to do > anything special - it just works. > > Cheers, Jay > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.