   "Performs `slate-eval-region' on the current region and inserts the output
 into the current buffer after the cursor."
   (interactive "r")
-  (let ((orig-buffer (current-buffer)))
-    (slate-ensure-running)
-    (set-process-filter
-     *slate-process*
-     (lambda (proc string) (insert string orig-buffer))))
+  (slate-ensure-running)
+  (set-process-filter *slate-process*
+		      (lambda (proc string) (insert string)))
   (save-excursion
     (goto-char end)
     (slate-backward-whitespace)
-    (comint-send-region inferior-slate-buffer-name start (point))
-    (comint-send-string
-     inferior-slate-buffer-name
-     (if (and (>= (point) 2) (equal (preceding-char) ?.)) "\n" ".\n")))
+    (slate-send-input (buffer-substring-no-properties start (point)) t)
+    (accept-process-output *slate-process*))
   (set-process-filter *slate-process* 'slate-inf-filter))
 
 (defun slate-quit ()

      (font-lock-mode))
    (pop-to-buffer "*slate-scratch*")))

(defun slate-run-code-at-point ()
  (interactive)
  (let* ((overlays (overlays-at (point)))
	 (first-overlay (car overlays))

  "Save a Slate snapshot."
  (interactive "FSnapshot name to save:")
  (setq mode-status "Saving")
  (slate-send-input (format "Image saveNamed: '%s'"
			    (expand-file-name filename))))

(defun slate-filein (filename)
  "Do a load: on FILENAME."
  (interactive "FSlate file to load: ")
  (slate-ensure-running)
  (setq mode-status "Loading")
  (slate-send-input (format "load: '%s'" (expand-file-name filename))))

(defun slate-unit-tests (filename)
  "Load the unit-test file for the current file and run the tests."
  (interactive "FUnit-test file to load: ")
  (slate-filein filename)
  (setq mode-status "Running tests")
  (slate-send-input (format "load: '%s'" (expand-file-name filename)))
  (slate-send-input "Tests CurrentUnit testSuite"))

(defun slate-send-input (string &optional hide-p)
  (slate-ensure-running)
  (set-buffer (get-buffer-create inferior-slate-buffer-name))
  (unless hide-p
    (save-excursion
      (point-max)
      (insert string)
      (insert (if (and (>= (point) 2) (equal (preceding-char) ?.)) "\n" ".\n"))))
  (setq mode-status "Running")
  (comint-send-string inferior-slate-buffer-name string)
  (comint-send-string
