       (thunk)
       (finally
         (when (not= id -1)
-          (dosync
-            (commute *repls* assoc id
-                     (struct-map repl
-                                 :id                 id
-                                 :ns                 *ns*
-                                 :warn-on-reflection *warn-on-reflection*
-                                 :print-meta         *print-meta*
-                                 :print-length       *print-length*
-                                 :print-level        *print-level*
-                                 :compile-path       *compile-path*
-                                 :command-line-args  *command-line-args*
-                                 :expr1              *1
-                                 :expr2              *2
-                                 :expr3              *3
-                                 :exception          *e
-                                 :print-pretty       vimclojure.repl/*print-pretty*
-                                 :line               (dec (.getLineNumber *in*))))))
-        (Var/popThreadBindings)))))
+          (swap! *repls* assoc id
+                 (struct-map repl
+                             :id                 id
+                             :ns                 *ns*
+                             :warn-on-reflection *warn-on-reflection*
+                             :print-meta         *print-meta*
+                             :print-length       *print-length*
+                             :print-level        *print-level*
+                             :compile-path       *compile-path*
+                             :command-line-args  *command-line-args*
+                             :expr1              *1
+                             :expr2              *2
+                             :expr3              *3
+                             :exception          *e
+                             :print-pretty       vimclojure.repl/*print-pretty*
+                             :line               (dec (.getLineNumber *in*))))))
+        (Var/popThreadBindings))))
 
 (defmacro with-repl
   "Executes body in the context of the Repl with the given id. id may be -1

  #^{:doc
  "A map holding the references to all running repls indexed by their repl id."}
  *repls*
  (ref {}))

(let [id (ref 0)]
  (defn repl-id
    "Get a new Repl id."
    []
    (dosync (alter id inc))))

(def
  #^{:doc

  to use a one-shot context. Sets the file line accordingly."
  [id nspace file line thunk]
  (let [the-repl (if (not= id -1)
                   (locking *repls*
                     (if-let [the-repl (get @*repls* id)]
                       (do
                         (swap! *repls* dissoc id)
                         the-repl)
                       (throw (Exception. (str "No Repl of that id: " id)))))
                   (make-repl -1))
        line     (if (= line 0)
                   (the-repl :line)
