Search code examples
clojurequilnrepl

How do I live code in Clojure using Emacs / nrepl / Quil?


I have a fairly standard Quil file that I am editing with Emacs and nrepl.

(defn setup []
  (qc/smooth)
  (qc/frame-rate 24)
  (qc/background 200))

(defn draw []
  (draw-world))

(qc/defsketch run
  :title "Circles!"
  :setup setup
  :draw draw
  :size [800 600]
  :renderer :opengl)

To start with, I use C-c C-l to load the file; this creates a sketch window. I then edit my draw-world function to, say, draw in a different color. My question is:

How do I update the current Quil window with this new function?

*C-x C-e doesn't seem to work.


Solution

  • Try C-M-x (this evals the current top-level form) in the function you want to change or C-c C-k (this evals the current buffer) in the source buffer. Btw, C-x C-e should be working too (it certainly works for me, but I rarely use it). Maybe you're not using nrepl.el's latest version?