     (let [[a b] (map vec (split-at 2 bindings))]     
       `(when-let ~a (when-lets ~b ~@body))))))
       
-(defmacro with-setting [gst & body]
+(defmacro with-setting
+  "gst consists of a vector containing a getter, a setter, and a temp
+   value. Calls getter to read the current value, uses setter to
+   set the temporary value, executes body, and then calls setter
+   to set the original value again."
+  [gst & body]
   (let [[getter setter temp] gst]
     `(let [perm# (~getter)
            temp# ~temp

    `(when (and ~@args_)
      (~f ~@args_))))

(defmacro if-args [f & args]
  (let [args_ args]
    `(if (and ~@args_)
      (~f ~@args_))))

(defn get-default-devices []
  {:camera          (core getCameraDevice)
   :shutter         (core getShutterDevice)
   :focus           (core getFocusDevice)

          (core defineStateLabel dev i (get state-labels i)))))
    (log "...reloading of " dev " has apparently succeeded.")))

(defn json-to-data
  "Take a JSON object and convert it to a clojure data object."
  [json]
  (condp #(isa? (type %2) %1) json
    JSONObject
      (let [keys (iterator-seq (.keys json))]
