 
 (defun tirepl-repl-mark-output-end ()
   (add-text-properties tirepl-repl-output-start tirepl-repl-output-end
-                       '(face tirepl-repl-output-face 
+                       '(;;face tirepl-repl-output-face 
                          rear-nonsticky (face))))
 
 (defun tirepl-repl-reset-repl-markers ()

    (tirepl-repl-add-to-input-history
     (buffer-substring tirepl-repl-input-start-mark end))
    (tirepl-repl-show-maximum-output)

    (let ((overlay (make-overlay tirepl-repl-input-start-mark end)))
      ;; These properties are on an overlay so that they won't be taken
      ;; by kill/yank.

  ("\C-c\C-n" 'tirepl-repl-next-prompt)
  ("\C-c\C-p" 'tirepl-repl-previous-prompt))

(easy-menu-define nil tirepl-repl-mode-map "TiREPL"
  '("TiREPL"
    ["Eval expression in remote Titanium device..." tirepl-eval-send-expression]))
    

(define-minor-mode tirepl-repl-mode
  "Minor mode for interactive development with remote Titanium devices." nil " TiREPL"
  :keymap tirepl-repl-mode-map
  :group 'tirepl
  :global nil)

;; (defun tirepl-mode ()
;;   "Major mode for interactive development with remote Titanium devices."
;;   (interactive)
;;   (kill-all-local-variables)
;;   (setq major-mode 'tirepl-mode)
;;   (setq mode-name "TiREPL")
;;   (use-local-map tirepl-mode-map)

;;   (set (make-local-variable 'scroll-conservatively) 20)
;;   (set (make-local-variable 'scroll-margin) 0)
  
;;   (run-hooks 'tirepl-mode-hook))

;;; Testing
;;; Commented out for now- most of this is particular to my setup, but
;;; feel free to use as a template for you own local testing
;;;
;; (defun tirepl-test-net-send ()
;;   (interactive)
;;   (let* ((proc (tirepl-net-connect "localhost" 5051)))
;;     (sleep-for 1)
;;     (tirepl-net-send-raw "repl.status();\n" proc)
;;     (sleep-for 5)
;;     (tirepl-net-close proc)))

;; (defun tirepl-test-create-session ()
;;   (interactive)
;;   (let* ((sess (tirepl-session-make-session "localhost" 5051)))
;;     (sleep-for 1)
;;     (message "Created session: %s" sess)))

;; (defun tirepl-test-create-session-iphone ()
;;   (interactive)
;;   (let* ((sess (tirepl-session-make-session "localhost" 5061)))
;;     (sleep-for 1)
;;     (message "Created session: %s" sess)))

;; (defun tirepl-test-round-trip-message ()
;;   (tirepl-session-end-all-sessions)
;;   (tirepl-session-make-session)
;;   (tirepl-session-eval (tirepl-session-current-session) "repl.isRunning();\nrepl.status();"
;;                        (lambda (info) (message "Got reply: %s" info)))
;;   (sleep-for 5)
;;   (tirepl-session-end-all-sessions))

;; (defun tirepl-test-round-trip-iphone ()
;;   (tirepl-session-end-all-sessions)
;;   (tirepl-session-make-session "localhost" 5061)
;;   (sleep-for 1)
;;   (tirepl-session-eval (tirepl-session-current-session) "replserver.isRunning();\nreplserver.status();"
;;                        (lambda (info) (message "Got reply: %s" info)))
;;   (sleep-for 5)
;;   (tirepl-session-end-all-sessions))

;; (defun tirepl-test-make-json-msg ()
;;   (let ((session-id 1)
;;         (msg-id 23)
;;         (js-src "win1.backgroundColor = 'red';"))
;;   (json-encode-plist `(:session-id ,session-id
;;                                    :id ,msg-id :type "eval_src" :src ,js-src))))

;; (defun tirepl-test-make-b64-msg ()
;;   (base64-encode-string  (tirepl-test-make-json-msg) t))


;;; Setting up testing workspaces
;; (defun ka ()
;;   "Kill all sessions, unload tirepl, then reload"
;;   (tirepl-session-end-all-sessions)
;;   (unload-feature 'tirepl)
;;   (eval-buffer "tirepl.el")

;; (defun ws ()
;;   "Set up workspace with a session connected to localhost on port 5061"
;;   (tirepl-session-make-session "localhost" 5061)
;;   (tirepl-repl-switch-to-output-buffer))
