 (defun floobits-switch (text)
   (floobits-debug-message "%s" text)
   (let* ((json-key-type 'string)
-    (req (json-read-from-string text))
-    (event (floo-get-item req "name"))
-    (func (concat "floobits-event-" event)))
+        (req (json-read-from-string text))
+        (event (floo-get-item req "name"))
+        (func (concat "floobits-event-" event)))
     (if (fboundp (intern-soft func))
       (funcall (read func) req)
       (message "func %s doesn't exist" func))))

              (setq buffer-read-only t)))
          added))
      (setq floobits-open-buffers current-buffers)
      (let* (
          (added-text
            (mapcar
              (lambda (buf-path)
                (cons (intern buf-path)
                  (floobits-get-buffer-text (find-buffer-visiting buf-path))))
            added))
        (req (list
        (cons 'current current-buffers)
        (cons 'added added-text)
        (cons 'deleted deleted))))
        (floobits-send-to-agent req 'buffer_list_change)))))

(provide 'floobits)


(defun floobits-event-edit (req)
  (let* ((filename (floo-get-item req "full_path"))
        (buf (get-file-buffer filename))
        (edits (floo-get-item req "edits")))
    (when buf
      (with-current-buffer buf
        (save-excursion
          (atomic-change-group
