Fixed: Nested run-now (and therefore nested build) won't work.

This commit is contained in:
Daniel Ziltener 2013-08-31 11:18:54 +00:00
parent b6a2f308fa
commit 20aac63215
2 changed files with 12 additions and 9 deletions

View file

@ -1,9 +1,9 @@
(defproject clojurefx "0.0.1"
(defproject clojurefx "0.0.2"
:description "Helper functions and probably a wrapper to simplify usage of JavaFX in Clojure.
You'll need to have jfxrt.jar in your local maven repository. See [this coderwall protip](https://coderwall.com/p/4yjy1a) for how to make this happen.
**Installation: `[clojurefx \"0.0.1\"]`**"
**Installation: `[clojurefx \"0.0.2\"]`**"
:url "https://www.github.com/zilti/clojurefx"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}

View file

@ -11,6 +11,7 @@ Simple wrapper for Platform/runLater. You should use run-later.
(defmacro run-later [& body]
`(run-later* (fn [] ~@body)))
(declare ^:dynamic *nested?*)
(defn run-now*"
A modification of run-later waiting for the running method to return. You should use run-now.
" [f]
@ -20,7 +21,10 @@ A modification of run-later waiting for the running method to return. You should
@result))
(defmacro run-now [& body]
`(run-now* (fn [] ~@body)))
(if *nested?*
`((fn [] ~@body))
(binding [*nested?* true]
`(run-now* (fn [] ~@body)))))
(defn- camel [in]
(let [in (name in)
@ -90,7 +94,6 @@ Don't use this yourself; See the macros \"build\" and \"deffx\" below.
(map? (first args)))
`(build ~what ~@(for [entry# (keys (first args))]
`(~(symbol (name entry#)) ~((first args) entry#))))
`(run-now (.. ~(get-qualified what) ~(symbol "create")
~@args
~(symbol "build")))))