                             ;; combine with the user defined emacs faces
                             (concat (filter #(= :emacs (:face/editor %)) (vals user-faces-map)))))))
 
-;; (pprint/pprint (xform-default-faces-emacs (:faces/by-name @reconciler) (:user-faces/by-name @reconciler)))
-
 ;; TODO use a multimethod here
 (defn build-emacs []
   (let [{current-theme      :theme/name
          faces-by-name      :faces/by-name
          user-faces-by-name :user-faces/by-name} @reconciler
-
-        user-faces-by-name'  (collect-user-faces-emacs user-faces-by-name)
-        xformed-faces-list   (xform-faces-emacs (merge user-faces-by-name faces-by-name))]
-    (pr-str (emacs-theme current-theme faces-by-name' colors-by-id))))
-
+        face-specs   (xform-faces-emacs faces-by-name user-faces-by-name)]
+    (emacs-theme face-specs)))
 
 (defn build-vim []
   "stub")

(defn xform-face-emacs [{:keys [face/name] :as face}]
  ;; TODO could use transducers here to optimize
  (let [plist (filter identity (map xform-prop-emacs face))]
    `(~(reader/read-string name) ((~'t ~(flatten plist))))))

(defn xform-faces-emacs [default-faces-map user-faces-map]
  (let [default-faces-map' (into {} (map font-lock-faceify default-faces-map))

        :else
        (str "font-lock-" face-name "-face")))

(defn emacs-theme [face-specs]
  (let [rec           @reconciler
        name           (:theme/name rec)
        name-sym       (reader/read-string name)
        name-sym-quote (reader/read-string (str "'" name))
        doc      "A theme created with Koeeoadi"]
    `(~'progn
      (~'deftheme ~name-sym ~doc)
      (~'put ~name-sym-quote (~'quote ~'theme-immediate) ~'t)
      (~'custom-theme-set-faces ~name-sym-quote ~@face-specs)
      (~'provide-theme ~name-sym-quote))))

(defn font-lock-faceify [[face-name props :as pair]]
  (let [face-name' (str "font-lock-" face-name "-face")]
    (if (= face-name "default")
