       (floobits-destroy-connection))))
 
 (defun floobits-event-user_input (req)
-  (let* ((choices (floo-get-item req 'choices))
+  ; (minibufferp (current-buffer))
+  (if (active-minibuffer-window)
+    (push req floobits-user-input-events)
+    (let*
+        ((choices (floo-get-item req 'choices))
         (choices (and choices (mapcar (lambda (x) (append x nil)) choices)))
         (prompt (floo-get-item req 'prompt))
         (initial (floo-get-item req 'initial)))
-    (floo-set-item 'req 'response
-      (cond
-        (choices (completing-read prompt choices nil t initial))
-        ((floo-get-item req 'y_or_n) (yes-or-no-p prompt))
-        (t (read-from-minibuffer prompt initial))))
-  (floobits-send-to-agent req 'user_input)))
+      (floo-set-item 'req 'response
+        (cond
+          (choices (completing-read prompt choices nil t initial))
+          ((floo-get-item req 'y_or_n) (yes-or-no-p prompt))
+          (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))

(defvar floobits-python-path (concat floobits-plugin-dir "floobits.py"))
(defvar floobits-python-agent)

(defvar floobits-change-set)
(defvar floobits-agent-buffer)
(defvar floobits-conn)
(defvar floobits-current-position)

    (remove-hook 'post-command-hook 'floobits-post-command-func))

  (remove-hook 'after-save-hook 'floobits-after-save-hook)
  (remove-hook 'minibuffer-exit-hook 'floobits-minibuffer-exit-hook)
  (ad-disable-advice 'delete-file 'before 'floobits-delete-file)
  (ad-disable-advice 'rename-file 'before 'floobits-rename-file))

