 
 ;; Number: The full buffer output.
 ;; Return: Cons with call number and result.
-(defun ems-parse-output (output)
+(defun ems-parse-output (output &optional acc)
   (let* ((start (string-match "BEGINOUTPUT[0-9]+: .* :ENDOUTPUT" output)))
-    (when start
+    (if start
       (let* ((rest (subseq output (+ start 11)))
              (colon (string-match ": " rest))
              (number (subseq rest 0 colon))
              (rest (subseq rest (+ colon 2)))
              (end (string-match " :ENDOUTPUT" rest))
-             (result (subseq rest 0 end)))
-        (print result)
-        (print number)
-        (push (cons (car (read-from-string number)) result) ems-results)
-        result))))
+             (result (subseq rest 0 end))
+             )
+        ;;(push (cons (car (read-from-string number)) result) ems-results)
+        (ems-parse-output (subseq rest end) 
+                          (cons (cons (car (read-from-string number)) result) acc)))
+      acc)))
 
 
 ;;; API

             (with-current-buffer (get-buffer "*ems-output*")
               (let ((result (ems-parse-output output)))
                 (when result 
                   (insert result)
                   (insert "\n"))
                 output))))))



(defun ems-stop ()
  (ems-teardown-bridge))


(defun ems-test ()
  (ems-start)
  (ems-start-walker "\\\\frac{x}{y}")
  ;; That does not seem to actually wait!
  (sleep-for 2)
  (ems-repeat)
  (ems-down)
  (ems-right)
  )
