           (set-process-query-on-exit-flag floobits-conn nil)
           (set-process-filter floobits-conn 'floobits-listener)
           (funcall callback))
-      (if moving (goto-char (process-mark proc)))))))
+        (if moving (goto-char (process-mark proc)))))))
 
 (defun floobits-launch-agent ()
   (condition-case nil
-    (progn
-      (delete-process floobits-python-agent))
+      (progn
+        (delete-process floobits-python-agent))
     (error nil))
 
   (message "Launching Floobits python agent...")
 
   (condition-case ex
-    (progn
-      (setq floobits-python-agent
-        (start-process "" floobits-message-buffer-name floobits-python-executable floobits-python-path floobits-python-args))
-      (floobits-debug-message "start-process: %s %s %s %s" floobits-message-buffer-name floobits-python-executable floobits-python-path floobits-python-args)
-      (switch-to-buffer floobits-message-buffer-name)
-      (set-process-filter floobits-python-agent 'floobits-agent-listener)
-      (accept-process-output floobits-python-agent 5)
-      (set-process-query-on-exit-flag floobits-python-agent nil)
-      (floobits-send-debug))
+      (progn
+        (setq floobits-python-agent
+              (start-process "" floobits-message-buffer-name floobits-python-executable floobits-python-path floobits-python-args))
+        (floobits-debug-message "start-process: %s %s %s %s" floobits-message-buffer-name floobits-python-executable floobits-python-path floobits-python-args)
+        (switch-to-buffer floobits-message-buffer-name)
+        (set-process-filter floobits-python-agent 'floobits-agent-listener)
+        (accept-process-output floobits-python-agent 5)
+        (set-process-query-on-exit-flag floobits-python-agent nil)
+        (floobits-send-debug))
     (error
-      (message "Emacs could not launch the python process! Note: python must be in exec-path\n%s" ex))))
+     (message "Emacs could not launch the python process! Note: python must be in exec-path\n%s" ex))))
 
 (defun floobits-send-to-agent (req event)
   (if (floobits-process-live-p floobits-conn)
-    (progn
-      (floo-set-item 'req 'name event)
-      ; This works around a bug in Emacs where regions aren't shown or something
-      (run-at-time .01 nil
-        (lambda (req)
-          (process-send-string floobits-conn (concat (json-encode req) "\n")))
-        req))
+      (progn
+        (floo-set-item 'req 'name event)
+        ;; This works around a bug in Emacs where regions aren't shown or something
+        (run-at-time .01 nil
+                     (lambda (req)
+                       (process-send-string floobits-conn (concat (json-encode req) "\n")))
+                     req))
     (progn
       (message "Connection to floobits died :(")
       (floobits-destroy-connection))))
 
 (defun floobits-event-user_input (req)
-  ; (minibufferp (current-buffer))
+  ;; (minibufferp (current-buffer))
   (if (active-minibuffer-window)
-    (push req floobits-user-input-events)
+      (push req floobits-user-input-events)
     (let
         ((prompt (floo-get-item req 'prompt))
-        (initial (floo-get-item req 'initial))
-        (choices (floo-get-item req 'choices))
-        (dir (floo-get-item req 'dir)))
+         (initial (floo-get-item req 'initial))
+         (choices (floo-get-item req 'choices))
+         (dir (floo-get-item req 'dir)))
       (floo-set-item 'req 'response
-        (cond
-          (choices (completing-read prompt (mapcar (lambda (x) (append x nil)) choices) nil t initial))
-          ((floo-get-item req 'y_or_n) (y-or-n-p prompt))
-          (dir (read-directory-name prompt nil initial))
-          (t (read-from-minibuffer prompt initial))))
+                     (cond
+                      (choices (completing-read prompt (mapcar (lambda (x) (append x nil)) choices) nil t initial))
+                      ((floo-get-item req 'y_or_n) (y-or-n-p prompt))
+                      (dir (read-directory-name prompt nil initial))
+                      (t (read-from-minibuffer prompt initial))))
       (floobits-send-to-agent req 'user_input))))
 
 (defun floobits-event-rename_buf (req)
   (let* ((old-path (floo-get-item req 'old_path))
-        (new-path (floo-get-item req 'path))
-        (buf (get-file-buffer old-path)))
+         (new-path (floo-get-item req 'path))
+         (buf (get-file-buffer old-path)))
     (rename-file old-path new-path 1)
     (when buf
       (with-current-buffer buf

  (goto-char (+ 1 (floo-get-item req 'offset))))

(defun floobits-highlight-apply-f (f highlights)
  ; convert to list :(
  (mapc
    (lambda(x)
      (let ((start (max 1 (min (buffer-size buffer) (+ (elt x 0) 1))))
            (end (+ (elt x 1) 2)))
        (funcall f start end)))
    highlights))

(defun floobits-apply-highlight (user_id buffer ranges)
  (let* ((key (list user_id (buffer-file-name buffer)))

"
  (interactive "DDirectory to share: ")
  (floobits-destroy-connection)
  (lexical-let* ((req (list
                       (cons 'perms '((AnonymousUser . [])))
                       (cons 'line_endings (floobits-get-line-endings))
                       (cons 'dir_to_share dir-to-share)))
                 (func (lambda () (floobits-send-to-agent req 'share_dir))))
    (floobits-create-connection func)))

(defun floobits-event-error (req)
