           (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

(defadvice delete-file (before floobits-delete-file (name &optional trash))
  (when (floobits-path-is-shared name)
    (if (member "delete_buf" floobits-perms)
      (floobits-send-to-agent (list (cons 'path name)) 'delete_buf)
      (message "You don't have permission to delete buffers in this workspace."))))

(defadvice rename-file (before floobits-rename-file
    (old-name new-name &optional OK-IF-ALREADY-EXISTS))
  ; ignore renames for files ending in ~ since they're probably backups
  (when (and (floobits-path-is-shared old-name) (not (string= "~" (substring new-name -1))))
    (if (member "rename_buf" floobits-perms)
      (let ((req (list
            (cons 'path new-name)
            (cons 'old_path old-name))))
        (floobits-send-to-agent req 'rename_buf))
      (message "You don't have permission to rename buffers in this workspace."))))

(defmacro floo-get-item (alist key)

    (floobits-debug-message "User %s created buffer %s" username filename)))

(defun floobits-event-follow_user (req)
  (let ((username (floo-get-item req "username")))
    (setq floobits-follow-mode t)
    (add-to-list 'floobits-follow-users username)))

(defun floobits-event-delete_buf (req)
  (let ((filename (floo-get-item req "path" ))
