On Wednesday, December 19, 2012 10:52:26 AM UTC-6, Jonathon McKitrick wrote:

> Hi Tassilo
>
> > 1.  Can emacs with swank dynamically update Noir code running locally, 
>
>> > or do I need to save the code and then 'lein run' to see the new 
>> > result? 
>>
>> Without ever having used Noir, I would assume you can hack on the living 
>> instance at the REPL. 
>>
>
> I was wondering if I could make changes in emacs, C-c C-k, and refresh the 
> web page to see the results.
>


Yes, you can do this kind of thing, but you'll have to do a bit of setup.

My preference is to use lein-ring 
<https://github.com/weavejester/lein-ring>with `:auto-refresh?` and 
`:auto-reload?` enabled. And I include something 
like this in one of the namespaces (i.e. some .clj file) that gets loaded 
as a result of running `lein ring server ...` in my terminal:

    (ns some.namespace
      (:require [swank.swank :as swank]))

    (defonce swankify
      (swank/start-server :port 4005))


Note that you'll need to include [swank-clojure "1.4.3"] as a dependency in 
your project.clj for the above to work.

Once your program has been started, e.g. with `lein ring server 3000`, you 
should be able to use the `slime-connect` command from within Emacs to 
connect to localhost:4005.  Another thing to note: if you haven't installed 
the SLIME package for Emacs, but you do have clojure-mode installed, then 
first issue the `clojure-jack-in` command from within Emacs, then close the 
swank buffer, and then you'll be able to use the `slime-connect` command 
(as clojure-mode embeds a version of SLIME, but it's not loaded until your 
run `clojure-jack-in` the first time).

At this point, things you do in the slime-connect'ed REPL will have an 
effect on the running web server process. Also, if you make changes to 
source files in your project, the next time a web client makes a request 
those files/namespaces wil get reloaded thanks to lein-ring's 
`:auto-reload?` option. Also, changes to the source files will trigger a 
browser refresh thanks to lein-ring's `:auto-refresh?` option.

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

Reply via email to